diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AddonCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AddonCollection.cs new file mode 100644 index 000000000000..dd3c1725ddc6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AddonCollection.cs @@ -0,0 +1,764 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_AddonCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AddonsCreateOrUpdateArcReg() + { + // Generated from example definition: 2024-09-01/Addons_CreateOrUpdate_ArcReg.json + // this example is just showing the usage of "Addon_CreateOrUpdate" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "arc"; + AddonData data = new AddonData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, addonName, data); + AddonResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AddonsCreateOrUpdateHCX() + { + // Generated from example definition: 2024-09-01/Addons_CreateOrUpdate_HCX.json + // this example is just showing the usage of "Addon_CreateOrUpdate" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "hcx"; + AddonData data = new AddonData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, addonName, data); + AddonResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AddonsCreateOrUpdateHCXWithNetworks() + { + // Generated from example definition: 2024-09-01/Addons_CreateOrUpdate_HCX_With_Networks.json + // this example is just showing the usage of "Addon_CreateOrUpdate" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "hcx"; + AddonData data = new AddonData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, addonName, data); + AddonResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AddonsCreateOrUpdateSRM() + { + // Generated from example definition: 2024-09-01/Addons_CreateOrUpdate_SRM.json + // this example is just showing the usage of "Addon_CreateOrUpdate" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "srm"; + AddonData data = new AddonData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, addonName, data); + AddonResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AddonsCreateOrUpdateVR() + { + // Generated from example definition: 2024-09-01/Addons_CreateOrUpdate_VR.json + // this example is just showing the usage of "Addon_CreateOrUpdate" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "vr"; + AddonData data = new AddonData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, addonName, data); + AddonResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AddonsGetArcReg() + { + // Generated from example definition: 2024-09-01/Addons_Get_ArcReg.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "arc"; + AddonResource result = await collection.GetAsync(addonName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AddonsGetHCX() + { + // Generated from example definition: 2024-09-01/Addons_Get_HCX.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "hcx"; + AddonResource result = await collection.GetAsync(addonName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AddonsGetHCXWithNetworks() + { + // Generated from example definition: 2024-09-01/Addons_Get_HCX_With_Networks.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "hcx"; + AddonResource result = await collection.GetAsync(addonName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AddonsGetSRM() + { + // Generated from example definition: 2024-09-01/Addons_Get_SRM.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "srm"; + AddonResource result = await collection.GetAsync(addonName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AddonsGetVR() + { + // Generated from example definition: 2024-09-01/Addons_Get_VR.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "vr"; + AddonResource result = await collection.GetAsync(addonName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_AddonsList() + { + // Generated from example definition: 2024-09-01/Addons_List.json + // this example is just showing the usage of "Addon_List" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation and iterate over the result + await foreach (AddonResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_AddonsGetArcReg() + { + // Generated from example definition: 2024-09-01/Addons_Get_ArcReg.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "arc"; + bool result = await collection.ExistsAsync(addonName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_AddonsGetHCX() + { + // Generated from example definition: 2024-09-01/Addons_Get_HCX.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "hcx"; + bool result = await collection.ExistsAsync(addonName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_AddonsGetHCXWithNetworks() + { + // Generated from example definition: 2024-09-01/Addons_Get_HCX_With_Networks.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "hcx"; + bool result = await collection.ExistsAsync(addonName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_AddonsGetSRM() + { + // Generated from example definition: 2024-09-01/Addons_Get_SRM.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "srm"; + bool result = await collection.ExistsAsync(addonName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_AddonsGetVR() + { + // Generated from example definition: 2024-09-01/Addons_Get_VR.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "vr"; + bool result = await collection.ExistsAsync(addonName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AddonsGetArcReg() + { + // Generated from example definition: 2024-09-01/Addons_Get_ArcReg.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "arc"; + NullableResponse response = await collection.GetIfExistsAsync(addonName); + AddonResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AddonsGetHCX() + { + // Generated from example definition: 2024-09-01/Addons_Get_HCX.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "hcx"; + NullableResponse response = await collection.GetIfExistsAsync(addonName); + AddonResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AddonsGetHCXWithNetworks() + { + // Generated from example definition: 2024-09-01/Addons_Get_HCX_With_Networks.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "hcx"; + NullableResponse response = await collection.GetIfExistsAsync(addonName); + AddonResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AddonsGetSRM() + { + // Generated from example definition: 2024-09-01/Addons_Get_SRM.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "srm"; + NullableResponse response = await collection.GetIfExistsAsync(addonName); + AddonResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AddonsGetVR() + { + // Generated from example definition: 2024-09-01/Addons_Get_VR.json + // this example is just showing the usage of "Addon_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this AddonResource + AddonCollection collection = privateCloud.GetAddons(); + + // invoke the operation + string addonName = "vr"; + NullableResponse response = await collection.GetIfExistsAsync(addonName); + AddonResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AddonResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AddonResource.cs new file mode 100644 index 000000000000..c573558be29e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_AddonResource.cs @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_AddonResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AddonsGetArcReg() + { + // Generated from example definition: 2024-09-01/Addons_Get_ArcReg.json + // this example is just showing the usage of "Addon_Get" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "arc"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + AddonResource result = await addon.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AddonsGetHCX() + { + // Generated from example definition: 2024-09-01/Addons_Get_HCX.json + // this example is just showing the usage of "Addon_Get" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "hcx"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + AddonResource result = await addon.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AddonsGetHCXWithNetworks() + { + // Generated from example definition: 2024-09-01/Addons_Get_HCX_With_Networks.json + // this example is just showing the usage of "Addon_Get" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "hcx"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + AddonResource result = await addon.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AddonsGetSRM() + { + // Generated from example definition: 2024-09-01/Addons_Get_SRM.json + // this example is just showing the usage of "Addon_Get" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "srm"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + AddonResource result = await addon.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AddonsGetVR() + { + // Generated from example definition: 2024-09-01/Addons_Get_VR.json + // this example is just showing the usage of "Addon_Get" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "vr"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + AddonResource result = await addon.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_AddonsDelete() + { + // Generated from example definition: 2024-09-01/Addons_Delete.json + // this example is just showing the usage of "Addon_Delete" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "srm"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + await addon.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AddonsCreateOrUpdateArcReg() + { + // Generated from example definition: 2024-09-01/Addons_CreateOrUpdate_ArcReg.json + // this example is just showing the usage of "Addon_CreateOrUpdate" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "arc"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + AddonData data = new AddonData(); + ArmOperation lro = await addon.UpdateAsync(WaitUntil.Completed, data); + AddonResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AddonsCreateOrUpdateHCX() + { + // Generated from example definition: 2024-09-01/Addons_CreateOrUpdate_HCX.json + // this example is just showing the usage of "Addon_CreateOrUpdate" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "hcx"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + AddonData data = new AddonData(); + ArmOperation lro = await addon.UpdateAsync(WaitUntil.Completed, data); + AddonResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AddonsCreateOrUpdateHCXWithNetworks() + { + // Generated from example definition: 2024-09-01/Addons_CreateOrUpdate_HCX_With_Networks.json + // this example is just showing the usage of "Addon_CreateOrUpdate" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "hcx"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + AddonData data = new AddonData(); + ArmOperation lro = await addon.UpdateAsync(WaitUntil.Completed, data); + AddonResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AddonsCreateOrUpdateSRM() + { + // Generated from example definition: 2024-09-01/Addons_CreateOrUpdate_SRM.json + // this example is just showing the usage of "Addon_CreateOrUpdate" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "srm"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + AddonData data = new AddonData(); + ArmOperation lro = await addon.UpdateAsync(WaitUntil.Completed, data); + AddonResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AddonsCreateOrUpdateVR() + { + // Generated from example definition: 2024-09-01/Addons_CreateOrUpdate_VR.json + // this example is just showing the usage of "Addon_CreateOrUpdate" 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 AddonResource created on azure + // for more information of creating AddonResource, please refer to the document of AddonResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string addonName = "vr"; + ResourceIdentifier addonResourceId = AddonResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, addonName); + AddonResource addon = client.GetAddonResource(addonResourceId); + + // invoke the operation + AddonData data = new AddonData(); + ArmOperation lro = await addon.UpdateAsync(WaitUntil.Completed, data); + AddonResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AddonData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_CloudLinkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_CloudLinkCollection.cs new file mode 100644 index 000000000000..720f04085ba4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_CloudLinkCollection.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_CloudLinkCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CloudLinksCreateOrUpdate() + { + // Generated from example definition: 2024-09-01/CloudLinks_CreateOrUpdate.json + // this example is just showing the usage of "CloudLink_CreateOrUpdate" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this CloudLinkResource + CloudLinkCollection collection = privateCloud.GetCloudLinks(); + + // invoke the operation + string cloudLinkName = "cloudLink1"; + CloudLinkData data = new CloudLinkData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, cloudLinkName, data); + CloudLinkResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CloudLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_CloudLinksGet() + { + // Generated from example definition: 2024-09-01/CloudLinks_Get.json + // this example is just showing the usage of "CloudLink_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this CloudLinkResource + CloudLinkCollection collection = privateCloud.GetCloudLinks(); + + // invoke the operation + string cloudLinkName = "cloudLink1"; + CloudLinkResource result = await collection.GetAsync(cloudLinkName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CloudLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_CloudLinksList() + { + // Generated from example definition: 2024-09-01/CloudLinks_List.json + // this example is just showing the usage of "CloudLink_List" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this CloudLinkResource + CloudLinkCollection collection = privateCloud.GetCloudLinks(); + + // invoke the operation and iterate over the result + await foreach (CloudLinkResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CloudLinkData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_CloudLinksGet() + { + // Generated from example definition: 2024-09-01/CloudLinks_Get.json + // this example is just showing the usage of "CloudLink_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this CloudLinkResource + CloudLinkCollection collection = privateCloud.GetCloudLinks(); + + // invoke the operation + string cloudLinkName = "cloudLink1"; + bool result = await collection.ExistsAsync(cloudLinkName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_CloudLinksGet() + { + // Generated from example definition: 2024-09-01/CloudLinks_Get.json + // this example is just showing the usage of "CloudLink_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this CloudLinkResource + CloudLinkCollection collection = privateCloud.GetCloudLinks(); + + // invoke the operation + string cloudLinkName = "cloudLink1"; + NullableResponse response = await collection.GetIfExistsAsync(cloudLinkName); + CloudLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CloudLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_CloudLinkResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_CloudLinkResource.cs new file mode 100644 index 000000000000..29f33f78147a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_CloudLinkResource.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_CloudLinkResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_CloudLinksGet() + { + // Generated from example definition: 2024-09-01/CloudLinks_Get.json + // this example is just showing the usage of "CloudLink_Get" 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 CloudLinkResource created on azure + // for more information of creating CloudLinkResource, please refer to the document of CloudLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string cloudLinkName = "cloudLink1"; + ResourceIdentifier cloudLinkResourceId = CloudLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, cloudLinkName); + CloudLinkResource cloudLink = client.GetCloudLinkResource(cloudLinkResourceId); + + // invoke the operation + CloudLinkResource result = await cloudLink.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CloudLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_CloudLinksDelete() + { + // Generated from example definition: 2024-09-01/CloudLinks_Delete.json + // this example is just showing the usage of "CloudLink_Delete" 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 CloudLinkResource created on azure + // for more information of creating CloudLinkResource, please refer to the document of CloudLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string cloudLinkName = "cloudLink1"; + ResourceIdentifier cloudLinkResourceId = CloudLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, cloudLinkName); + CloudLinkResource cloudLink = client.GetCloudLinkResource(cloudLinkResourceId); + + // invoke the operation + await cloudLink.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CloudLinksCreateOrUpdate() + { + // Generated from example definition: 2024-09-01/CloudLinks_CreateOrUpdate.json + // this example is just showing the usage of "CloudLink_CreateOrUpdate" 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 CloudLinkResource created on azure + // for more information of creating CloudLinkResource, please refer to the document of CloudLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string cloudLinkName = "cloudLink1"; + ResourceIdentifier cloudLinkResourceId = CloudLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, cloudLinkName); + CloudLinkResource cloudLink = client.GetCloudLinkResource(cloudLinkResourceId); + + // invoke the operation + CloudLinkData data = new CloudLinkData(); + ArmOperation lro = await cloudLink.UpdateAsync(WaitUntil.Completed, data); + CloudLinkResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CloudLinkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ClusterCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ClusterCollection.cs new file mode 100644 index 000000000000..88ebe1d3f489 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ClusterCollection.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Avs.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_ClusterCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ClustersCreateOrUpdate() + { + // Generated from example definition: 2024-09-01/Clusters_CreateOrUpdate.json + // this example is just showing the usage of "Cluster_CreateOrUpdate" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this ClusterResource + ClusterCollection collection = privateCloud.GetClusters(); + + // invoke the operation + string clusterName = "cluster1"; + ClusterData data = new ClusterData(null); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, data); + ClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_ClustersGet() + { + // Generated from example definition: 2024-09-01/Clusters_Get.json + // this example is just showing the usage of "Cluster_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this ClusterResource + ClusterCollection collection = privateCloud.GetClusters(); + + // invoke the operation + string clusterName = "cluster1"; + ClusterResource result = await collection.GetAsync(clusterName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ClustersList() + { + // Generated from example definition: 2024-09-01/Clusters_List.json + // this example is just showing the usage of "Cluster_List" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this ClusterResource + ClusterCollection collection = privateCloud.GetClusters(); + + // invoke the operation and iterate over the result + await foreach (ClusterResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ClusterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_ClustersGet() + { + // Generated from example definition: 2024-09-01/Clusters_Get.json + // this example is just showing the usage of "Cluster_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this ClusterResource + ClusterCollection collection = privateCloud.GetClusters(); + + // invoke the operation + string clusterName = "cluster1"; + bool result = await collection.ExistsAsync(clusterName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_ClustersGet() + { + // Generated from example definition: 2024-09-01/Clusters_Get.json + // this example is just showing the usage of "Cluster_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this ClusterResource + ClusterCollection collection = privateCloud.GetClusters(); + + // invoke the operation + string clusterName = "cluster1"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + ClusterResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ClusterResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ClusterResource.cs new file mode 100644 index 000000000000..c0332acb84d8 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ClusterResource.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Avs.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_ClusterResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_ClustersGet() + { + // Generated from example definition: 2024-09-01/Clusters_Get.json + // this example is just showing the usage of "Cluster_Get" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // invoke the operation + ClusterResource result = await cluster.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_ClustersDelete() + { + // Generated from example definition: 2024-09-01/Clusters_Delete.json + // this example is just showing the usage of "Cluster_Delete" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // invoke the operation + await cluster.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ClustersUpdate() + { + // Generated from example definition: 2024-09-01/Clusters_Update.json + // this example is just showing the usage of "Cluster_Update" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // invoke the operation + ClusterPatch patch = new ClusterPatch(); + ArmOperation lro = await cluster.UpdateAsync(WaitUntil.Completed, patch); + ClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetZones_ClustersListZones() + { + // Generated from example definition: 2024-09-01/Clusters_ListZones.json + // this example is just showing the usage of "Clusters_ListZones" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // invoke the operation + ClusterZoneList result = await cluster.GetZonesAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetZones_ClustersListZonesStretched() + { + // Generated from example definition: 2024-09-01/Clusters_ListZones_Stretched.json + // this example is just showing the usage of "Clusters_ListZones" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // invoke the operation + ClusterZoneList result = await cluster.GetZonesAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_DatastoreCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_DatastoreCollection.cs new file mode 100644 index 000000000000..a92c358ae378 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_DatastoreCollection.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_DatastoreCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_DatastoresCreateOrUpdate() + { + // Generated from example definition: 2024-09-01/Datastores_CreateOrUpdate.json + // this example is just showing the usage of "Datastore_CreateOrUpdate" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this DatastoreResource + DatastoreCollection collection = cluster.GetDatastores(); + + // invoke the operation + string datastoreName = "datastore1"; + DatastoreData data = new DatastoreData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, datastoreName, data); + DatastoreResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatastoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_DatastoresGet() + { + // Generated from example definition: 2024-09-01/Datastores_Get.json + // this example is just showing the usage of "Datastore_Get" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this DatastoreResource + DatastoreCollection collection = cluster.GetDatastores(); + + // invoke the operation + string datastoreName = "datastore1"; + DatastoreResource result = await collection.GetAsync(datastoreName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatastoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_DatastoresList() + { + // Generated from example definition: 2024-09-01/Datastores_List.json + // this example is just showing the usage of "Datastore_List" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this DatastoreResource + DatastoreCollection collection = cluster.GetDatastores(); + + // invoke the operation and iterate over the result + await foreach (DatastoreResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatastoreData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_DatastoresGet() + { + // Generated from example definition: 2024-09-01/Datastores_Get.json + // this example is just showing the usage of "Datastore_Get" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this DatastoreResource + DatastoreCollection collection = cluster.GetDatastores(); + + // invoke the operation + string datastoreName = "datastore1"; + bool result = await collection.ExistsAsync(datastoreName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_DatastoresGet() + { + // Generated from example definition: 2024-09-01/Datastores_Get.json + // this example is just showing the usage of "Datastore_Get" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this DatastoreResource + DatastoreCollection collection = cluster.GetDatastores(); + + // invoke the operation + string datastoreName = "datastore1"; + NullableResponse response = await collection.GetIfExistsAsync(datastoreName); + DatastoreResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatastoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_DatastoreResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_DatastoreResource.cs new file mode 100644 index 000000000000..9ffca9ca7568 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_DatastoreResource.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_DatastoreResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_DatastoresGet() + { + // Generated from example definition: 2024-09-01/Datastores_Get.json + // this example is just showing the usage of "Datastore_Get" 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 DatastoreResource created on azure + // for more information of creating DatastoreResource, please refer to the document of DatastoreResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + string datastoreName = "datastore1"; + ResourceIdentifier datastoreResourceId = DatastoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName, datastoreName); + DatastoreResource datastore = client.GetDatastoreResource(datastoreResourceId); + + // invoke the operation + DatastoreResource result = await datastore.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatastoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DatastoresDelete() + { + // Generated from example definition: 2024-09-01/Datastores_Delete.json + // this example is just showing the usage of "Datastore_Delete" 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 DatastoreResource created on azure + // for more information of creating DatastoreResource, please refer to the document of DatastoreResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + string datastoreName = "datastore1"; + ResourceIdentifier datastoreResourceId = DatastoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName, datastoreName); + DatastoreResource datastore = client.GetDatastoreResource(datastoreResourceId); + + // invoke the operation + await datastore.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_DatastoresCreateOrUpdate() + { + // Generated from example definition: 2024-09-01/Datastores_CreateOrUpdate.json + // this example is just showing the usage of "Datastore_CreateOrUpdate" 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 DatastoreResource created on azure + // for more information of creating DatastoreResource, please refer to the document of DatastoreResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + string datastoreName = "datastore1"; + ResourceIdentifier datastoreResourceId = DatastoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName, datastoreName); + DatastoreResource datastore = client.GetDatastoreResource(datastoreResourceId); + + // invoke the operation + DatastoreData data = new DatastoreData(); + ArmOperation lro = await datastore.UpdateAsync(WaitUntil.Completed, data); + DatastoreResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatastoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationCollection.cs index d3fbf08a0793..2f4ba2288645 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationCollection.cs @@ -19,24 +19,24 @@ public partial class Sample_ExpressRouteAuthorizationCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_AuthorizationsCreateOrUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_CreateOrUpdate.json - // this example is just showing the usage of "Authorizations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/Authorizations_CreateOrUpdate.json + // this example is just showing the usage of "ExpressRouteAuthorization_CreateOrUpdate" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ExpressRouteAuthorizationResource - ExpressRouteAuthorizationCollection collection = avsPrivateCloud.GetExpressRouteAuthorizations(); + ExpressRouteAuthorizationCollection collection = privateCloud.GetExpressRouteAuthorizations(); // invoke the operation string authorizationName = "authorization1"; @@ -55,24 +55,24 @@ public async Task CreateOrUpdate_AuthorizationsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_AuthorizationsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_Get.json - // this example is just showing the usage of "Authorizations_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/Authorizations_Get.json + // this example is just showing the usage of "ExpressRouteAuthorization_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ExpressRouteAuthorizationResource - ExpressRouteAuthorizationCollection collection = avsPrivateCloud.GetExpressRouteAuthorizations(); + ExpressRouteAuthorizationCollection collection = privateCloud.GetExpressRouteAuthorizations(); // invoke the operation string authorizationName = "authorization1"; @@ -89,24 +89,24 @@ public async Task Get_AuthorizationsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_AuthorizationsList() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_List.json - // this example is just showing the usage of "Authorizations_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/Authorizations_List.json + // this example is just showing the usage of "ExpressRouteAuthorization_List" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ExpressRouteAuthorizationResource - ExpressRouteAuthorizationCollection collection = avsPrivateCloud.GetExpressRouteAuthorizations(); + ExpressRouteAuthorizationCollection collection = privateCloud.GetExpressRouteAuthorizations(); // invoke the operation and iterate over the result await foreach (ExpressRouteAuthorizationResource item in collection.GetAllAsync()) @@ -125,24 +125,24 @@ public async Task GetAll_AuthorizationsList() [Ignore("Only validating compilation of examples")] public async Task Exists_AuthorizationsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_Get.json - // this example is just showing the usage of "Authorizations_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/Authorizations_Get.json + // this example is just showing the usage of "ExpressRouteAuthorization_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ExpressRouteAuthorizationResource - ExpressRouteAuthorizationCollection collection = avsPrivateCloud.GetExpressRouteAuthorizations(); + ExpressRouteAuthorizationCollection collection = privateCloud.GetExpressRouteAuthorizations(); // invoke the operation string authorizationName = "authorization1"; @@ -155,24 +155,24 @@ public async Task Exists_AuthorizationsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_AuthorizationsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_Get.json - // this example is just showing the usage of "Authorizations_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/Authorizations_Get.json + // this example is just showing the usage of "ExpressRouteAuthorization_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ExpressRouteAuthorizationResource - ExpressRouteAuthorizationCollection collection = avsPrivateCloud.GetExpressRouteAuthorizations(); + ExpressRouteAuthorizationCollection collection = privateCloud.GetExpressRouteAuthorizations(); // invoke the operation string authorizationName = "authorization1"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationResource.cs index 89599a692576..23df02c19b7c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ExpressRouteAuthorizationResource.cs @@ -19,8 +19,8 @@ public partial class Sample_ExpressRouteAuthorizationResource [Ignore("Only validating compilation of examples")] public async Task Get_AuthorizationsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_Get.json - // this example is just showing the usage of "Authorizations_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/Authorizations_Get.json + // this example is just showing the usage of "ExpressRouteAuthorization_Get" 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(); @@ -50,8 +50,8 @@ public async Task Get_AuthorizationsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_AuthorizationsDelete() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_Delete.json - // this example is just showing the usage of "Authorizations_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/Authorizations_Delete.json + // this example is just showing the usage of "ExpressRouteAuthorization_Delete" 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(); @@ -77,8 +77,8 @@ public async Task Delete_AuthorizationsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_AuthorizationsCreateOrUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_CreateOrUpdate.json - // this example is just showing the usage of "Authorizations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/Authorizations_CreateOrUpdate.json + // this example is just showing the usage of "ExpressRouteAuthorization_CreateOrUpdate" 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(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionCollection.cs index 9640f2353d2a..2b824faec7ae 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionCollection.cs @@ -19,32 +19,28 @@ public partial class Sample_GlobalReachConnectionCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_GlobalReachConnectionsCreateOrUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_CreateOrUpdate.json - // this example is just showing the usage of "GlobalReachConnections_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/GlobalReachConnections_CreateOrUpdate.json + // this example is just showing the usage of "GlobalReachConnection_CreateOrUpdate" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this GlobalReachConnectionResource - GlobalReachConnectionCollection collection = avsPrivateCloud.GetGlobalReachConnections(); + GlobalReachConnectionCollection collection = privateCloud.GetGlobalReachConnections(); // invoke the operation string globalReachConnectionName = "connection1"; - GlobalReachConnectionData data = new GlobalReachConnectionData - { - AuthorizationKey = "01010101-0101-0101-0101-010101010101", - PeerExpressRouteCircuit = new ResourceIdentifier("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer"), - }; + GlobalReachConnectionData data = new GlobalReachConnectionData(); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, globalReachConnectionName, data); GlobalReachConnectionResource result = lro.Value; @@ -59,24 +55,24 @@ public async Task CreateOrUpdate_GlobalReachConnectionsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_GlobalReachConnectionsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_Get.json - // this example is just showing the usage of "GlobalReachConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/GlobalReachConnections_Get.json + // this example is just showing the usage of "GlobalReachConnection_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this GlobalReachConnectionResource - GlobalReachConnectionCollection collection = avsPrivateCloud.GetGlobalReachConnections(); + GlobalReachConnectionCollection collection = privateCloud.GetGlobalReachConnections(); // invoke the operation string globalReachConnectionName = "connection1"; @@ -93,24 +89,24 @@ public async Task Get_GlobalReachConnectionsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_GlobalReachConnectionsList() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_List.json - // this example is just showing the usage of "GlobalReachConnections_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/GlobalReachConnections_List.json + // this example is just showing the usage of "GlobalReachConnection_List" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this GlobalReachConnectionResource - GlobalReachConnectionCollection collection = avsPrivateCloud.GetGlobalReachConnections(); + GlobalReachConnectionCollection collection = privateCloud.GetGlobalReachConnections(); // invoke the operation and iterate over the result await foreach (GlobalReachConnectionResource item in collection.GetAllAsync()) @@ -129,24 +125,24 @@ public async Task GetAll_GlobalReachConnectionsList() [Ignore("Only validating compilation of examples")] public async Task Exists_GlobalReachConnectionsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_Get.json - // this example is just showing the usage of "GlobalReachConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/GlobalReachConnections_Get.json + // this example is just showing the usage of "GlobalReachConnection_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this GlobalReachConnectionResource - GlobalReachConnectionCollection collection = avsPrivateCloud.GetGlobalReachConnections(); + GlobalReachConnectionCollection collection = privateCloud.GetGlobalReachConnections(); // invoke the operation string globalReachConnectionName = "connection1"; @@ -159,24 +155,24 @@ public async Task Exists_GlobalReachConnectionsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GlobalReachConnectionsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_Get.json - // this example is just showing the usage of "GlobalReachConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/GlobalReachConnections_Get.json + // this example is just showing the usage of "GlobalReachConnection_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this GlobalReachConnectionResource - GlobalReachConnectionCollection collection = avsPrivateCloud.GetGlobalReachConnections(); + GlobalReachConnectionCollection collection = privateCloud.GetGlobalReachConnections(); // invoke the operation string globalReachConnectionName = "connection1"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionResource.cs index 51034d6993d4..f231495fb465 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_GlobalReachConnectionResource.cs @@ -19,8 +19,8 @@ public partial class Sample_GlobalReachConnectionResource [Ignore("Only validating compilation of examples")] public async Task Get_GlobalReachConnectionsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_Get.json - // this example is just showing the usage of "GlobalReachConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/GlobalReachConnections_Get.json + // this example is just showing the usage of "GlobalReachConnection_Get" 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(); @@ -50,8 +50,8 @@ public async Task Get_GlobalReachConnectionsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_GlobalReachConnectionsDelete() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_Delete.json - // this example is just showing the usage of "GlobalReachConnections_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/GlobalReachConnections_Delete.json + // this example is just showing the usage of "GlobalReachConnection_Delete" 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(); @@ -77,8 +77,8 @@ public async Task Delete_GlobalReachConnectionsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_GlobalReachConnectionsCreateOrUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_CreateOrUpdate.json - // this example is just showing the usage of "GlobalReachConnections_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/GlobalReachConnections_CreateOrUpdate.json + // this example is just showing the usage of "GlobalReachConnection_CreateOrUpdate" 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(); @@ -95,11 +95,7 @@ public async Task Update_GlobalReachConnectionsCreateOrUpdate() GlobalReachConnectionResource globalReachConnection = client.GetGlobalReachConnectionResource(globalReachConnectionResourceId); // invoke the operation - GlobalReachConnectionData data = new GlobalReachConnectionData - { - AuthorizationKey = "01010101-0101-0101-0101-010101010101", - PeerExpressRouteCircuit = new ResourceIdentifier("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer"), - }; + GlobalReachConnectionData data = new GlobalReachConnectionData(); ArmOperation lro = await globalReachConnection.UpdateAsync(WaitUntil.Completed, data); GlobalReachConnectionResource result = lro.Value; diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteCollection.cs index c879da920d4e..9f88306c6ad1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteCollection.cs @@ -19,24 +19,24 @@ public partial class Sample_HcxEnterpriseSiteCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_HcxEnterpriseSitesCreateOrUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_CreateOrUpdate.json - // this example is just showing the usage of "HcxEnterpriseSites_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/HcxEnterpriseSites_CreateOrUpdate.json + // this example is just showing the usage of "HcxEnterpriseSite_CreateOrUpdate" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this HcxEnterpriseSiteResource - HcxEnterpriseSiteCollection collection = avsPrivateCloud.GetHcxEnterpriseSites(); + HcxEnterpriseSiteCollection collection = privateCloud.GetHcxEnterpriseSites(); // invoke the operation string hcxEnterpriseSiteName = "site1"; @@ -55,24 +55,24 @@ public async Task CreateOrUpdate_HcxEnterpriseSitesCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_HcxEnterpriseSitesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_Get.json - // this example is just showing the usage of "HcxEnterpriseSites_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/HcxEnterpriseSites_Get.json + // this example is just showing the usage of "HcxEnterpriseSite_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this HcxEnterpriseSiteResource - HcxEnterpriseSiteCollection collection = avsPrivateCloud.GetHcxEnterpriseSites(); + HcxEnterpriseSiteCollection collection = privateCloud.GetHcxEnterpriseSites(); // invoke the operation string hcxEnterpriseSiteName = "site1"; @@ -89,24 +89,24 @@ public async Task Get_HcxEnterpriseSitesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_HcxEnterpriseSitesList() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_List.json - // this example is just showing the usage of "HcxEnterpriseSites_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/HcxEnterpriseSites_List.json + // this example is just showing the usage of "HcxEnterpriseSite_List" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this HcxEnterpriseSiteResource - HcxEnterpriseSiteCollection collection = avsPrivateCloud.GetHcxEnterpriseSites(); + HcxEnterpriseSiteCollection collection = privateCloud.GetHcxEnterpriseSites(); // invoke the operation and iterate over the result await foreach (HcxEnterpriseSiteResource item in collection.GetAllAsync()) @@ -125,24 +125,24 @@ public async Task GetAll_HcxEnterpriseSitesList() [Ignore("Only validating compilation of examples")] public async Task Exists_HcxEnterpriseSitesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_Get.json - // this example is just showing the usage of "HcxEnterpriseSites_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/HcxEnterpriseSites_Get.json + // this example is just showing the usage of "HcxEnterpriseSite_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this HcxEnterpriseSiteResource - HcxEnterpriseSiteCollection collection = avsPrivateCloud.GetHcxEnterpriseSites(); + HcxEnterpriseSiteCollection collection = privateCloud.GetHcxEnterpriseSites(); // invoke the operation string hcxEnterpriseSiteName = "site1"; @@ -155,24 +155,24 @@ public async Task Exists_HcxEnterpriseSitesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_HcxEnterpriseSitesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_Get.json - // this example is just showing the usage of "HcxEnterpriseSites_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/HcxEnterpriseSites_Get.json + // this example is just showing the usage of "HcxEnterpriseSite_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this HcxEnterpriseSiteResource - HcxEnterpriseSiteCollection collection = avsPrivateCloud.GetHcxEnterpriseSites(); + HcxEnterpriseSiteCollection collection = privateCloud.GetHcxEnterpriseSites(); // invoke the operation string hcxEnterpriseSiteName = "site1"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteResource.cs index d64b015d47dc..a3b7e1836c21 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HcxEnterpriseSiteResource.cs @@ -19,8 +19,8 @@ public partial class Sample_HcxEnterpriseSiteResource [Ignore("Only validating compilation of examples")] public async Task Get_HcxEnterpriseSitesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_Get.json - // this example is just showing the usage of "HcxEnterpriseSites_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/HcxEnterpriseSites_Get.json + // this example is just showing the usage of "HcxEnterpriseSite_Get" 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(); @@ -50,8 +50,8 @@ public async Task Get_HcxEnterpriseSitesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_HcxEnterpriseSitesDelete() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_Delete.json - // this example is just showing the usage of "HcxEnterpriseSites_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/HcxEnterpriseSites_Delete.json + // this example is just showing the usage of "HcxEnterpriseSite_Delete" 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(); @@ -77,8 +77,8 @@ public async Task Delete_HcxEnterpriseSitesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_HcxEnterpriseSitesCreateOrUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_CreateOrUpdate.json - // this example is just showing the usage of "HcxEnterpriseSites_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/HcxEnterpriseSites_CreateOrUpdate.json + // this example is just showing the usage of "HcxEnterpriseSite_CreateOrUpdate" 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(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HostCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HostCollection.cs new file mode 100644 index 000000000000..39c4046629c9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HostCollection.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_HostCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_HostsGet() + { + // Generated from example definition: 2024-09-01/Hosts_Get.json + // this example is just showing the usage of "Host_Get" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this HostResource + HostCollection collection = cluster.GetHosts(); + + // invoke the operation + string hostId = "esx03-r52.1111111111111111111.westcentralus.prod.azure.com"; + HostResource result = await collection.GetAsync(hostId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + HostData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_HostsList() + { + // Generated from example definition: 2024-09-01/Hosts_List.json + // this example is just showing the usage of "Host_List" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this HostResource + HostCollection collection = cluster.GetHosts(); + + // invoke the operation and iterate over the result + await foreach (HostResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + HostData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_HostsGet() + { + // Generated from example definition: 2024-09-01/Hosts_Get.json + // this example is just showing the usage of "Host_Get" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this HostResource + HostCollection collection = cluster.GetHosts(); + + // invoke the operation + string hostId = "esx03-r52.1111111111111111111.westcentralus.prod.azure.com"; + bool result = await collection.ExistsAsync(hostId); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_HostsGet() + { + // Generated from example definition: 2024-09-01/Hosts_Get.json + // this example is just showing the usage of "Host_Get" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this HostResource + HostCollection collection = cluster.GetHosts(); + + // invoke the operation + string hostId = "esx03-r52.1111111111111111111.westcentralus.prod.azure.com"; + NullableResponse response = await collection.GetIfExistsAsync(hostId); + HostResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + HostData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HostResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HostResource.cs new file mode 100644 index 000000000000..018f35438577 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_HostResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_HostResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_HostsGet() + { + // Generated from example definition: 2024-09-01/Hosts_Get.json + // this example is just showing the usage of "Host_Get" 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 HostResource created on azure + // for more information of creating HostResource, please refer to the document of HostResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + string hostId = "esx03-r52.1111111111111111111.westcentralus.prod.azure.com"; + ResourceIdentifier hostResourceId = HostResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName, hostId); + HostResource host = client.GetHostResource(hostResourceId); + + // invoke the operation + HostResource result = await host.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + HostData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_IscsiPathResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_IscsiPathResource.cs index cc4a7e4f5b24..4e604d6dd33f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_IscsiPathResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_IscsiPathResource.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Azure.ResourceManager.Avs.Models; using NUnit.Framework; namespace Azure.ResourceManager.Avs.Samples @@ -19,8 +20,8 @@ public partial class Sample_IscsiPathResource [Ignore("Only validating compilation of examples")] public async Task Get_IscsiPathsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_Get.json - // this example is just showing the usage of "IscsiPaths_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/IscsiPaths_Get.json + // this example is just showing the usage of "IscsiPath_Get" 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(); @@ -49,8 +50,8 @@ public async Task Get_IscsiPathsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_IscsiPathsDelete() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_Delete.json - // this example is just showing the usage of "IscsiPaths_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/IscsiPaths_Delete.json + // this example is just showing the usage of "IscsiPath_Delete" 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(); @@ -75,8 +76,8 @@ public async Task Delete_IscsiPathsDelete() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_IscsiPathsCreateOrUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_CreateOrUpdate.json - // this example is just showing the usage of "IscsiPaths_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/IscsiPaths_CreateOrUpdate.json + // this example is just showing the usage of "IscsiPath_CreateOrUpdate" 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(); @@ -94,7 +95,7 @@ public async Task CreateOrUpdate_IscsiPathsCreateOrUpdate() // invoke the operation IscsiPathData data = new IscsiPathData { - NetworkBlock = "192.168.0.0/24", + Properties = new IscsiPathProperties("192.168.0.0/24"), }; ArmOperation lro = await iscsiPath.CreateOrUpdateAsync(WaitUntil.Completed, data); IscsiPathResource result = lro.Value; diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyCollection.cs index e21e07392afc..ee77d9c27bfd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyCollection.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.Avs.Models; using NUnit.Framework; namespace Azure.ResourceManager.Avs.Samples @@ -20,36 +19,29 @@ public partial class Sample_PlacementPolicyCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_PlacementPoliciesCreateOrUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_CreateOrUpdate.json - // this example is just showing the usage of "PlacementPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/PlacementPolicies_CreateOrUpdate.json + // this example is just showing the usage of "PlacementPolicy_CreateOrUpdate" 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 AvsPrivateCloudClusterResource created on azure - // for more information of creating AvsPrivateCloudClusterResource, please refer to the document of AvsPrivateCloudClusterResource + // this example assumes you already have this ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; string clusterName = "cluster1"; - ResourceIdentifier avsPrivateCloudClusterResourceId = AvsPrivateCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); - AvsPrivateCloudClusterResource avsPrivateCloudCluster = client.GetAvsPrivateCloudClusterResource(avsPrivateCloudClusterResourceId); + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); // get the collection of this PlacementPolicyResource - PlacementPolicyCollection collection = avsPrivateCloudCluster.GetPlacementPolicies(); + PlacementPolicyCollection collection = cluster.GetPlacementPolicies(); // invoke the operation string placementPolicyName = "policy1"; - PlacementPolicyData data = new PlacementPolicyData - { - Properties = new VmHostPlacementPolicyProperties(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256") }, new string[] { "fakehost22.nyc1.kubernetes.center", "fakehost23.nyc1.kubernetes.center", "fakehost24.nyc1.kubernetes.center" }, AvsPlacementPolicyAffinityType.AntiAffinity) - { - AffinityStrength = VmHostPlacementPolicyAffinityStrength.Must, - AzureHybridBenefitType = AzureHybridBenefitType.SqlHost, - }, - }; + PlacementPolicyData data = new PlacementPolicyData(); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, placementPolicyName, data); PlacementPolicyResource result = lro.Value; @@ -64,25 +56,25 @@ public async Task CreateOrUpdate_PlacementPoliciesCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_PlacementPoliciesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Get.json - // this example is just showing the usage of "PlacementPolicies_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/PlacementPolicies_Get.json + // this example is just showing the usage of "PlacementPolicy_Get" 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 AvsPrivateCloudClusterResource created on azure - // for more information of creating AvsPrivateCloudClusterResource, please refer to the document of AvsPrivateCloudClusterResource + // this example assumes you already have this ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; string clusterName = "cluster1"; - ResourceIdentifier avsPrivateCloudClusterResourceId = AvsPrivateCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); - AvsPrivateCloudClusterResource avsPrivateCloudCluster = client.GetAvsPrivateCloudClusterResource(avsPrivateCloudClusterResourceId); + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); // get the collection of this PlacementPolicyResource - PlacementPolicyCollection collection = avsPrivateCloudCluster.GetPlacementPolicies(); + PlacementPolicyCollection collection = cluster.GetPlacementPolicies(); // invoke the operation string placementPolicyName = "policy1"; @@ -99,25 +91,25 @@ public async Task Get_PlacementPoliciesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_PlacementPoliciesList() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_List.json - // this example is just showing the usage of "PlacementPolicies_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/PlacementPolicies_List.json + // this example is just showing the usage of "PlacementPolicy_List" 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 AvsPrivateCloudClusterResource created on azure - // for more information of creating AvsPrivateCloudClusterResource, please refer to the document of AvsPrivateCloudClusterResource + // this example assumes you already have this ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; string clusterName = "cluster1"; - ResourceIdentifier avsPrivateCloudClusterResourceId = AvsPrivateCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); - AvsPrivateCloudClusterResource avsPrivateCloudCluster = client.GetAvsPrivateCloudClusterResource(avsPrivateCloudClusterResourceId); + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); // get the collection of this PlacementPolicyResource - PlacementPolicyCollection collection = avsPrivateCloudCluster.GetPlacementPolicies(); + PlacementPolicyCollection collection = cluster.GetPlacementPolicies(); // invoke the operation and iterate over the result await foreach (PlacementPolicyResource item in collection.GetAllAsync()) @@ -136,25 +128,25 @@ public async Task GetAll_PlacementPoliciesList() [Ignore("Only validating compilation of examples")] public async Task Exists_PlacementPoliciesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Get.json - // this example is just showing the usage of "PlacementPolicies_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/PlacementPolicies_Get.json + // this example is just showing the usage of "PlacementPolicy_Get" 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 AvsPrivateCloudClusterResource created on azure - // for more information of creating AvsPrivateCloudClusterResource, please refer to the document of AvsPrivateCloudClusterResource + // this example assumes you already have this ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; string clusterName = "cluster1"; - ResourceIdentifier avsPrivateCloudClusterResourceId = AvsPrivateCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); - AvsPrivateCloudClusterResource avsPrivateCloudCluster = client.GetAvsPrivateCloudClusterResource(avsPrivateCloudClusterResourceId); + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); // get the collection of this PlacementPolicyResource - PlacementPolicyCollection collection = avsPrivateCloudCluster.GetPlacementPolicies(); + PlacementPolicyCollection collection = cluster.GetPlacementPolicies(); // invoke the operation string placementPolicyName = "policy1"; @@ -167,25 +159,25 @@ public async Task Exists_PlacementPoliciesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_PlacementPoliciesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Get.json - // this example is just showing the usage of "PlacementPolicies_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/PlacementPolicies_Get.json + // this example is just showing the usage of "PlacementPolicy_Get" 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 AvsPrivateCloudClusterResource created on azure - // for more information of creating AvsPrivateCloudClusterResource, please refer to the document of AvsPrivateCloudClusterResource + // this example assumes you already have this ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; string clusterName = "cluster1"; - ResourceIdentifier avsPrivateCloudClusterResourceId = AvsPrivateCloudClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); - AvsPrivateCloudClusterResource avsPrivateCloudCluster = client.GetAvsPrivateCloudClusterResource(avsPrivateCloudClusterResourceId); + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); // get the collection of this PlacementPolicyResource - PlacementPolicyCollection collection = avsPrivateCloudCluster.GetPlacementPolicies(); + PlacementPolicyCollection collection = cluster.GetPlacementPolicies(); // invoke the operation string placementPolicyName = "policy1"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyResource.cs index 883c68646d91..605e2223076a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PlacementPolicyResource.cs @@ -20,8 +20,8 @@ public partial class Sample_PlacementPolicyResource [Ignore("Only validating compilation of examples")] public async Task Get_PlacementPoliciesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Get.json - // this example is just showing the usage of "PlacementPolicies_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/PlacementPolicies_Get.json + // this example is just showing the usage of "PlacementPolicy_Get" 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(); @@ -52,8 +52,8 @@ public async Task Get_PlacementPoliciesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_PlacementPoliciesDelete() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Delete.json - // this example is just showing the usage of "PlacementPolicies_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/PlacementPolicies_Delete.json + // this example is just showing the usage of "PlacementPolicy_Delete" 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(); @@ -80,8 +80,8 @@ public async Task Delete_PlacementPoliciesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_PlacementPoliciesUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Update.json - // this example is just showing the usage of "PlacementPolicies_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/PlacementPolicies_Update.json + // this example is just showing the usage of "PlacementPolicy_Update" 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(); @@ -99,22 +99,10 @@ public async Task Update_PlacementPoliciesUpdate() PlacementPolicyResource placementPolicy = client.GetPlacementPolicyResource(placementPolicyResourceId); // invoke the operation - PlacementPolicyPatch patch = new PlacementPolicyPatch - { - State = PlacementPolicyState.Disabled, - VmMembers = { new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256") }, - HostMembers = { "fakehost22.nyc1.kubernetes.center", "fakehost23.nyc1.kubernetes.center", "fakehost24.nyc1.kubernetes.center" }, - AffinityStrength = VmHostPlacementPolicyAffinityStrength.Must, - AzureHybridBenefitType = AzureHybridBenefitType.SqlHost, - }; - ArmOperation lro = await placementPolicy.UpdateAsync(WaitUntil.Completed, patch); - PlacementPolicyResource result = lro.Value; + PlacementPolicyPatch patch = new PlacementPolicyPatch(); + await placementPolicy.UpdateAsync(WaitUntil.Completed, patch); - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - PlacementPolicyData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine("Succeeded"); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PrivateCloudCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PrivateCloudCollection.cs new file mode 100644 index 000000000000..ed0ae48dea54 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PrivateCloudCollection.cs @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_PrivateCloudCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_PrivateCloudsCreateOrUpdate() + { + // Generated from example definition: 2024-09-01/PrivateClouds_CreateOrUpdate.json + // this example is just showing the usage of "PrivateCloud_CreateOrUpdate" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + PrivateCloudData data = new PrivateCloudData(default, null); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateCloudName, data); + PrivateCloudResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_PrivateCloudsCreateOrUpdateFleetNative() + { + // Generated from example definition: 2024-09-01/PrivateClouds_CreateOrUpdate_FleetNative.json + // this example is just showing the usage of "PrivateCloud_CreateOrUpdate" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + PrivateCloudData data = new PrivateCloudData(default, null); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateCloudName, data); + PrivateCloudResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_PrivateCloudsCreateOrUpdateStretched() + { + // Generated from example definition: 2024-09-01/PrivateClouds_CreateOrUpdate_Stretched.json + // this example is just showing the usage of "PrivateCloud_CreateOrUpdate" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + PrivateCloudData data = new PrivateCloudData(default, null); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateCloudName, data); + PrivateCloudResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_PrivateCloudsCreateOrUpdateStretchedZones() + { + // Generated from example definition: 2024-09-01/PrivateClouds_CreateOrUpdate_StretchedZones.json + // this example is just showing the usage of "PrivateCloud_CreateOrUpdate" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + PrivateCloudData data = new PrivateCloudData(default, null); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateCloudName, data); + PrivateCloudResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_PrivateCloudsGet() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Get.json + // this example is just showing the usage of "PrivateCloud_Get" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + PrivateCloudResource result = await collection.GetAsync(privateCloudName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_PrivateCloudsGetStretched() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Get_Stretched.json + // this example is just showing the usage of "PrivateCloud_Get" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + PrivateCloudResource result = await collection.GetAsync(privateCloudName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_PrivateCloudsList() + { + // Generated from example definition: 2024-09-01/PrivateClouds_List.json + // this example is just showing the usage of "PrivateCloud_List" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation and iterate over the result + await foreach (PrivateCloudResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_PrivateCloudsListStretched() + { + // Generated from example definition: 2024-09-01/PrivateClouds_List_Stretched.json + // this example is just showing the usage of "PrivateCloud_List" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation and iterate over the result + await foreach (PrivateCloudResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_PrivateCloudsGet() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Get.json + // this example is just showing the usage of "PrivateCloud_Get" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + bool result = await collection.ExistsAsync(privateCloudName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_PrivateCloudsGetStretched() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Get_Stretched.json + // this example is just showing the usage of "PrivateCloud_Get" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + bool result = await collection.ExistsAsync(privateCloudName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_PrivateCloudsGet() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Get.json + // this example is just showing the usage of "PrivateCloud_Get" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + NullableResponse response = await collection.GetIfExistsAsync(privateCloudName); + PrivateCloudResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_PrivateCloudsGetStretched() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Get_Stretched.json + // this example is just showing the usage of "PrivateCloud_Get" 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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PrivateCloudResource + PrivateCloudCollection collection = resourceGroupResource.GetPrivateClouds(); + + // invoke the operation + string privateCloudName = "cloud1"; + NullableResponse response = await collection.GetIfExistsAsync(privateCloudName); + PrivateCloudResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PrivateCloudResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PrivateCloudResource.cs new file mode 100644 index 000000000000..afbf0d58d9f7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PrivateCloudResource.cs @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Avs.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_PrivateCloudResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_PrivateCloudsGet() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Get.json + // this example is just showing the usage of "PrivateCloud_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // invoke the operation + PrivateCloudResource result = await privateCloud.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_PrivateCloudsGetStretched() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Get_Stretched.json + // this example is just showing the usage of "PrivateCloud_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // invoke the operation + PrivateCloudResource result = await privateCloud.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_PrivateCloudsDelete() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Delete.json + // this example is just showing the usage of "PrivateCloud_Delete" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // invoke the operation + await privateCloud.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_PrivateCloudsUpdate() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Update.json + // this example is just showing the usage of "PrivateCloud_Update" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // invoke the operation + PrivateCloudPatch patch = new PrivateCloudPatch(); + ArmOperation lro = await privateCloud.UpdateAsync(WaitUntil.Completed, patch); + PrivateCloudResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_PrivateCloudsUpdateStretched() + { + // Generated from example definition: 2024-09-01/PrivateClouds_Update_Stretched.json + // this example is just showing the usage of "PrivateCloud_Update" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // invoke the operation + PrivateCloudPatch patch = new PrivateCloudPatch(); + ArmOperation lro = await privateCloud.UpdateAsync(WaitUntil.Completed, patch); + PrivateCloudResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PrivateCloudData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task RotateVcenterPassword_PrivateCloudsRotateVcenterPassword() + { + // Generated from example definition: 2024-09-01/PrivateClouds_RotateVcenterPassword.json + // this example is just showing the usage of "PrivateClouds_RotateVcenterPassword" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // invoke the operation + await privateCloud.RotateVcenterPasswordAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task RotateNsxtPassword_PrivateCloudsRotateNsxtPassword() + { + // Generated from example definition: 2024-09-01/PrivateClouds_RotateNsxtPassword.json + // this example is just showing the usage of "PrivateClouds_RotateNsxtPassword" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // invoke the operation + await privateCloud.RotateNsxtPasswordAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAdminCredentials_PrivateCloudsListAdminCredentials() + { + // Generated from example definition: 2024-09-01/PrivateClouds_ListAdminCredentials.json + // this example is just showing the usage of "PrivateClouds_ListAdminCredentials" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // invoke the operation + AdminCredentials result = await privateCloud.GetAdminCredentialsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ProvisionedNetworkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ProvisionedNetworkCollection.cs new file mode 100644 index 000000000000..6f6aad8aceb0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ProvisionedNetworkCollection.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_ProvisionedNetworkCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_ProvisionedNetworksGet() + { + // Generated from example definition: 2024-09-01/ProvisionedNetworks_Get.json + // this example is just showing the usage of "ProvisionedNetwork_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this ProvisionedNetworkResource + ProvisionedNetworkCollection collection = privateCloud.GetProvisionedNetworks(); + + // invoke the operation + string provisionedNetworkName = "vsan"; + ProvisionedNetworkResource result = await collection.GetAsync(provisionedNetworkName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ProvisionedNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ProvisionedNetworksList() + { + // Generated from example definition: 2024-09-01/ProvisionedNetworks_List.json + // this example is just showing the usage of "ProvisionedNetwork_List" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this ProvisionedNetworkResource + ProvisionedNetworkCollection collection = privateCloud.GetProvisionedNetworks(); + + // invoke the operation and iterate over the result + await foreach (ProvisionedNetworkResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ProvisionedNetworkData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_ProvisionedNetworksGet() + { + // Generated from example definition: 2024-09-01/ProvisionedNetworks_Get.json + // this example is just showing the usage of "ProvisionedNetwork_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this ProvisionedNetworkResource + ProvisionedNetworkCollection collection = privateCloud.GetProvisionedNetworks(); + + // invoke the operation + string provisionedNetworkName = "vsan"; + bool result = await collection.ExistsAsync(provisionedNetworkName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_ProvisionedNetworksGet() + { + // Generated from example definition: 2024-09-01/ProvisionedNetworks_Get.json + // this example is just showing the usage of "ProvisionedNetwork_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this ProvisionedNetworkResource + ProvisionedNetworkCollection collection = privateCloud.GetProvisionedNetworks(); + + // invoke the operation + string provisionedNetworkName = "vsan"; + NullableResponse response = await collection.GetIfExistsAsync(provisionedNetworkName); + ProvisionedNetworkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ProvisionedNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ProvisionedNetworkResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ProvisionedNetworkResource.cs new file mode 100644 index 000000000000..d5d3865d78bc --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ProvisionedNetworkResource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_ProvisionedNetworkResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_ProvisionedNetworksGet() + { + // Generated from example definition: 2024-09-01/ProvisionedNetworks_Get.json + // this example is just showing the usage of "ProvisionedNetwork_Get" 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 ProvisionedNetworkResource created on azure + // for more information of creating ProvisionedNetworkResource, please refer to the document of ProvisionedNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string provisionedNetworkName = "vsan"; + ResourceIdentifier provisionedNetworkResourceId = ProvisionedNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, provisionedNetworkName); + ProvisionedNetworkResource provisionedNetwork = client.GetProvisionedNetworkResource(provisionedNetworkResourceId); + + // invoke the operation + ProvisionedNetworkResource result = await provisionedNetwork.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ProvisionedNetworkData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PureStoragePolicyCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PureStoragePolicyCollection.cs new file mode 100644 index 000000000000..ec660eec3fe6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PureStoragePolicyCollection.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Avs.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_PureStoragePolicyCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_PureStoragePoliciesCreateOrUpdate() + { + // Generated from example definition: 2024-09-01/PureStoragePolicies_CreateOrUpdate.json + // this example is just showing the usage of "PureStoragePolicy_CreateOrUpdate" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this PureStoragePolicyResource + PureStoragePolicyCollection collection = privateCloud.GetPureStoragePolicies(); + + // invoke the operation + string storagePolicyName = "storagePolicy1"; + PureStoragePolicyData data = new PureStoragePolicyData + { + Properties = new PureStoragePolicyProperties("storagePolicyDefinition1", "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/PureStorage.Block/storagePools/storagePool1"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, storagePolicyName, data); + PureStoragePolicyResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PureStoragePolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_PureStoragePoliciesGet() + { + // Generated from example definition: 2024-09-01/PureStoragePolicies_Get.json + // this example is just showing the usage of "PureStoragePolicy_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this PureStoragePolicyResource + PureStoragePolicyCollection collection = privateCloud.GetPureStoragePolicies(); + + // invoke the operation + string storagePolicyName = "storagePolicy1"; + PureStoragePolicyResource result = await collection.GetAsync(storagePolicyName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PureStoragePolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_PureStoragePoliciesList() + { + // Generated from example definition: 2024-09-01/PureStoragePolicies_List.json + // this example is just showing the usage of "PureStoragePolicy_List" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this PureStoragePolicyResource + PureStoragePolicyCollection collection = privateCloud.GetPureStoragePolicies(); + + // invoke the operation and iterate over the result + await foreach (PureStoragePolicyResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PureStoragePolicyData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_PureStoragePoliciesGet() + { + // Generated from example definition: 2024-09-01/PureStoragePolicies_Get.json + // this example is just showing the usage of "PureStoragePolicy_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this PureStoragePolicyResource + PureStoragePolicyCollection collection = privateCloud.GetPureStoragePolicies(); + + // invoke the operation + string storagePolicyName = "storagePolicy1"; + bool result = await collection.ExistsAsync(storagePolicyName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_PureStoragePoliciesGet() + { + // Generated from example definition: 2024-09-01/PureStoragePolicies_Get.json + // this example is just showing the usage of "PureStoragePolicy_Get" 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 PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); + + // get the collection of this PureStoragePolicyResource + PureStoragePolicyCollection collection = privateCloud.GetPureStoragePolicies(); + + // invoke the operation + string storagePolicyName = "storagePolicy1"; + NullableResponse response = await collection.GetIfExistsAsync(storagePolicyName); + PureStoragePolicyResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PureStoragePolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PureStoragePolicyResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PureStoragePolicyResource.cs new file mode 100644 index 000000000000..c0b607175c17 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_PureStoragePolicyResource.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Avs.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_PureStoragePolicyResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_PureStoragePoliciesGet() + { + // Generated from example definition: 2024-09-01/PureStoragePolicies_Get.json + // this example is just showing the usage of "PureStoragePolicy_Get" 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 PureStoragePolicyResource created on azure + // for more information of creating PureStoragePolicyResource, please refer to the document of PureStoragePolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string storagePolicyName = "storagePolicy1"; + ResourceIdentifier pureStoragePolicyResourceId = PureStoragePolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, storagePolicyName); + PureStoragePolicyResource pureStoragePolicy = client.GetPureStoragePolicyResource(pureStoragePolicyResourceId); + + // invoke the operation + PureStoragePolicyResource result = await pureStoragePolicy.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PureStoragePolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_PureStoragePoliciesDelete() + { + // Generated from example definition: 2024-09-01/PureStoragePolicies_Delete.json + // this example is just showing the usage of "PureStoragePolicy_Delete" 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 PureStoragePolicyResource created on azure + // for more information of creating PureStoragePolicyResource, please refer to the document of PureStoragePolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string storagePolicyName = "storagePolicy1"; + ResourceIdentifier pureStoragePolicyResourceId = PureStoragePolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, storagePolicyName); + PureStoragePolicyResource pureStoragePolicy = client.GetPureStoragePolicyResource(pureStoragePolicyResourceId); + + // invoke the operation + await pureStoragePolicy.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_PureStoragePoliciesCreateOrUpdate() + { + // Generated from example definition: 2024-09-01/PureStoragePolicies_CreateOrUpdate.json + // this example is just showing the usage of "PureStoragePolicy_CreateOrUpdate" 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 PureStoragePolicyResource created on azure + // for more information of creating PureStoragePolicyResource, please refer to the document of PureStoragePolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string storagePolicyName = "storagePolicy1"; + ResourceIdentifier pureStoragePolicyResourceId = PureStoragePolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, storagePolicyName); + PureStoragePolicyResource pureStoragePolicy = client.GetPureStoragePolicyResource(pureStoragePolicyResourceId); + + // invoke the operation + PureStoragePolicyData data = new PureStoragePolicyData + { + Properties = new PureStoragePolicyProperties("storagePolicyDefinition1", "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/PureStorage.Block/storagePools/storagePool1"), + }; + ArmOperation lro = await pureStoragePolicy.UpdateAsync(WaitUntil.Completed, data); + PureStoragePolicyResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PureStoragePolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletCollection.cs index 45bb7eb51b65..2771ff6f62de 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletCollection.cs @@ -19,8 +19,8 @@ public partial class Sample_ScriptCmdletCollection [Ignore("Only validating compilation of examples")] public async Task Get_ScriptCmdletsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptCmdlets_Get.json - // this example is just showing the usage of "ScriptCmdlets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptCmdlets_Get.json + // this example is just showing the usage of "ScriptCmdlet_Get" 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(); @@ -54,8 +54,8 @@ public async Task Get_ScriptCmdletsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ScriptCmdletsList() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptCmdlets_List.json - // this example is just showing the usage of "ScriptCmdlets_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptCmdlets_List.json + // this example is just showing the usage of "ScriptCmdlet_List" 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(); @@ -91,8 +91,8 @@ public async Task GetAll_ScriptCmdletsList() [Ignore("Only validating compilation of examples")] public async Task Exists_ScriptCmdletsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptCmdlets_Get.json - // this example is just showing the usage of "ScriptCmdlets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptCmdlets_Get.json + // this example is just showing the usage of "ScriptCmdlet_Get" 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(); @@ -122,8 +122,8 @@ public async Task Exists_ScriptCmdletsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ScriptCmdletsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptCmdlets_Get.json - // this example is just showing the usage of "ScriptCmdlets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptCmdlets_Get.json + // this example is just showing the usage of "ScriptCmdlet_Get" 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(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletResource.cs index a302f703cd23..a80ac40e6bd4 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptCmdletResource.cs @@ -19,8 +19,8 @@ public partial class Sample_ScriptCmdletResource [Ignore("Only validating compilation of examples")] public async Task Get_ScriptCmdletsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptCmdlets_Get.json - // this example is just showing the usage of "ScriptCmdlets_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptCmdlets_Get.json + // this example is just showing the usage of "ScriptCmdlet_Get" 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(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionCollection.cs index 7a6e4fb2f0af..52ca06abde63 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionCollection.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.Avs.Models; using NUnit.Framework; namespace Azure.ResourceManager.Avs.Samples @@ -20,44 +19,28 @@ public partial class Sample_ScriptExecutionCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ScriptExecutionsCreateOrUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_CreateOrUpdate.json - // this example is just showing the usage of "ScriptExecutions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptExecutions_CreateOrUpdate.json + // this example is just showing the usage of "ScriptExecution_CreateOrUpdate" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ScriptExecutionResource - ScriptExecutionCollection collection = avsPrivateCloud.GetScriptExecutions(); + ScriptExecutionCollection collection = privateCloud.GetScriptExecutions(); // invoke the operation string scriptExecutionName = "addSsoServer"; - ScriptExecutionData data = new ScriptExecutionData - { - ScriptCmdletId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/AVS.PowerCommands@1.0.0/scriptCmdlets/New-SsoExternalIdentitySource"), - Parameters = {new ScriptStringExecutionParameterDetails("DomainName") -{ -Value = "placeholderDomain.local", -}, new ScriptStringExecutionParameterDetails("BaseUserDN") -{ -Value = "DC=placeholder, DC=placeholder", -}}, - HiddenParameters = {new ScriptSecureStringExecutionParameterDetails("Password") -{ -SecureValue = "PlaceholderPassword", -}}, - Timeout = "P0Y0M0DT0H60M60S", - Retention = "P0Y0M60DT0H60M60S", - }; + ScriptExecutionData data = new ScriptExecutionData(); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, scriptExecutionName, data); ScriptExecutionResource result = lro.Value; @@ -72,24 +55,24 @@ public async Task CreateOrUpdate_ScriptExecutionsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_ScriptExecutionsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_Get.json - // this example is just showing the usage of "ScriptExecutions_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptExecutions_Get.json + // this example is just showing the usage of "ScriptExecution_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ScriptExecutionResource - ScriptExecutionCollection collection = avsPrivateCloud.GetScriptExecutions(); + ScriptExecutionCollection collection = privateCloud.GetScriptExecutions(); // invoke the operation string scriptExecutionName = "addSsoServer"; @@ -106,24 +89,24 @@ public async Task Get_ScriptExecutionsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ScriptExecutionsList() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_List.json - // this example is just showing the usage of "ScriptExecutions_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptExecutions_List.json + // this example is just showing the usage of "ScriptExecution_List" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ScriptExecutionResource - ScriptExecutionCollection collection = avsPrivateCloud.GetScriptExecutions(); + ScriptExecutionCollection collection = privateCloud.GetScriptExecutions(); // invoke the operation and iterate over the result await foreach (ScriptExecutionResource item in collection.GetAllAsync()) @@ -142,24 +125,24 @@ public async Task GetAll_ScriptExecutionsList() [Ignore("Only validating compilation of examples")] public async Task Exists_ScriptExecutionsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_Get.json - // this example is just showing the usage of "ScriptExecutions_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptExecutions_Get.json + // this example is just showing the usage of "ScriptExecution_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ScriptExecutionResource - ScriptExecutionCollection collection = avsPrivateCloud.GetScriptExecutions(); + ScriptExecutionCollection collection = privateCloud.GetScriptExecutions(); // invoke the operation string scriptExecutionName = "addSsoServer"; @@ -172,24 +155,24 @@ public async Task Exists_ScriptExecutionsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ScriptExecutionsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_Get.json - // this example is just showing the usage of "ScriptExecutions_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptExecutions_Get.json + // this example is just showing the usage of "ScriptExecution_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ScriptExecutionResource - ScriptExecutionCollection collection = avsPrivateCloud.GetScriptExecutions(); + ScriptExecutionCollection collection = privateCloud.GetScriptExecutions(); // invoke the operation string scriptExecutionName = "addSsoServer"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionResource.cs index 4abe44e96dc9..e9d41d76bcfe 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptExecutionResource.cs @@ -21,8 +21,8 @@ public partial class Sample_ScriptExecutionResource [Ignore("Only validating compilation of examples")] public async Task Get_ScriptExecutionsGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_Get.json - // this example is just showing the usage of "ScriptExecutions_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptExecutions_Get.json + // this example is just showing the usage of "ScriptExecution_Get" 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(); @@ -52,8 +52,8 @@ public async Task Get_ScriptExecutionsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_ScriptExecutionsDelete() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_Delete.json - // this example is just showing the usage of "ScriptExecutions_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptExecutions_Delete.json + // this example is just showing the usage of "ScriptExecution_Delete" 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(); @@ -79,8 +79,8 @@ public async Task Delete_ScriptExecutionsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_ScriptExecutionsCreateOrUpdate() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_CreateOrUpdate.json - // this example is just showing the usage of "ScriptExecutions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptExecutions_CreateOrUpdate.json + // this example is just showing the usage of "ScriptExecution_CreateOrUpdate" 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(); @@ -97,23 +97,7 @@ public async Task Update_ScriptExecutionsCreateOrUpdate() ScriptExecutionResource scriptExecution = client.GetScriptExecutionResource(scriptExecutionResourceId); // invoke the operation - ScriptExecutionData data = new ScriptExecutionData - { - ScriptCmdletId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/AVS.PowerCommands@1.0.0/scriptCmdlets/New-SsoExternalIdentitySource"), - Parameters = {new ScriptStringExecutionParameterDetails("DomainName") -{ -Value = "placeholderDomain.local", -}, new ScriptStringExecutionParameterDetails("BaseUserDN") -{ -Value = "DC=placeholder, DC=placeholder", -}}, - HiddenParameters = {new ScriptSecureStringExecutionParameterDetails("Password") -{ -SecureValue = "PlaceholderPassword", -}}, - Timeout = "P0Y0M0DT0H60M60S", - Retention = "P0Y0M60DT0H60M60S", - }; + ScriptExecutionData data = new ScriptExecutionData(); ArmOperation lro = await scriptExecution.UpdateAsync(WaitUntil.Completed, data); ScriptExecutionResource result = lro.Value; @@ -128,7 +112,7 @@ public async Task Update_ScriptExecutionsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task GetExecutionLogs_ScriptExecutionsGetExecutionLogs() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_GetExecutionLogs.json + // Generated from example definition: 2024-09-01/ScriptExecutions_GetExecutionLogs.json // this example is just showing the usage of "ScriptExecutions_GetExecutionLogs" 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 diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageCollection.cs index e44083cd3144..4bda8598315a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageCollection.cs @@ -19,24 +19,24 @@ public partial class Sample_ScriptPackageCollection [Ignore("Only validating compilation of examples")] public async Task Get_ScriptPackagesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptPackages_Get.json - // this example is just showing the usage of "ScriptPackages_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptPackages_Get.json + // this example is just showing the usage of "ScriptPackage_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ScriptPackageResource - ScriptPackageCollection collection = avsPrivateCloud.GetScriptPackages(); + ScriptPackageCollection collection = privateCloud.GetScriptPackages(); // invoke the operation string scriptPackageName = "Microsoft.AVS.Management@3.0.48"; @@ -53,24 +53,24 @@ public async Task Get_ScriptPackagesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ScriptPackagesList() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptPackages_List.json - // this example is just showing the usage of "ScriptPackages_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptPackages_List.json + // this example is just showing the usage of "ScriptPackage_List" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ScriptPackageResource - ScriptPackageCollection collection = avsPrivateCloud.GetScriptPackages(); + ScriptPackageCollection collection = privateCloud.GetScriptPackages(); // invoke the operation and iterate over the result await foreach (ScriptPackageResource item in collection.GetAllAsync()) @@ -89,24 +89,24 @@ public async Task GetAll_ScriptPackagesList() [Ignore("Only validating compilation of examples")] public async Task Exists_ScriptPackagesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptPackages_Get.json - // this example is just showing the usage of "ScriptPackages_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptPackages_Get.json + // this example is just showing the usage of "ScriptPackage_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ScriptPackageResource - ScriptPackageCollection collection = avsPrivateCloud.GetScriptPackages(); + ScriptPackageCollection collection = privateCloud.GetScriptPackages(); // invoke the operation string scriptPackageName = "Microsoft.AVS.Management@3.0.48"; @@ -119,24 +119,24 @@ public async Task Exists_ScriptPackagesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ScriptPackagesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptPackages_Get.json - // this example is just showing the usage of "ScriptPackages_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptPackages_Get.json + // this example is just showing the usage of "ScriptPackage_Get" 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 AvsPrivateCloudResource created on azure - // for more information of creating AvsPrivateCloudResource, please refer to the document of AvsPrivateCloudResource + // this example assumes you already have this PrivateCloudResource created on azure + // for more information of creating PrivateCloudResource, please refer to the document of PrivateCloudResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "group1"; string privateCloudName = "cloud1"; - ResourceIdentifier avsPrivateCloudResourceId = AvsPrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); - AvsPrivateCloudResource avsPrivateCloud = client.GetAvsPrivateCloudResource(avsPrivateCloudResourceId); + ResourceIdentifier privateCloudResourceId = PrivateCloudResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + PrivateCloudResource privateCloud = client.GetPrivateCloudResource(privateCloudResourceId); // get the collection of this ScriptPackageResource - ScriptPackageCollection collection = avsPrivateCloud.GetScriptPackages(); + ScriptPackageCollection collection = privateCloud.GetScriptPackages(); // invoke the operation string scriptPackageName = "Microsoft.AVS.Management@3.0.48"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageResource.cs index 206a9964c3fc..7722e8bd3c50 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_ScriptPackageResource.cs @@ -19,8 +19,8 @@ public partial class Sample_ScriptPackageResource [Ignore("Only validating compilation of examples")] public async Task Get_ScriptPackagesGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptPackages_Get.json - // this example is just showing the usage of "ScriptPackages_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/ScriptPackages_Get.json + // this example is just showing the usage of "ScriptPackage_Get" 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(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index a09f3b17dbbd..98297ebb2072 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -19,10 +19,10 @@ public partial class Sample_SubscriptionResourceExtensions { [Test] [Ignore("Only validating compilation of examples")] - public async Task CheckAvsQuotaAvailability_LocationsCheckQuotaAvailability() + public async Task CheckTrialAvailabilityLocation_LocationsCheckTrialAvailability() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Locations_CheckQuotaAvailability.json - // this example is just showing the usage of "Locations_CheckQuotaAvailability" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/Locations_CheckTrialAvailability.json + // this example is just showing the usage of "Locations_CheckTrialAvailability" 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(); @@ -36,17 +36,17 @@ public async Task CheckAvsQuotaAvailability_LocationsCheckQuotaAvailability() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - AzureLocation location = new AzureLocation("eastus"); - AvsSubscriptionQuotaAvailabilityResult result = await subscriptionResource.CheckAvsQuotaAvailabilityAsync(location); + string location = "eastus"; + Trial result = await subscriptionResource.CheckTrialAvailabilityLocationAsync(location); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task CheckAvsTrialAvailability_LocationsCheckTrialAvailability() + public async Task CheckTrialAvailabilityLocation_LocationsCheckTrialAvailabilityWithSku() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Locations_CheckTrialAvailability.json + // Generated from example definition: 2024-09-01/Locations_CheckTrialAvailabilityWithSku.json // this example is just showing the usage of "Locations_CheckTrialAvailability" 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 @@ -61,18 +61,19 @@ public async Task CheckAvsTrialAvailability_LocationsCheckTrialAvailability() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - AzureLocation location = new AzureLocation("eastus"); - AvsSubscriptionTrialAvailabilityResult result = await subscriptionResource.CheckAvsTrialAvailabilityAsync(location); + string location = "eastus"; + AvsSku sku = new AvsSku("avs52t"); + Trial result = await subscriptionResource.CheckTrialAvailabilityLocationAsync(location, sku: sku); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task CheckAvsTrialAvailability_LocationsCheckTrialAvailabilityWithSku() + public async Task CheckQuotaAvailabilityLocation_LocationsCheckQuotaAvailability() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Locations_CheckTrialAvailabilityWithSku.json - // this example is just showing the usage of "Locations_CheckTrialAvailability" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/Locations_CheckQuotaAvailability.json + // this example is just showing the usage of "Locations_CheckQuotaAvailability" 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(); @@ -86,19 +87,18 @@ public async Task CheckAvsTrialAvailability_LocationsCheckTrialAvailabilityWithS SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - AzureLocation location = new AzureLocation("eastus"); - AvsSku sku = new AvsSku("avs52t"); - AvsSubscriptionTrialAvailabilityResult result = await subscriptionResource.CheckAvsTrialAvailabilityAsync(location, sku: sku); + string location = "eastus"; + Quota result = await subscriptionResource.CheckQuotaAvailabilityLocationAsync(location); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAvsPrivateClouds_PrivateCloudsListInSubscription() + public async Task GetPrivateClouds_PrivateCloudsListInSubscription() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_ListInSubscription.json - // this example is just showing the usage of "PrivateClouds_ListInSubscription" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/PrivateClouds_ListInSubscription.json + // this example is just showing the usage of "PrivateCloud_ListInSubscription" 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(); @@ -112,11 +112,11 @@ public async Task GetAvsPrivateClouds_PrivateCloudsListInSubscription() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (AvsPrivateCloudResource item in subscriptionResource.GetAvsPrivateCloudsAsync()) + await foreach (PrivateCloudResource item in subscriptionResource.GetPrivateCloudsAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance - AvsPrivateCloudData resourceData = item.Data; + PrivateCloudData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -126,10 +126,10 @@ public async Task GetAvsPrivateClouds_PrivateCloudsListInSubscription() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAvsPrivateClouds_PrivateCloudsListInSubscriptionStretched() + public async Task GetPrivateClouds_PrivateCloudsListInSubscriptionStretched() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_ListInSubscription_Stretched.json - // this example is just showing the usage of "PrivateClouds_ListInSubscription" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/PrivateClouds_ListInSubscription_Stretched.json + // this example is just showing the usage of "PrivateCloud_ListInSubscription" 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(); @@ -143,16 +143,43 @@ public async Task GetAvsPrivateClouds_PrivateCloudsListInSubscriptionStretched() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (AvsPrivateCloudResource item in subscriptionResource.GetAvsPrivateCloudsAsync()) + await foreach (PrivateCloudResource item in subscriptionResource.GetPrivateCloudsAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance - AvsPrivateCloudData resourceData = item.Data; + PrivateCloudData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine("Succeeded"); } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetSkus_SkusList() + { + // Generated from example definition: 2024-09-01/Skus_List.json + // this example is just showing the usage of "Skus_List" 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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (ResourceSku item in subscriptionResource.GetSkusAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_VirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_VirtualMachineCollection.cs new file mode 100644 index 000000000000..79485a026be9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_VirtualMachineCollection.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_VirtualMachineCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_VirtualMachinesGet() + { + // Generated from example definition: 2024-09-01/VirtualMachines_Get.json + // this example is just showing the usage of "VirtualMachine_Get" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this VirtualMachineResource + VirtualMachineCollection collection = cluster.GetVirtualMachines(); + + // invoke the operation + string virtualMachineId = "vm-209"; + VirtualMachineResource result = await collection.GetAsync(virtualMachineId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + VirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_VirtualMachinesList() + { + // Generated from example definition: 2024-09-01/VirtualMachines_List.json + // this example is just showing the usage of "VirtualMachine_List" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this VirtualMachineResource + VirtualMachineCollection collection = cluster.GetVirtualMachines(); + + // invoke the operation and iterate over the result + await foreach (VirtualMachineResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + VirtualMachineData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_VirtualMachinesGet() + { + // Generated from example definition: 2024-09-01/VirtualMachines_Get.json + // this example is just showing the usage of "VirtualMachine_Get" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this VirtualMachineResource + VirtualMachineCollection collection = cluster.GetVirtualMachines(); + + // invoke the operation + string virtualMachineId = "vm-209"; + bool result = await collection.ExistsAsync(virtualMachineId); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_VirtualMachinesGet() + { + // Generated from example definition: 2024-09-01/VirtualMachines_Get.json + // this example is just showing the usage of "VirtualMachine_Get" 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 ClusterResource created on azure + // for more information of creating ClusterResource, please refer to the document of ClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + ResourceIdentifier clusterResourceId = ClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName); + ClusterResource cluster = client.GetClusterResource(clusterResourceId); + + // get the collection of this VirtualMachineResource + VirtualMachineCollection collection = cluster.GetVirtualMachines(); + + // invoke the operation + string virtualMachineId = "vm-209"; + NullableResponse response = await collection.GetIfExistsAsync(virtualMachineId); + VirtualMachineResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + VirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_VirtualMachineResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_VirtualMachineResource.cs new file mode 100644 index 000000000000..4885a2444d62 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_VirtualMachineResource.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Avs.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Avs.Samples +{ + public partial class Sample_VirtualMachineResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_VirtualMachinesGet() + { + // Generated from example definition: 2024-09-01/VirtualMachines_Get.json + // this example is just showing the usage of "VirtualMachine_Get" 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 VirtualMachineResource created on azure + // for more information of creating VirtualMachineResource, please refer to the document of VirtualMachineResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + string virtualMachineId = "vm-209"; + ResourceIdentifier virtualMachineResourceId = VirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName, virtualMachineId); + VirtualMachineResource virtualMachine = client.GetVirtualMachineResource(virtualMachineResourceId); + + // invoke the operation + VirtualMachineResource result = await virtualMachine.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + VirtualMachineData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task RestrictMovement_VirtualMachinesRestrictMovement() + { + // Generated from example definition: 2024-09-01/VirtualMachines_RestrictMovement.json + // this example is just showing the usage of "VirtualMachines_RestrictMovement" 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 VirtualMachineResource created on azure + // for more information of creating VirtualMachineResource, please refer to the document of VirtualMachineResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + string clusterName = "cluster1"; + string virtualMachineId = "vm-209"; + ResourceIdentifier virtualMachineResourceId = VirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName, clusterName, virtualMachineId); + VirtualMachineResource virtualMachine = client.GetVirtualMachineResource(virtualMachineResourceId); + + // invoke the operation + VirtualMachineRestrictMovement restrictMovement = new VirtualMachineRestrictMovement(); + await virtualMachine.RestrictMovementAsync(WaitUntil.Completed, restrictMovement); + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayCollection.cs index e7437fb83191..72b192c93e8b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayCollection.cs @@ -19,8 +19,8 @@ public partial class Sample_WorkloadNetworkGatewayCollection [Ignore("Only validating compilation of examples")] public async Task Get_WorkloadNetworksGetGateway() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetGateway.json - // this example is just showing the usage of "WorkloadNetworks_GetGateway" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetGateway.json + // this example is just showing the usage of "WorkloadNetworkGateway_Get" 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(); @@ -53,8 +53,8 @@ public async Task Get_WorkloadNetworksGetGateway() [Ignore("Only validating compilation of examples")] public async Task GetAll_WorkloadNetworksListGateways() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListGateways.json - // this example is just showing the usage of "WorkloadNetworks_ListGateways" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_ListGateways.json + // this example is just showing the usage of "WorkloadNetworkGateway_List" 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(); @@ -89,8 +89,8 @@ public async Task GetAll_WorkloadNetworksListGateways() [Ignore("Only validating compilation of examples")] public async Task Exists_WorkloadNetworksGetGateway() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetGateway.json - // this example is just showing the usage of "WorkloadNetworks_GetGateway" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetGateway.json + // this example is just showing the usage of "WorkloadNetworkGateway_Get" 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(); @@ -119,8 +119,8 @@ public async Task Exists_WorkloadNetworksGetGateway() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_WorkloadNetworksGetGateway() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetGateway.json - // this example is just showing the usage of "WorkloadNetworks_GetGateway" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetGateway.json + // this example is just showing the usage of "WorkloadNetworkGateway_Get" 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(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayResource.cs index fc95dde97b80..f2282cf1c745 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkGatewayResource.cs @@ -19,8 +19,8 @@ public partial class Sample_WorkloadNetworkGatewayResource [Ignore("Only validating compilation of examples")] public async Task Get_WorkloadNetworksGetGateway() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetGateway.json - // this example is just showing the usage of "WorkloadNetworks_GetGateway" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetGateway.json + // this example is just showing the usage of "WorkloadNetworkGateway_Get" 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(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkResource.cs index 5f562c034797..5596cec6e575 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkResource.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Azure.ResourceManager.Avs.Models; using NUnit.Framework; namespace Azure.ResourceManager.Avs.Samples @@ -19,8 +20,8 @@ public partial class Sample_WorkloadNetworkResource [Ignore("Only validating compilation of examples")] public async Task Get_WorkloadNetworksGet() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_Get.json - // this example is just showing the usage of "WorkloadNetworks_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_Get.json + // this example is just showing the usage of "WorkloadNetwork_Get" 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(); @@ -44,5 +45,822 @@ public async Task Get_WorkloadNetworksGet() // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkDhcpConfigurations_WorkloadNetworksListDhcp() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_ListDhcp.json + // this example is just showing the usage of "WorkloadNetworkDhcp_List" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation and iterate over the result + await foreach (WorkloadNetworkDhcp item in workloadNetwork.GetWorkloadNetworkDhcpConfigurationsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkDhcpConfiguration_WorkloadNetworksGetDhcp() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetDhcp.json + // this example is just showing the usage of "WorkloadNetworkDhcpConfigurations_Get" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dhcpId = "dhcp1"; + WorkloadNetworkDhcp result = await workloadNetwork.GetWorkloadNetworkDhcpConfigurationAsync(dhcpId); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateWorkloadNetworkDhcpConfiguration_WorkloadNetworksCreateDhcp() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_CreateDhcp.json + // this example is just showing the usage of "WorkloadNetworkDhcp_Create" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dhcpId = "dhcp1"; + WorkloadNetworkDhcp workloadNetworkDhcp = new WorkloadNetworkDhcp(); + ArmOperation lro = await workloadNetwork.CreateWorkloadNetworkDhcpConfigurationAsync(WaitUntil.Completed, dhcpId, workloadNetworkDhcp); + WorkloadNetworkDhcp result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task UpdateWorkloadNetworkDhcpConfiguration_WorkloadNetworksUpdateDhcp() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_UpdateDhcp.json + // this example is just showing the usage of "WorkloadNetworkDhcp_Update" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dhcpId = "dhcp1"; + WorkloadNetworkDhcp workloadNetworkDhcp = new WorkloadNetworkDhcp(); + ArmOperation lro = await workloadNetwork.UpdateWorkloadNetworkDhcpConfigurationAsync(WaitUntil.Completed, dhcpId, workloadNetworkDhcp); + WorkloadNetworkDhcp result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task DeleteWorkloadNetworkDhcpConfiguration_WorkloadNetworksDeleteDhcp() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_DeleteDhcp.json + // this example is just showing the usage of "WorkloadNetworkDhcp_Delete" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dhcpId = "dhcp1"; + await workloadNetwork.DeleteWorkloadNetworkDhcpConfigurationAsync(WaitUntil.Completed, dhcpId); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkDnsServices_WorkloadNetworksListDnsServices() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_ListDnsServices.json + // this example is just showing the usage of "WorkloadNetworkDnsService_List" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation and iterate over the result + await foreach (WorkloadNetworkDnsService item in workloadNetwork.GetWorkloadNetworkDnsServicesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkDnsService_WorkloadNetworksGetDnsService() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetDnsService.json + // this example is just showing the usage of "WorkloadNetworkDnsService_Get" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dnsServiceId = "dnsService1"; + WorkloadNetworkDnsService result = await workloadNetwork.GetWorkloadNetworkDnsServiceAsync(dnsServiceId); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateWorkloadNetworkDnsService_WorkloadNetworksCreateDnsService() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_CreateDnsService.json + // this example is just showing the usage of "WorkloadNetworkDnsService_Create" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dnsServiceId = "dnsService1"; + WorkloadNetworkDnsService workloadNetworkDnsService = new WorkloadNetworkDnsService(); + ArmOperation lro = await workloadNetwork.CreateWorkloadNetworkDnsServiceAsync(WaitUntil.Completed, dnsServiceId, workloadNetworkDnsService); + WorkloadNetworkDnsService result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task UpdateWorkloadNetworkDnsService_WorkloadNetworksUpdateDnsService() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_UpdateDnsService.json + // this example is just showing the usage of "WorkloadNetworkDnsService_Update" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dnsServiceId = "dnsService1"; + WorkloadNetworkDnsService workloadNetworkDnsService = new WorkloadNetworkDnsService(); + ArmOperation lro = await workloadNetwork.UpdateWorkloadNetworkDnsServiceAsync(WaitUntil.Completed, dnsServiceId, workloadNetworkDnsService); + WorkloadNetworkDnsService result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task DeleteWorkloadNetworkDnsService_WorkloadNetworksDeleteDnsService() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_DeleteDnsService.json + // this example is just showing the usage of "WorkloadNetworkDnsService_Delete" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dnsServiceId = "dnsService1"; + await workloadNetwork.DeleteWorkloadNetworkDnsServiceAsync(WaitUntil.Completed, dnsServiceId); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkDnsZones_WorkloadNetworksListDnsZones() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_ListDnsZones.json + // this example is just showing the usage of "WorkloadNetworkDnsZone_List" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation and iterate over the result + await foreach (WorkloadNetworkDnsZone item in workloadNetwork.GetWorkloadNetworkDnsZonesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkDnsZone_WorkloadNetworksGetDnsZone() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetDnsZone.json + // this example is just showing the usage of "WorkloadNetworkDnsZone_Get" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dnsZoneId = "dnsZone1"; + WorkloadNetworkDnsZone result = await workloadNetwork.GetWorkloadNetworkDnsZoneAsync(dnsZoneId); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateWorkloadNetworkDnsZone_WorkloadNetworksCreateDnsZone() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_CreateDnsZone.json + // this example is just showing the usage of "WorkloadNetworkDnsZone_Create" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dnsZoneId = "dnsZone1"; + WorkloadNetworkDnsZone workloadNetworkDnsZone = new WorkloadNetworkDnsZone(); + ArmOperation lro = await workloadNetwork.CreateWorkloadNetworkDnsZoneAsync(WaitUntil.Completed, dnsZoneId, workloadNetworkDnsZone); + WorkloadNetworkDnsZone result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task UpdateWorkloadNetworkDnsZone_WorkloadNetworksUpdateDnsZone() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_UpdateDnsZone.json + // this example is just showing the usage of "WorkloadNetworkDnsZone_Update" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dnsZoneId = "dnsZone1"; + WorkloadNetworkDnsZone workloadNetworkDnsZone = new WorkloadNetworkDnsZone(); + ArmOperation lro = await workloadNetwork.UpdateWorkloadNetworkDnsZoneAsync(WaitUntil.Completed, dnsZoneId, workloadNetworkDnsZone); + WorkloadNetworkDnsZone result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task DeleteWorkloadNetworkDnsZone_WorkloadNetworksDeleteDnsZone() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_DeleteDnsZone.json + // this example is just showing the usage of "WorkloadNetworkDnsZone_Delete" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string dnsZoneId = "dnsZone1"; + await workloadNetwork.DeleteWorkloadNetworkDnsZoneAsync(WaitUntil.Completed, dnsZoneId); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkPortMirroringProfiles_WorkloadNetworksListPortMirroring() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_ListPortMirroring.json + // this example is just showing the usage of "WorkloadNetworkPortMirroring_List" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation and iterate over the result + await foreach (WorkloadNetworkPortMirroring item in workloadNetwork.GetWorkloadNetworkPortMirroringProfilesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkPortMirroringProfile_WorkloadNetworksGetPortMirroring() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetPortMirroring.json + // this example is just showing the usage of "WorkloadNetworkPortMirroring_Get" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string portMirroringId = "portMirroring1"; + WorkloadNetworkPortMirroring result = await workloadNetwork.GetWorkloadNetworkPortMirroringProfileAsync(portMirroringId); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateWorkloadNetworkPortMirroringProfile_WorkloadNetworksCreatePortMirroring() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_CreatePortMirroring.json + // this example is just showing the usage of "WorkloadNetworkPortMirroring_Create" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string portMirroringId = "portMirroring1"; + WorkloadNetworkPortMirroring workloadNetworkPortMirroring = new WorkloadNetworkPortMirroring(); + ArmOperation lro = await workloadNetwork.CreateWorkloadNetworkPortMirroringProfileAsync(WaitUntil.Completed, portMirroringId, workloadNetworkPortMirroring); + WorkloadNetworkPortMirroring result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task UpdateWorkloadNetworkPortMirroringProfile_WorkloadNetworksUpdatePortMirroring() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_UpdatePortMirroring.json + // this example is just showing the usage of "WorkloadNetworkPortMirroring_Update" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string portMirroringId = "portMirroring1"; + WorkloadNetworkPortMirroring workloadNetworkPortMirroring = new WorkloadNetworkPortMirroring(); + ArmOperation lro = await workloadNetwork.UpdateWorkloadNetworkPortMirroringProfileAsync(WaitUntil.Completed, portMirroringId, workloadNetworkPortMirroring); + WorkloadNetworkPortMirroring result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task DeleteWorkloadNetworkPortMirroringProfile_WorkloadNetworksDeletePortMirroring() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_DeletePortMirroring.json + // this example is just showing the usage of "WorkloadNetworkPortMirroring_Delete" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string portMirroringId = "portMirroring1"; + await workloadNetwork.DeleteWorkloadNetworkPortMirroringProfileAsync(WaitUntil.Completed, portMirroringId); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkPublicIps_WorkloadNetworksListPublicIPs() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_ListPublicIPs.json + // this example is just showing the usage of "WorkloadNetworkPublicIP_List" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation and iterate over the result + await foreach (WorkloadNetworkPublicIP item in workloadNetwork.GetWorkloadNetworkPublicIpsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkPublicIp_WorkloadNetworksGetPublicIP() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetPublicIP.json + // this example is just showing the usage of "WorkloadNetworkPublicIP_Get" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string publicIPId = "publicIP1"; + WorkloadNetworkPublicIP result = await workloadNetwork.GetWorkloadNetworkPublicIpAsync(publicIPId); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateWorkloadNetworkPublicIp_WorkloadNetworksCreatePublicIP() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_CreatePublicIP.json + // this example is just showing the usage of "WorkloadNetworkPublicIP_Create" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string publicIPId = "publicIP1"; + WorkloadNetworkPublicIP workloadNetworkPublicIP = new WorkloadNetworkPublicIP(); + ArmOperation lro = await workloadNetwork.CreateWorkloadNetworkPublicIpAsync(WaitUntil.Completed, publicIPId, workloadNetworkPublicIP); + WorkloadNetworkPublicIP result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task DeleteWorkloadNetworkPublicIp_WorkloadNetworksDeletePublicIP() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_DeletePublicIP.json + // this example is just showing the usage of "WorkloadNetworkPublicIP_Delete" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string publicIPId = "publicIP1"; + await workloadNetwork.DeleteWorkloadNetworkPublicIpAsync(WaitUntil.Completed, publicIPId); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkVmGroups_WorkloadNetworksListVMGroups() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_ListVMGroups.json + // this example is just showing the usage of "WorkloadNetworkVMGroup_List" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation and iterate over the result + await foreach (WorkloadNetworkVmGroup item in workloadNetwork.GetWorkloadNetworkVmGroupsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetWorkloadNetworkVmGroup_WorkloadNetworksGetVMGroup() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetVMGroup.json + // this example is just showing the usage of "WorkloadNetworkVMGroup_Get" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string vmGroupId = "vmGroup1"; + WorkloadNetworkVmGroup result = await workloadNetwork.GetWorkloadNetworkVmGroupAsync(vmGroupId); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateWorkloadNetworkVmGroup_WorkloadNetworksCreateVMGroup() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_CreateVMGroup.json + // this example is just showing the usage of "WorkloadNetworkVMGroup_Create" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string vmGroupId = "vmGroup1"; + WorkloadNetworkVmGroup workloadNetworkVmGroup = new WorkloadNetworkVmGroup(); + ArmOperation lro = await workloadNetwork.CreateWorkloadNetworkVmGroupAsync(WaitUntil.Completed, vmGroupId, workloadNetworkVmGroup); + WorkloadNetworkVmGroup result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task UpdateWorkloadNetworkVmGroup_WorkloadNetworksUpdateVMGroup() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_UpdateVMGroup.json + // this example is just showing the usage of "WorkloadNetworkVMGroup_Update" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string vmGroupId = "vmGroup1"; + WorkloadNetworkVmGroup workloadNetworkVmGroup = new WorkloadNetworkVmGroup(); + ArmOperation lro = await workloadNetwork.UpdateWorkloadNetworkVmGroupAsync(WaitUntil.Completed, vmGroupId, workloadNetworkVmGroup); + WorkloadNetworkVmGroup result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task DeleteWorkloadNetworkVmGroup_WorkloadNetworksDeleteVMGroup() + { + // Generated from example definition: 2024-09-01/WorkloadNetworks_DeleteVMGroup.json + // this example is just showing the usage of "WorkloadNetworkVMGroup_Delete" 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 WorkloadNetworkResource created on azure + // for more information of creating WorkloadNetworkResource, please refer to the document of WorkloadNetworkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "group1"; + string privateCloudName = "cloud1"; + ResourceIdentifier workloadNetworkResourceId = WorkloadNetworkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, privateCloudName); + WorkloadNetworkResource workloadNetwork = client.GetWorkloadNetworkResource(workloadNetworkResourceId); + + // invoke the operation + string vmGroupId = "vmGroup1"; + await workloadNetwork.DeleteWorkloadNetworkVmGroupAsync(WaitUntil.Completed, vmGroupId); + + Console.WriteLine("Succeeded"); + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentCollection.cs index a741a307dc4b..63e16484d0ba 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentCollection.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.Avs.Models; using NUnit.Framework; namespace Azure.ResourceManager.Avs.Samples @@ -20,8 +19,8 @@ public partial class Sample_WorkloadNetworkSegmentCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_WorkloadNetworksCreateSegments() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateSegments.json - // this example is just showing the usage of "WorkloadNetworks_CreateSegments" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_CreateSegments.json + // this example is just showing the usage of "WorkloadNetworkSegment_Create" 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(); @@ -41,17 +40,7 @@ public async Task CreateOrUpdate_WorkloadNetworksCreateSegments() // invoke the operation string segmentId = "segment1"; - WorkloadNetworkSegmentData data = new WorkloadNetworkSegmentData - { - DisplayName = "segment1", - ConnectedGateway = "/infra/tier-1s/gateway", - Subnet = new WorkloadNetworkSegmentSubnet - { - DhcpRanges = { "40.20.0.0-40.20.0.1" }, - GatewayAddress = "40.20.20.20/16", - }, - Revision = 1L, - }; + WorkloadNetworkSegmentData data = new WorkloadNetworkSegmentData(); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, segmentId, data); WorkloadNetworkSegmentResource result = lro.Value; @@ -66,8 +55,8 @@ public async Task CreateOrUpdate_WorkloadNetworksCreateSegments() [Ignore("Only validating compilation of examples")] public async Task Get_WorkloadNetworksGetSegment() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetSegment.json - // this example is just showing the usage of "WorkloadNetworks_GetSegment" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetSegment.json + // this example is just showing the usage of "WorkloadNetworkSegment_Get" 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(); @@ -100,8 +89,8 @@ public async Task Get_WorkloadNetworksGetSegment() [Ignore("Only validating compilation of examples")] public async Task GetAll_WorkloadNetworksListSegments() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListSegments.json - // this example is just showing the usage of "WorkloadNetworks_ListSegments" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_ListSegments.json + // this example is just showing the usage of "WorkloadNetworkSegment_List" 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(); @@ -136,8 +125,8 @@ public async Task GetAll_WorkloadNetworksListSegments() [Ignore("Only validating compilation of examples")] public async Task Exists_WorkloadNetworksGetSegment() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetSegment.json - // this example is just showing the usage of "WorkloadNetworks_GetSegment" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetSegment.json + // this example is just showing the usage of "WorkloadNetworkSegment_Get" 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(); @@ -166,8 +155,8 @@ public async Task Exists_WorkloadNetworksGetSegment() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_WorkloadNetworksGetSegment() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetSegment.json - // this example is just showing the usage of "WorkloadNetworks_GetSegment" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetSegment.json + // this example is just showing the usage of "WorkloadNetworkSegment_Get" 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(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentResource.cs index ddc503288bdc..cd3f1167a090 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkSegmentResource.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.Avs.Models; using NUnit.Framework; namespace Azure.ResourceManager.Avs.Samples @@ -20,8 +19,8 @@ public partial class Sample_WorkloadNetworkSegmentResource [Ignore("Only validating compilation of examples")] public async Task Get_WorkloadNetworksGetSegment() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetSegment.json - // this example is just showing the usage of "WorkloadNetworks_GetSegment" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetSegment.json + // this example is just showing the usage of "WorkloadNetworkSegment_Get" 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(); @@ -51,8 +50,8 @@ public async Task Get_WorkloadNetworksGetSegment() [Ignore("Only validating compilation of examples")] public async Task Delete_WorkloadNetworksDeleteSegment() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteSegment.json - // this example is just showing the usage of "WorkloadNetworks_DeleteSegment" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_DeleteSegment.json + // this example is just showing the usage of "WorkloadNetworkSegment_DeleteSegment" 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(); @@ -78,8 +77,8 @@ public async Task Delete_WorkloadNetworksDeleteSegment() [Ignore("Only validating compilation of examples")] public async Task Update_WorkloadNetworksUpdateSegments() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateSegments.json - // this example is just showing the usage of "WorkloadNetworks_UpdateSegments" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_UpdateSegments.json + // this example is just showing the usage of "WorkloadNetworkSegment_Update" 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(); @@ -96,16 +95,7 @@ public async Task Update_WorkloadNetworksUpdateSegments() WorkloadNetworkSegmentResource workloadNetworkSegment = client.GetWorkloadNetworkSegmentResource(workloadNetworkSegmentResourceId); // invoke the operation - WorkloadNetworkSegmentData data = new WorkloadNetworkSegmentData - { - ConnectedGateway = "/infra/tier-1s/gateway", - Subnet = new WorkloadNetworkSegmentSubnet - { - DhcpRanges = { "40.20.0.0-40.20.0.1" }, - GatewayAddress = "40.20.20.20/16", - }, - Revision = 1L, - }; + WorkloadNetworkSegmentData data = new WorkloadNetworkSegmentData(); ArmOperation lro = await workloadNetworkSegment.UpdateAsync(WaitUntil.Completed, data); WorkloadNetworkSegmentResource result = lro.Value; diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineCollection.cs index 7008c5527d7b..6270a42102fa 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineCollection.cs @@ -19,8 +19,8 @@ public partial class Sample_WorkloadNetworkVirtualMachineCollection [Ignore("Only validating compilation of examples")] public async Task Get_WorkloadNetworksGetVirtualMachine() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetVirtualMachine.json - // this example is just showing the usage of "WorkloadNetworks_GetVirtualMachine" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetVirtualMachine.json + // this example is just showing the usage of "WorkloadNetworkVirtualMachine_Get" 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(); @@ -53,8 +53,8 @@ public async Task Get_WorkloadNetworksGetVirtualMachine() [Ignore("Only validating compilation of examples")] public async Task GetAll_WorkloadNetworksListVirtualMachines() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListVirtualMachines.json - // this example is just showing the usage of "WorkloadNetworks_ListVirtualMachines" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_ListVirtualMachines.json + // this example is just showing the usage of "WorkloadNetworkVirtualMachine_List" 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(); @@ -89,8 +89,8 @@ public async Task GetAll_WorkloadNetworksListVirtualMachines() [Ignore("Only validating compilation of examples")] public async Task Exists_WorkloadNetworksGetVirtualMachine() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetVirtualMachine.json - // this example is just showing the usage of "WorkloadNetworks_GetVirtualMachine" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetVirtualMachine.json + // this example is just showing the usage of "WorkloadNetworkVirtualMachine_Get" 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(); @@ -119,8 +119,8 @@ public async Task Exists_WorkloadNetworksGetVirtualMachine() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_WorkloadNetworksGetVirtualMachine() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetVirtualMachine.json - // this example is just showing the usage of "WorkloadNetworks_GetVirtualMachine" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetVirtualMachine.json + // this example is just showing the usage of "WorkloadNetworkVirtualMachine_Get" 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(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineResource.cs b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineResource.cs index caa4bb73c7c0..03d675e8e74b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/samples/Generated/Samples/Sample_WorkloadNetworkVirtualMachineResource.cs @@ -19,8 +19,8 @@ public partial class Sample_WorkloadNetworkVirtualMachineResource [Ignore("Only validating compilation of examples")] public async Task Get_WorkloadNetworksGetVirtualMachine() { - // Generated from example definition: specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetVirtualMachine.json - // this example is just showing the usage of "WorkloadNetworks_GetVirtualMachine" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-09-01/WorkloadNetworks_GetVirtualMachine.json + // this example is just showing the usage of "WorkloadNetworkVirtualMachine_Get" 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(); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs similarity index 60% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs index 2294956f0fa7..b533db559f97 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs @@ -18,28 +18,28 @@ namespace Azure.ResourceManager.Avs { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetAvsPrivateCloudAddons method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAddons method from an instance of . /// - public partial class AvsPrivateCloudAddonCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class AddonCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _avsPrivateCloudAddonAddonsClientDiagnostics; - private readonly AddonsRestOperations _avsPrivateCloudAddonAddonsRestClient; + private readonly ClientDiagnostics _addonClientDiagnostics; + private readonly AddonsRestOperations _addonRestClient; - /// Initializes a new instance of the class for mocking. - protected AvsPrivateCloudAddonCollection() + /// Initializes a new instance of the class for mocking. + protected AddonCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal AvsPrivateCloudAddonCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal AddonCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsPrivateCloudAddonAddonsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", AvsPrivateCloudAddonResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(AvsPrivateCloudAddonResource.ResourceType, out string avsPrivateCloudAddonAddonsApiVersion); - _avsPrivateCloudAddonAddonsRestClient = new AddonsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsPrivateCloudAddonAddonsApiVersion); + _addonClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", AddonResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AddonResource.ResourceType, out string addonApiVersion); + _addonRestClient = new AddonsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, addonApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -47,8 +47,8 @@ internal AvsPrivateCloudAddonCollection(ArmClient client, ResourceIdentifier id) internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudResource.ResourceType), nameof(id)); + if (id.ResourceType != PrivateCloudResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloudResource.ResourceType), nameof(id)); } /// @@ -60,15 +60,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Addons_CreateOrUpdate + /// Addon_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -78,17 +78,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string addonName, AvsPrivateCloudAddonData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string addonName, AddonData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonCollection.CreateOrUpdate"); + using var scope = _addonClientDiagnostics.CreateScope("AddonCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _avsPrivateCloudAddonAddonsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new AvsPrivateCloudAddonOperationSource(Client), _avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, _avsPrivateCloudAddonAddonsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _addonRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new AddonOperationSource(Client), _addonClientDiagnostics, Pipeline, _addonRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -109,15 +109,15 @@ public virtual async Task> CreateOrUp /// /// /// Operation Id - /// Addons_CreateOrUpdate + /// Addon_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -127,17 +127,17 @@ public virtual async Task> CreateOrUp /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string addonName, AvsPrivateCloudAddonData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string addonName, AddonData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonCollection.CreateOrUpdate"); + using var scope = _addonClientDiagnostics.CreateScope("AddonCollection.CreateOrUpdate"); scope.Start(); try { - var response = _avsPrivateCloudAddonAddonsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, data, cancellationToken); - var operation = new AvsArmOperation(new AvsPrivateCloudAddonOperationSource(Client), _avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, _avsPrivateCloudAddonAddonsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _addonRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, data, cancellationToken); + var operation = new AvsArmOperation(new AddonOperationSource(Client), _addonClientDiagnostics, Pipeline, _addonRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -158,15 +158,15 @@ public virtual ArmOperation CreateOrUpdate(WaitUnt /// /// /// Operation Id - /// Addons_Get + /// Addon_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -174,18 +174,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUnt /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string addonName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string addonName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonCollection.Get"); + using var scope = _addonClientDiagnostics.CreateScope("AddonCollection.Get"); scope.Start(); try { - var response = await _avsPrivateCloudAddonAddonsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken).ConfigureAwait(false); + var response = await _addonRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudAddonResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new AddonResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -203,15 +203,15 @@ public virtual async Task> GetAsync(strin /// /// /// Operation Id - /// Addons_Get + /// Addon_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -219,18 +219,18 @@ public virtual async Task> GetAsync(strin /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string addonName, CancellationToken cancellationToken = default) + public virtual Response Get(string addonName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonCollection.Get"); + using var scope = _addonClientDiagnostics.CreateScope("AddonCollection.Get"); scope.Start(); try { - var response = _avsPrivateCloudAddonAddonsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken); + var response = _addonRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudAddonResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new AddonResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -248,25 +248,25 @@ public virtual Response Get(string addonName, Canc /// /// /// Operation Id - /// Addons_List + /// Addon_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudAddonAddonsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudAddonAddonsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudAddonResource(Client, AvsPrivateCloudAddonData.DeserializeAvsPrivateCloudAddonData(e)), _avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, "AvsPrivateCloudAddonCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _addonRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _addonRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AddonResource(Client, AddonData.DeserializeAddonData(e)), _addonClientDiagnostics, Pipeline, "AddonCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -278,25 +278,25 @@ public virtual AsyncPageable GetAllAsync(Cancellat /// /// /// Operation Id - /// Addons_List + /// Addon_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudAddonAddonsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudAddonAddonsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudAddonResource(Client, AvsPrivateCloudAddonData.DeserializeAvsPrivateCloudAddonData(e)), _avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, "AvsPrivateCloudAddonCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _addonRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _addonRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AddonResource(Client, AddonData.DeserializeAddonData(e)), _addonClientDiagnostics, Pipeline, "AddonCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -308,15 +308,15 @@ public virtual Pageable GetAll(CancellationToken c /// /// /// Operation Id - /// Addons_Get + /// Addon_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -328,11 +328,11 @@ public virtual async Task> ExistsAsync(string addonName, Cancella { Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonCollection.Exists"); + using var scope = _addonClientDiagnostics.CreateScope("AddonCollection.Exists"); scope.Start(); try { - var response = await _avsPrivateCloudAddonAddonsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _addonRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -351,15 +351,15 @@ public virtual async Task> ExistsAsync(string addonName, Cancella /// /// /// Operation Id - /// Addons_Get + /// Addon_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -371,11 +371,11 @@ public virtual Response Exists(string addonName, CancellationToken cancell { Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonCollection.Exists"); + using var scope = _addonClientDiagnostics.CreateScope("AddonCollection.Exists"); scope.Start(); try { - var response = _avsPrivateCloudAddonAddonsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken); + var response = _addonRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -394,15 +394,15 @@ public virtual Response Exists(string addonName, CancellationToken cancell /// /// /// Operation Id - /// Addons_Get + /// Addon_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -410,18 +410,18 @@ public virtual Response Exists(string addonName, CancellationToken cancell /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string addonName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string addonName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonCollection.GetIfExists"); + using var scope = _addonClientDiagnostics.CreateScope("AddonCollection.GetIfExists"); scope.Start(); try { - var response = await _avsPrivateCloudAddonAddonsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _addonRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudAddonResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AddonResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -439,15 +439,15 @@ public virtual async Task> GetIfE /// /// /// Operation Id - /// Addons_Get + /// Addon_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -455,18 +455,18 @@ public virtual async Task> GetIfE /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string addonName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string addonName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(addonName, nameof(addonName)); - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonCollection.GetIfExists"); + using var scope = _addonClientDiagnostics.CreateScope("AddonCollection.GetIfExists"); scope.Start(); try { - var response = _avsPrivateCloudAddonAddonsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken); + var response = _addonRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudAddonResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AddonResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -475,7 +475,7 @@ public virtual NullableResponse GetIfExists(string } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -485,7 +485,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.Serialization.cs new file mode 100644 index 000000000000..17991b4c8e44 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.Serialization.cs @@ -0,0 +1,155 @@ +// 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; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class AddonData : 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 override 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(AddonData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + AddonData 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(AddonData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAddonData(document.RootElement, options); + } + + internal static AddonData DeserializeAddonData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AddonProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = AddonProperties.DeserializeAddonProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AddonData( + id, + name, + type, + systemData, + properties, + 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); + default: + throw new FormatException($"The model {nameof(AddonData)} does not support writing '{options.Format}' format."); + } + } + + AddonData 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 DeserializeAddonData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AddonData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs similarity index 72% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs index ee048fa34e28..e332fd64c628 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs @@ -14,10 +14,10 @@ namespace Azure.ResourceManager.Avs { /// - /// A class representing the AvsPrivateCloudAddon data model. + /// A class representing the Addon data model. /// An addon resource /// - public partial class AvsPrivateCloudAddonData : ResourceData + public partial class AddonData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,23 +51,23 @@ public partial class AvsPrivateCloudAddonData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public AvsPrivateCloudAddonData() + /// Initializes a new instance of . + public AddonData() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// /// The resource-specific properties for this resource. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudAddonData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsPrivateCloudAddonProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal AddonData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AddonProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -75,9 +75,9 @@ internal AvsPrivateCloudAddonData(ResourceIdentifier id, string name, ResourceTy /// /// The resource-specific properties for this resource. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// - public AvsPrivateCloudAddonProperties Properties { get; set; } + public AddonProperties Properties { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonResource.Serialization.cs new file mode 100644 index 000000000000..d96d968a5dfe --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Avs +{ + public partial class AddonResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + AddonData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + AddonData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonResource.cs similarity index 64% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonResource.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonResource.cs index 2f4bbb5d238b..abcd6cfdbe36 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonResource.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.Avs { /// - /// A Class representing an AvsPrivateCloudAddon along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetAvsPrivateCloudAddonResource method. - /// Otherwise you can get one from its parent resource using the GetAvsPrivateCloudAddon method. + /// A Class representing an Addon along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAddonResource method. + /// Otherwise you can get one from its parent resource using the GetAddon method. /// - public partial class AvsPrivateCloudAddonResource : ArmResource + public partial class AddonResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The privateCloudName. @@ -33,35 +33,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _avsPrivateCloudAddonAddonsClientDiagnostics; - private readonly AddonsRestOperations _avsPrivateCloudAddonAddonsRestClient; - private readonly AvsPrivateCloudAddonData _data; + private readonly ClientDiagnostics _addonClientDiagnostics; + private readonly AddonsRestOperations _addonRestClient; + private readonly AddonData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/addons"; - /// Initializes a new instance of the class for mocking. - protected AvsPrivateCloudAddonResource() + /// Initializes a new instance of the class for mocking. + protected AddonResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal AvsPrivateCloudAddonResource(ArmClient client, AvsPrivateCloudAddonData data) : this(client, data.Id) + internal AddonResource(ArmClient client, AddonData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal AvsPrivateCloudAddonResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal AddonResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsPrivateCloudAddonAddonsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string avsPrivateCloudAddonAddonsApiVersion); - _avsPrivateCloudAddonAddonsRestClient = new AddonsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsPrivateCloudAddonAddonsApiVersion); + _addonClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string addonApiVersion); + _addonRestClient = new AddonsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, addonApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -72,7 +72,7 @@ internal AvsPrivateCloudAddonResource(ArmClient client, ResourceIdentifier id) : /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual AvsPrivateCloudAddonData Data + public virtual AddonData Data { get { @@ -97,29 +97,29 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Addons_Get + /// Addon_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonResource.Get"); + using var scope = _addonClientDiagnostics.CreateScope("AddonResource.Get"); scope.Start(); try { - var response = await _avsPrivateCloudAddonAddonsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _addonRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudAddonResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new AddonResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -137,29 +137,29 @@ public virtual async Task> GetAsync(Cance /// /// /// Operation Id - /// Addons_Get + /// Addon_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonResource.Get"); + using var scope = _addonClientDiagnostics.CreateScope("AddonResource.Get"); scope.Start(); try { - var response = _avsPrivateCloudAddonAddonsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _addonRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudAddonResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new AddonResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -177,15 +177,15 @@ public virtual Response Get(CancellationToken canc /// /// /// Operation Id - /// Addons_Delete + /// Addon_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -193,12 +193,12 @@ public virtual Response Get(CancellationToken canc /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonResource.Delete"); + using var scope = _addonClientDiagnostics.CreateScope("AddonResource.Delete"); scope.Start(); try { - var response = await _avsPrivateCloudAddonAddonsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, _avsPrivateCloudAddonAddonsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _addonRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_addonClientDiagnostics, Pipeline, _addonRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -219,15 +219,15 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// Addons_Delete + /// Addon_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -235,12 +235,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonResource.Delete"); + using var scope = _addonClientDiagnostics.CreateScope("AddonResource.Delete"); scope.Start(); try { - var response = _avsPrivateCloudAddonAddonsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, _avsPrivateCloudAddonAddonsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _addonRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new AvsArmOperation(_addonClientDiagnostics, Pipeline, _addonRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -261,15 +261,15 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Addons_CreateOrUpdate + /// Addon_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -277,16 +277,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Resource create parameters. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, AvsPrivateCloudAddonData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AddonData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonResource.Update"); + using var scope = _addonClientDiagnostics.CreateScope("AddonResource.Update"); scope.Start(); try { - var response = await _avsPrivateCloudAddonAddonsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new AvsPrivateCloudAddonOperationSource(Client), _avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, _avsPrivateCloudAddonAddonsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _addonRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new AddonOperationSource(Client), _addonClientDiagnostics, Pipeline, _addonRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -307,15 +307,15 @@ public virtual async Task> UpdateAsyn /// /// /// Operation Id - /// Addons_CreateOrUpdate + /// Addon_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -323,16 +323,16 @@ public virtual async Task> UpdateAsyn /// Resource create parameters. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, AvsPrivateCloudAddonData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, AddonData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudAddonAddonsClientDiagnostics.CreateScope("AvsPrivateCloudAddonResource.Update"); + using var scope = _addonClientDiagnostics.CreateScope("AddonResource.Update"); scope.Start(); try { - var response = _avsPrivateCloudAddonAddonsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new AvsArmOperation(new AvsPrivateCloudAddonOperationSource(Client), _avsPrivateCloudAddonAddonsClientDiagnostics, Pipeline, _avsPrivateCloudAddonAddonsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _addonRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new AvsArmOperation(new AddonOperationSource(Client), _addonClientDiagnostics, Pipeline, _addonRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ArmAvsModelFactory.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ArmAvsModelFactory.cs index 76dc4245065b..f8a925a02883 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ArmAvsModelFactory.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ArmAvsModelFactory.cs @@ -7,9 +7,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; -using System.Net; using Azure.Core; using Azure.ResourceManager.Models; @@ -18,199 +16,91 @@ namespace Azure.ResourceManager.Avs.Models /// Model factory for models. public static partial class ArmAvsModelFactory { - /// Initializes a new instance of . - /// Remaining hosts quota by sku type. - /// Host quota is active for current subscription. - /// A new instance for mocking. - public static AvsSubscriptionQuotaAvailabilityResult AvsSubscriptionQuotaAvailabilityResult(IReadOnlyDictionary hostsRemaining = null, AvsSubscriptionQuotaEnabled? quotaEnabled = null) - { - hostsRemaining ??= new Dictionary(); - - return new AvsSubscriptionQuotaAvailabilityResult(hostsRemaining, quotaEnabled, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Trial status. - /// Number of trial hosts available. - /// A new instance for mocking. - public static AvsSubscriptionTrialAvailabilityResult AvsSubscriptionTrialAvailabilityResult(AvsSubscriptionTrialStatus? status = null, int? availableHosts = null) - { - return new AvsSubscriptionTrialAvailabilityResult(status, availableHosts, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The tags. - /// The location. - /// The SKU (Stock Keeping Unit) assigned to this resource. - /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. - /// The default cluster used for management. - /// Connectivity to internet is enabled or disabled. - /// vCenter Single Sign On Identity Sources. - /// Properties describing how the cloud is distributed across availability zones. - /// Customer managed key encryption, can be enabled or disabled. - /// - /// Array of additional networks noncontiguous with networkBlock. Networks must be - /// unique and non-overlapping across VNet in your subscription, on-premise, and - /// this privateCloud networkBlock attribute. Make sure the CIDR format conforms to - /// (A.B.C.D/X). - /// - /// The provisioning state. - /// An ExpressRoute Circuit. - /// The endpoints. - /// - /// The block of addresses should be unique across VNet in your subscription as - /// well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where - /// A,B,C,D are between 0 and 255, and X is between 0 and 22 - /// - /// Network used to access vCenter Server and NSX-T Manager. - /// Used for virtual machine cold migration, cloning, and snapshot migration. - /// Used for live migration of virtual machines. - /// Optionally, set the vCenter admin password when the private cloud is created. - /// Optionally, set the NSX-T Manager password when the private cloud is created. - /// Thumbprint of the vCenter Server SSL certificate. - /// Thumbprint of the NSX-T Manager SSL certificate. - /// Array of cloud link IDs from other clouds that connect to this one. - /// - /// A secondary expressRoute circuit from a separate AZ. Only present in a - /// stretched private cloud - /// - /// - /// Flag to indicate whether the private cloud has the quota for provisioned NSX - /// Public IP count raised from 64 to 1024 + /// + /// The resource-specific properties for this resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . /// - /// Azure resource ID of the virtual network. - /// The type of DNS zone to use. - /// A new instance for mocking. - public static AvsPrivateCloudData AvsPrivateCloudData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AvsSku sku = null, ManagedServiceIdentity identity = null, AvsManagementCluster managementCluster = null, InternetConnectivityState? internet = null, IEnumerable identitySources = null, PrivateCloudAvailabilityProperties availability = null, CustomerManagedEncryption encryption = null, IEnumerable extendedNetworkBlocks = null, AvsPrivateCloudProvisioningState? provisioningState = null, ExpressRouteCircuit circuit = null, AvsPrivateCloudEndpoints endpoints = null, string networkBlock = null, string managementNetwork = null, string provisioningNetwork = null, string vMotionNetwork = null, string vCenterPassword = null, string nsxtPassword = null, string vCenterCertificateThumbprint = null, string nsxtCertificateThumbprint = null, IEnumerable externalCloudLinks = null, ExpressRouteCircuit secondaryCircuit = null, NsxPublicIPQuotaRaisedEnum? nsxPublicIPQuotaRaised = null, ResourceIdentifier virtualNetworkId = null, AvsDnsZoneType? dnsZoneType = null) + /// A new instance for mocking. + public static AddonData AddonData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AddonProperties properties = null) { - tags ??= new Dictionary(); - identitySources ??= new List(); - extendedNetworkBlocks ??= new List(); - externalCloudLinks ??= new List(); - - return new AvsPrivateCloudData( + return new AddonData( id, name, resourceType, systemData, - tags, - location, - sku, - identity, - managementCluster, - internet, - identitySources?.ToList(), - availability, - encryption, - extendedNetworkBlocks?.ToList(), - provisioningState, - circuit, - endpoints, - networkBlock, - managementNetwork, - provisioningNetwork, - vMotionNetwork, - vCenterPassword, - nsxtPassword, - vCenterCertificateThumbprint, - nsxtCertificateThumbprint, - externalCloudLinks?.ToList(), - secondaryCircuit, - nsxPublicIPQuotaRaised, - virtualNetworkId, - dnsZoneType, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The cluster size. - /// The state of the cluster provisioning. - /// The identity. - /// The hosts. - /// Name of the vsan datastore associated with the cluster. - /// A new instance for mocking. - public static AvsManagementCluster AvsManagementCluster(int? clusterSize = null, AvsPrivateCloudClusterProvisioningState? provisioningState = null, int? clusterId = null, IEnumerable hosts = null, string vsanDatastoreName = null) + /// Initializes a new instance of . + /// Addon type. + /// The state of the addon provisioning. + /// A new instance for mocking. + public static AddonProperties AddonProperties(string addonType = null, AddonProvisioningState? provisioningState = null) { - hosts ??= new List(); + return new UnknownAddonProperties(addonType == null ? default : new AddonType(addonType), provisioningState, serializedAdditionalRawData: null); + } - return new AvsManagementCluster( - clusterSize, - provisioningState, - clusterId, - hosts?.ToList(), - vsanDatastoreName, - serializedAdditionalRawData: null); + /// Initializes a new instance of . + /// The state of the addon provisioning. + /// The Site Recovery Manager (SRM) license. + /// A new instance for mocking. + public static AddonSrmProperties AddonSrmProperties(AddonProvisioningState? provisioningState = null, string licenseKey = null) + { + return new AddonSrmProperties(AddonType.SRM, provisioningState, serializedAdditionalRawData: null, licenseKey); } - /// Initializes a new instance of . - /// The name of the key. - /// The version of the key. - /// The auto-detected version of the key if versionType is auto-detected. - /// The URL of the vault. - /// The state of key provided. - /// Property of the key if user provided or auto detected. - /// A new instance for mocking. - public static AvsEncryptionKeyVaultProperties AvsEncryptionKeyVaultProperties(string keyName = null, string keyVersion = null, string autoDetectedKeyVersion = null, Uri keyVaultUri = null, AvsEncryptionKeyStatus? keyState = null, AvsEncryptionVersionType? versionType = null) + /// Initializes a new instance of . + /// The state of the addon provisioning. + /// The vSphere Replication Server (VRS) count. + /// A new instance for mocking. + public static AddonVrProperties AddonVrProperties(AddonProvisioningState? provisioningState = null, int vrsCount = default) { - return new AvsEncryptionKeyVaultProperties( - keyName, - keyVersion, - autoDetectedKeyVersion, - keyVaultUri, - keyState, - versionType, - serializedAdditionalRawData: null); + return new AddonVrProperties(AddonType.VR, provisioningState, serializedAdditionalRawData: null, vrsCount); } - /// Initializes a new instance of . - /// CIDR of primary subnet. - /// CIDR of secondary subnet. - /// Identifier of the ExpressRoute Circuit (Microsoft Colo only). - /// ExpressRoute Circuit private peering identifier. - /// A new instance for mocking. - public static ExpressRouteCircuit ExpressRouteCircuit(string primarySubnet = null, string secondarySubnet = null, ResourceIdentifier expressRouteId = null, ResourceIdentifier expressRoutePrivatePeeringId = null) + /// Initializes a new instance of . + /// The state of the addon provisioning. + /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). + /// HCX management network. + /// HCX uplink network. + /// A new instance for mocking. + public static AddonHcxProperties AddonHcxProperties(AddonProvisioningState? provisioningState = null, string offer = null, string managementNetwork = null, string uplinkNetwork = null) { - return new ExpressRouteCircuit(primarySubnet, secondarySubnet, expressRouteId, expressRoutePrivatePeeringId, serializedAdditionalRawData: null); + return new AddonHcxProperties( + AddonType.HCX, + provisioningState, + serializedAdditionalRawData: null, + offer, + managementNetwork, + uplinkNetwork); } - /// Initializes a new instance of . - /// Endpoint FQDN for the NSX-T Data Center manager. - /// Endpoint FQDN for Virtual Center Server Appliance. - /// Endpoint FQDN for the HCX Cloud Manager. - /// Endpoint IP for the NSX-T Data Center manager. - /// Endpoint IP for Virtual Center Server Appliance. - /// Endpoint IP for the HCX Cloud Manager. - /// A new instance for mocking. - public static AvsPrivateCloudEndpoints AvsPrivateCloudEndpoints(string nsxtManager = null, string vcsa = null, string hcxCloudManager = null, string nsxtManagerIP = null, string vcenterIP = null, string hcxCloudManagerIP = null) + /// Initializes a new instance of . + /// The state of the addon provisioning. + /// The VMware vCenter resource ID. + /// A new instance for mocking. + public static AddonArcProperties AddonArcProperties(AddonProvisioningState? provisioningState = null, string vCenter = null) { - return new AvsPrivateCloudEndpoints( - nsxtManager, - vcsa, - hcxCloudManager, - nsxtManagerIP, - vcenterIP, - hcxCloudManagerIP, - serializedAdditionalRawData: null); + return new AddonArcProperties(AddonType.Arc, provisioningState, serializedAdditionalRawData: null, vCenter); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// - /// The resource-specific properties for this resource. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , and . - /// - /// A new instance for mocking. - public static AvsPrivateCloudAddonData AvsPrivateCloudAddonData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AvsPrivateCloudAddonProperties properties = null) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ExpressRouteAuthorizationData ExpressRouteAuthorizationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExpressRouteAuthorizationProperties properties = null) { - return new AvsPrivateCloudAddonData( + return new ExpressRouteAuthorizationData( id, name, resourceType, @@ -219,83 +109,77 @@ public static AvsPrivateCloudAddonData AvsPrivateCloudAddonData(ResourceIdentifi serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Addon type. - /// The state of the addon provisioning. - /// A new instance for mocking. - public static AvsPrivateCloudAddonProperties AvsPrivateCloudAddonProperties(string addonType = null, AddonProvisioningState? provisioningState = null) + /// Initializes a new instance of . + /// The state of the ExpressRoute Circuit Authorization provisioning. + /// The ID of the ExpressRoute Circuit Authorization. + /// The key of the ExpressRoute Circuit Authorization. + /// The ID of the ExpressRoute Circuit. + /// A new instance for mocking. + public static ExpressRouteAuthorizationProperties ExpressRouteAuthorizationProperties(ExpressRouteAuthorizationProvisioningState? provisioningState = null, string expressRouteAuthorizationId = null, string expressRouteAuthorizationKey = null, string expressRouteId = null) { - return new UnknownAddonProperties(addonType == null ? default : new AddonType(addonType), provisioningState, serializedAdditionalRawData: null); + return new ExpressRouteAuthorizationProperties(provisioningState, expressRouteAuthorizationId, expressRouteAuthorizationKey, expressRouteId, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The state of the ExpressRoute Circuit Authorization provisioning. - /// The ID of the ExpressRoute Circuit Authorization. - /// The key of the ExpressRoute Circuit Authorization. - /// The ID of the ExpressRoute Circuit. - /// A new instance for mocking. - public static ExpressRouteAuthorizationData ExpressRouteAuthorizationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExpressRouteAuthorizationProvisioningState? provisioningState = null, ResourceIdentifier expressRouteAuthorizationId = null, string expressRouteAuthorizationKey = null, ResourceIdentifier expressRouteId = null) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static CloudLinkData CloudLinkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CloudLinkProperties properties = null) { - return new ExpressRouteAuthorizationData( + return new CloudLinkData( id, name, resourceType, systemData, - provisioningState, - expressRouteAuthorizationId, - expressRouteAuthorizationKey, - expressRouteId, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// The state of the cloud link. + /// Identifier of the other private cloud participating in the link. + /// A new instance for mocking. + public static CloudLinkProperties CloudLinkProperties(CloudLinkProvisioningState? provisioningState = null, CloudLinkStatus? status = null, string linkedCloud = null) + { + return new CloudLinkProperties(provisioningState, status, linkedCloud, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. - /// The state of the cloud link. - /// Identifier of the other private cloud participating in the link. - /// A new instance for mocking. - public static AvsCloudLinkData AvsCloudLinkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AvsCloudLinkProvisioningState? provisioningState = null, AvsCloudLinkStatus? status = null, ResourceIdentifier linkedCloud = null) + /// The resource-specific properties for this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// A new instance for mocking. + public static ClusterData ClusterData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ClusterProperties properties = null, AvsSku sku = null) { - return new AvsCloudLinkData( + return new ClusterData( id, name, resourceType, systemData, - provisioningState, - status, - linkedCloud, + properties, + sku, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Initializes a new instance of . /// The cluster size. /// The state of the cluster provisioning. /// The identity. /// The hosts. /// Name of the vsan datastore associated with the cluster. - /// A new instance for mocking. - public static AvsPrivateCloudClusterData AvsPrivateCloudClusterData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AvsSku sku = null, int? clusterSize = null, AvsPrivateCloudClusterProvisioningState? provisioningState = null, int? clusterId = null, IEnumerable hosts = null, string vsanDatastoreName = null) + /// A new instance for mocking. + public static ClusterProperties ClusterProperties(int? clusterSize = null, ClusterProvisioningState? provisioningState = null, int? clusterId = null, IEnumerable hosts = null, string vsanDatastoreName = null) { hosts ??= new List(); - return new AvsPrivateCloudClusterData( - id, - name, - resourceType, - systemData, - sku, + return new ClusterProperties( clusterSize, provisioningState, clusterId, @@ -304,28 +188,61 @@ public static AvsPrivateCloudClusterData AvsPrivateCloudClusterData(ResourceIden serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// Zone and associated hosts info. + /// A new instance for mocking. + public static ClusterZoneList ClusterZoneList(IEnumerable zones = null) + { + zones ??= new List(); + + return new ClusterZoneList(zones?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of hosts belonging to the availability zone in a cluster. + /// Availability zone identifier. + /// A new instance for mocking. + public static ClusterZone ClusterZone(IEnumerable hosts = null, string zone = null) + { + hosts ??= new List(); + + return new ClusterZone(hosts?.ToList(), zone, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static DatastoreData DatastoreData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DatastoreProperties properties = null) + { + return new DatastoreData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The state of the datastore provisioning. /// An Azure NetApp Files volume. /// An iSCSI volume. /// An Elastic SAN volume. + /// A Pure Storage volume. /// The operational status of the datastore. - /// A new instance for mocking. - public static AvsPrivateCloudDatastoreData AvsPrivateCloudDatastoreData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AvsPrivateCloudDatastoreProvisioningState? provisioningState = null, ResourceIdentifier netAppVolumeId = null, DiskPoolVolume diskPoolVolume = null, ResourceIdentifier elasticSanVolumeTargetId = null, DatastoreStatus? status = null) + /// A new instance for mocking. + public static DatastoreProperties DatastoreProperties(DatastoreProvisioningState? provisioningState = null, ResourceIdentifier netAppVolumeId = null, DiskPoolVolume diskPoolVolume = null, ResourceIdentifier elasticSanVolumeTargetId = null, PureStorageVolume pureStorageVolume = null, DatastoreStatus? status = null) { - return new AvsPrivateCloudDatastoreData( - id, - name, - resourceType, - systemData, + return new DatastoreProperties( provisioningState, netAppVolumeId != null ? ResourceManagerModelFactory.WritableSubResource(netAppVolumeId) : null, diskPoolVolume, elasticSanVolumeTargetId != null ? new ElasticSanVolume(elasticSanVolumeTargetId, serializedAdditionalRawData: null) : null, + pureStorageVolume, status, serializedAdditionalRawData: null); } @@ -339,36 +256,21 @@ public static AvsPrivateCloudDatastoreData AvsPrivateCloudDatastoreData(Resource /// /// Device path. /// A new instance for mocking. - public static DiskPoolVolume DiskPoolVolume(ResourceIdentifier targetId = null, string lunName = null, LunMountMode? mountOption = null, string path = null) + public static DiskPoolVolume DiskPoolVolume(string targetId = null, string lunName = null, MountOptionEnum? mountOption = null, string path = null) { return new DiskPoolVolume(targetId, lunName, mountOption, path, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// List of hosts belonging to the availability zone in a cluster. - /// Availability zone identifier. - /// A new instance for mocking. - public static AvsClusterZone AvsClusterZone(IEnumerable hosts = null, string zone = null) - { - hosts ??= new List(); - - return new AvsClusterZone(hosts?.ToList(), zone, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// - /// The resource-specific properties for this resource. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// A new instance for mocking. - public static PlacementPolicyData PlacementPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PlacementPolicyProperties properties = null) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static GlobalReachConnectionData GlobalReachConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GlobalReachConnectionProperties properties = null) { - return new PlacementPolicyData( + return new GlobalReachConnectionData( id, name, resourceType, @@ -377,48 +279,7 @@ public static PlacementPolicyData PlacementPolicyData(ResourceIdentifier id = nu serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Placement Policy type. - /// Whether the placement policy is enabled or disabled. - /// Display name of the placement policy. - /// The provisioning state. - /// A new instance for mocking. - public static PlacementPolicyProperties PlacementPolicyProperties(string policyType = null, PlacementPolicyState? state = null, string displayName = null, PlacementPolicyProvisioningState? provisioningState = null) - { - return new UnknownPlacementPolicyProperties(policyType == null ? default : new PlacementPolicyType(policyType), state, displayName, provisioningState, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The provisioning state of the resource. - /// Display name of the VM. - /// Virtual machine managed object reference id. - /// Path to virtual machine's folder starting from datacenter virtual machine folder. - /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). - /// A new instance for mocking. - public static AvsPrivateCloudClusterVirtualMachineData AvsPrivateCloudClusterVirtualMachineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AvsVirtualMachineProvisioningState? provisioningState = null, string displayName = null, string moRefId = null, string folderPath = null, VirtualMachineRestrictMovementState? restrictMovement = null) - { - return new AvsPrivateCloudClusterVirtualMachineData( - id, - name, - resourceType, - systemData, - provisioningState, - displayName, - moRefId, - folderPath, - restrictMovement, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// The state of the ExpressRoute Circuit Authorization provisioning. /// /// The network used for global reach carved out from the original network block @@ -437,14 +298,10 @@ public static AvsPrivateCloudClusterVirtualMachineData AvsPrivateCloudClusterVir /// The ID of the Private Cloud's ExpressRoute Circuit that is participating in the /// global reach connection /// - /// A new instance for mocking. - public static GlobalReachConnectionData GlobalReachConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, GlobalReachConnectionProvisioningState? provisioningState = null, string addressPrefix = null, string authorizationKey = null, GlobalReachConnectionStatus? circuitConnectionStatus = null, ResourceIdentifier peerExpressRouteCircuit = null, ResourceIdentifier expressRouteId = null) + /// A new instance for mocking. + public static GlobalReachConnectionProperties GlobalReachConnectionProperties(GlobalReachConnectionProvisioningState? provisioningState = null, string addressPrefix = null, string authorizationKey = null, GlobalReachConnectionStatus? circuitConnectionStatus = null, string peerExpressRouteCircuit = null, string expressRouteId = null) { - return new GlobalReachConnectionData( - id, - name, - resourceType, - systemData, + return new GlobalReachConnectionProperties( provisioningState, addressPrefix, authorizationKey, @@ -459,229 +316,182 @@ public static GlobalReachConnectionData GlobalReachConnectionData(ResourceIdenti /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. - /// The activation key. - /// The status of the HCX Enterprise Site. + /// The resource-specific properties for this resource. /// A new instance for mocking. - public static HcxEnterpriseSiteData HcxEnterpriseSiteData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, HcxEnterpriseSiteProvisioningState? provisioningState = null, string activationKey = null, HcxEnterpriseSiteStatus? status = null) + public static HcxEnterpriseSiteData HcxEnterpriseSiteData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, HcxEnterpriseSiteProperties properties = null) { return new HcxEnterpriseSiteData( id, name, resourceType, systemData, - provisioningState, - activationKey, - status, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The state of the iSCSI path provisioning. - /// CIDR Block for iSCSI path. - /// A new instance for mocking. - public static IscsiPathData IscsiPathData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IscsiPathProvisioningState? provisioningState = null, string networkBlock = null) - { - return new IscsiPathData( - id, - name, - resourceType, - systemData, - provisioningState, - networkBlock, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// NSX-T Manager username. - /// NSX-T Manager password. - /// vCenter admin username. - /// vCenter admin password. - /// A new instance for mocking. - public static AdminCredentials AdminCredentials(string nsxtUsername = null, string nsxtPassword = null, string vCenterUsername = null, string vCenterPassword = null) + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// The activation key. + /// The status of the HCX Enterprise Site. + /// A new instance for mocking. + public static HcxEnterpriseSiteProperties HcxEnterpriseSiteProperties(HcxEnterpriseSiteProvisioningState? provisioningState = null, string activationKey = null, HcxEnterpriseSiteStatus? status = null) { - return new AdminCredentials(nsxtUsername, nsxtPassword, vCenterUsername, vCenterPassword, serializedAdditionalRawData: null); + return new HcxEnterpriseSiteProperties(provisioningState, activationKey, status, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// A reference to the script cmdlet resource if user is running a AVS script. - /// - /// Parameters the script will accept - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - /// - /// Parameters that will be hidden/not visible to ARM, such as passwords and - /// credentials - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - /// - /// Error message if the script was able to run, but if the script itself had - /// errors or powershell threw an exception + /// + /// The resource-specific properties for this resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . /// - /// Time limit for execution. - /// Time to live for the resource. If not provided, will be available for 60 days. - /// Time the script execution was submitted. - /// Time the script execution was started. - /// Time the script execution was finished. - /// The state of the script execution resource. - /// Standard output stream from the powershell execution. - /// User-defined dictionary. - /// Standard information out stream from the powershell execution. - /// Standard warning out stream from the powershell execution. - /// Standard error output stream from the powershell execution. - /// A new instance for mocking. - public static ScriptExecutionData ScriptExecutionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier scriptCmdletId = null, IEnumerable parameters = null, IEnumerable hiddenParameters = null, string failureReason = null, string timeout = null, string retention = null, DateTimeOffset? submittedOn = null, DateTimeOffset? startedOn = null, DateTimeOffset? finishedOn = null, ScriptExecutionProvisioningState? provisioningState = null, IEnumerable output = null, BinaryData namedOutputs = null, IEnumerable information = null, IEnumerable warnings = null, IEnumerable errors = null) + /// The availability zones. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// A new instance for mocking. + public static HostData HostData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, HostProperties properties = null, IEnumerable zones = null, AvsSku sku = null) { - parameters ??= new List(); - hiddenParameters ??= new List(); - output ??= new List(); - information ??= new List(); - warnings ??= new List(); - errors ??= new List(); + zones ??= new List(); - return new ScriptExecutionData( + return new HostData( id, name, resourceType, systemData, - scriptCmdletId, - parameters?.ToList(), - hiddenParameters?.ToList(), - failureReason, - timeout, - retention, - submittedOn, - startedOn, - finishedOn, - provisioningState, - output?.ToList(), - namedOutputs, - information?.ToList(), - warnings?.ToList(), - errors?.ToList(), + properties, + zones?.ToList(), + sku, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The provisioning state of the resource. - /// User friendly description of the package. - /// Module version. - /// Company that created and supports the package. - /// Link to support by the package vendor. - /// A new instance for mocking. - public static ScriptPackageData ScriptPackageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ScriptPackageProvisioningState? provisioningState = null, string description = null, string version = null, string company = null, Uri uri = null) + /// Initializes a new instance of . + /// The kind of host. + /// The state of the host provisioning. + /// Display name of the host in VMware vCenter. + /// vCenter managed object reference ID of the host. + /// Fully qualified domain name of the host. + /// If provided, the host is in maintenance. The value is the reason for maintenance. + /// + /// A new instance for mocking. + public static HostProperties HostProperties(string kind = null, HostProvisioningState? provisioningState = null, string displayName = null, string moRefId = null, string fqdn = null, HostMaintenance? maintenance = null, string faultDomain = null) { - return new ScriptPackageData( - id, - name, - resourceType, - systemData, + return new UnknownHostProperties( + kind == null ? default : new HostKind(kind), provisioningState, - description, - version, - company, - uri, + displayName, + moRefId, + fqdn, + maintenance, + faultDomain, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The provisioning state of the resource. - /// Description of the scripts functionality. - /// Recommended time limit for execution. - /// Specifies whether a script cmdlet is intended to be invoked only through automation or visible to customers. - /// Parameters the script will accept. - /// A new instance for mocking. - public static ScriptCmdletData ScriptCmdletData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ScriptCmdletProvisioningState? provisioningState = null, string description = null, TimeSpan? timeout = null, ScriptCmdletAudience? audience = null, IEnumerable parameters = null) + /// Initializes a new instance of . + /// The state of the host provisioning. + /// Display name of the host in VMware vCenter. + /// vCenter managed object reference ID of the host. + /// Fully qualified domain name of the host. + /// If provided, the host is in maintenance. The value is the reason for maintenance. + /// + /// A new instance for mocking. + public static GeneralHostProperties GeneralHostProperties(HostProvisioningState? provisioningState = null, string displayName = null, string moRefId = null, string fqdn = null, HostMaintenance? maintenance = null, string faultDomain = null) { - parameters ??= new List(); - - return new ScriptCmdletData( - id, - name, - resourceType, - systemData, + return new GeneralHostProperties( + HostKind.General, provisioningState, - description, - timeout, - audience, - parameters?.ToList(), + displayName, + moRefId, + fqdn, + maintenance, + faultDomain, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// - /// The type of parameter the script is expecting. psCredential is a - /// PSCredentialObject - /// - /// The parameter name that the script will expect a parameter value for. - /// User friendly description of the parameter. - /// - /// Should this parameter be visible to arm and passed in the parameters argument - /// when executing - /// - /// Is this parameter required or optional. - /// A new instance for mocking. - public static ScriptParameter ScriptParameter(ScriptParameterType? parameterType = null, string name = null, string description = null, ParameterVisibilityStatus? visibility = null, ParameterOptionalityStatus? optional = null) + /// Initializes a new instance of . + /// The state of the host provisioning. + /// Display name of the host in VMware vCenter. + /// vCenter managed object reference ID of the host. + /// Fully qualified domain name of the host. + /// If provided, the host is in maintenance. The value is the reason for maintenance. + /// + /// A new instance for mocking. + public static SpecializedHostProperties SpecializedHostProperties(HostProvisioningState? provisioningState = null, string displayName = null, string moRefId = null, string fqdn = null, HostMaintenance? maintenance = null, string faultDomain = null) { - return new ScriptParameter( - parameterType, - name, - description, - visibility, - optional, + return new SpecializedHostProperties( + HostKind.Specialized, + provisioningState, + displayName, + moRefId, + fqdn, + maintenance, + faultDomain, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. - /// A new instance for mocking. - public static WorkloadNetworkData WorkloadNetworkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkProvisioningState? provisioningState = null) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static IscsiPathData IscsiPathData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IscsiPathProperties properties = null) { - return new WorkloadNetworkData( + return new IscsiPathData( id, name, resourceType, systemData, - provisioningState, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The state of the iSCSI path provisioning. + /// CIDR Block for iSCSI path. + /// A new instance for mocking. + public static IscsiPathProperties IscsiPathProperties(IscsiPathProvisioningState? provisioningState = null, string networkBlock = null) + { + return new IscsiPathProperties(provisioningState, networkBlock, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Trial status. + /// Number of trial hosts available. + /// A new instance for mocking. + public static Trial Trial(TrialStatus? status = null, int? availableHosts = null) + { + return new Trial(status, availableHosts, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Remaining hosts quota by sku type. + /// Host quota is active for current subscription. + /// A new instance for mocking. + public static Quota Quota(IReadOnlyDictionary hostsRemaining = null, QuotaEnabled? quotaEnabled = null) + { + hostsRemaining ??= new Dictionary(); + + return new Quota(hostsRemaining, quotaEnabled, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// /// The resource-specific properties for this resource. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . /// - /// A new instance for mocking. - public static WorkloadNetworkDhcpData WorkloadNetworkDhcpData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkDhcpEntity properties = null) + /// A new instance for mocking. + public static PlacementPolicyData PlacementPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PlacementPolicyProperties properties = null) { - return new WorkloadNetworkDhcpData( + return new PlacementPolicyData( id, name, resourceType, @@ -690,364 +500,646 @@ public static WorkloadNetworkDhcpData WorkloadNetworkDhcpData(ResourceIdentifier serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Type of DHCP: SERVER or RELAY. - /// Display name of the DHCP entity. - /// NSX Segments consuming DHCP. + /// Initializes a new instance of . + /// Placement Policy type. + /// Whether the placement policy is enabled or disabled. + /// Display name of the placement policy. /// The provisioning state. - /// NSX revision number. - /// A new instance for mocking. - public static WorkloadNetworkDhcpEntity WorkloadNetworkDhcpEntity(string dhcpType = null, string displayName = null, IEnumerable segments = null, WorkloadNetworkDhcpProvisioningState? provisioningState = null, long? revision = null) + /// A new instance for mocking. + public static PlacementPolicyProperties PlacementPolicyProperties(string type = null, PlacementPolicyState? state = null, string displayName = null, PlacementPolicyProvisioningState? provisioningState = null) { - segments ??= new List(); - - return new UnknownWorkloadNetworkDhcpEntity( - dhcpType == null ? default : new DhcpTypeEnum(dhcpType), - displayName, - segments?.ToList(), - provisioningState, - revision, - serializedAdditionalRawData: null); + return new UnknownPlacementPolicyProperties(type == null ? default : new PlacementPolicyType(type), state, displayName, provisioningState, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Display name of the DNS Service. - /// DNS service IP of the DNS Service. - /// Default DNS zone of the DNS Service. - /// FQDN zones of the DNS Service. - /// DNS Service log level. - /// DNS Service status. + /// Initializes a new instance of . + /// Whether the placement policy is enabled or disabled. + /// Display name of the placement policy. /// The provisioning state. - /// NSX revision number. - /// A new instance for mocking. - public static WorkloadNetworkDnsServiceData WorkloadNetworkDnsServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, IPAddress dnsServiceIP = null, string defaultDnsZone = null, IEnumerable fqdnZones = null, DnsServiceLogLevel? logLevel = null, DnsServiceStatus? status = null, WorkloadNetworkDnsServiceProvisioningState? provisioningState = null, long? revision = null) + /// Virtual machine members list. + /// placement policy affinity type. + /// A new instance for mocking. + public static VmVmPlacementPolicyProperties VmVmPlacementPolicyProperties(PlacementPolicyState? state = null, string displayName = null, PlacementPolicyProvisioningState? provisioningState = null, IEnumerable vmMembers = null, AffinityType affinityType = default) { - fqdnZones ??= new List(); + vmMembers ??= new List(); - return new WorkloadNetworkDnsServiceData( - id, - name, - resourceType, - systemData, + return new VmVmPlacementPolicyProperties( + PlacementPolicyType.VmVm, + state, displayName, - dnsServiceIP, - defaultDnsZone, - fqdnZones?.ToList(), - logLevel, - status, provisioningState, - revision, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Display name of the DNS Zone. - /// Domain names of the DNS Zone. - /// DNS Server IP array of the DNS Zone. - /// Source IP of the DNS Zone. - /// Number of DNS Services using the DNS zone. + serializedAdditionalRawData: null, + vmMembers?.ToList(), + affinityType); + } + + /// Initializes a new instance of . + /// Whether the placement policy is enabled or disabled. + /// Display name of the placement policy. /// The provisioning state. - /// NSX revision number. - /// A new instance for mocking. - public static WorkloadNetworkDnsZoneData WorkloadNetworkDnsZoneData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, IEnumerable domain = null, IEnumerable dnsServerIPs = null, IPAddress sourceIP = null, long? dnsServices = null, WorkloadNetworkDnsZoneProvisioningState? provisioningState = null, long? revision = null) + /// Virtual machine members list. + /// Host members list. + /// placement policy affinity type. + /// vm-host placement policy affinity strength (should/must). + /// placement policy azure hybrid benefit opt-in type. + /// A new instance for mocking. + public static VmHostPlacementPolicyProperties VmHostPlacementPolicyProperties(PlacementPolicyState? state = null, string displayName = null, PlacementPolicyProvisioningState? provisioningState = null, IEnumerable vmMembers = null, IEnumerable hostMembers = null, AffinityType affinityType = default, AffinityStrength? affinityStrength = null, AzureHybridBenefitType? azureHybridBenefitType = null) { - domain ??= new List(); - dnsServerIPs ??= new List(); + vmMembers ??= new List(); + hostMembers ??= new List(); - return new WorkloadNetworkDnsZoneData( - id, - name, - resourceType, - systemData, + return new VmHostPlacementPolicyProperties( + PlacementPolicyType.VmHost, + state, displayName, - domain?.ToList(), - dnsServerIPs?.ToList(), - sourceIP, - dnsServices, provisioningState, - revision, - serializedAdditionalRawData: null); + serializedAdditionalRawData: null, + vmMembers?.ToList(), + hostMembers?.ToList(), + affinityType, + affinityStrength, + azureHybridBenefitType); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. - /// Display name of the DHCP entity. - /// NSX Gateway Path. - /// A new instance for mocking. - public static WorkloadNetworkGatewayData WorkloadNetworkGatewayData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkProvisioningState? provisioningState = null, string displayName = null, string path = null) + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. + /// The availability zones. + /// A new instance for mocking. + public static PrivateCloudData PrivateCloudData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, PrivateCloudProperties properties = null, AvsSku sku = null, ManagedServiceIdentity identity = null, IEnumerable zones = null) { - return new WorkloadNetworkGatewayData( + tags ??= new Dictionary(); + zones ??= new List(); + + return new PrivateCloudData( id, name, resourceType, systemData, + tags, + location, + properties, + sku, + identity, + zones?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The default cluster used for management. + /// Connectivity to internet is enabled or disabled. + /// vCenter Single Sign On Identity Sources. + /// Properties describing how the cloud is distributed across availability zones. + /// Customer managed key encryption, can be enabled or disabled. + /// + /// Array of additional networks noncontiguous with networkBlock. Networks must be + /// unique and non-overlapping across VNet in your subscription, on-premise, and + /// this privateCloud networkBlock attribute. Make sure the CIDR format conforms to + /// (A.B.C.D/X). + /// + /// The provisioning state. + /// An ExpressRoute Circuit. + /// The endpoints. + /// + /// The block of addresses should be unique across VNet in your subscription as + /// well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where + /// A,B,C,D are between 0 and 255, and X is between 0 and 22 + /// + /// Network used to access vCenter Server and NSX-T Manager. + /// Used for virtual machine cold migration, cloning, and snapshot migration. + /// Used for live migration of virtual machines. + /// Optionally, set the vCenter admin password when the private cloud is created. + /// Optionally, set the NSX-T Manager password when the private cloud is created. + /// Thumbprint of the vCenter Server SSL certificate. + /// Thumbprint of the NSX-T Manager SSL certificate. + /// Array of cloud link IDs from other clouds that connect to this one. + /// + /// A secondary expressRoute circuit from a separate AZ. Only present in a + /// stretched private cloud + /// + /// + /// Flag to indicate whether the private cloud has the quota for provisioned NSX + /// Public IP count raised from 64 to 1024 + /// + /// Azure resource ID of the virtual network. + /// The type of DNS zone to use. + /// A new instance for mocking. + public static PrivateCloudProperties PrivateCloudProperties(ManagementCluster managementCluster = null, InternetEnum? internet = null, IEnumerable identitySources = null, AvailabilityProperties availability = null, Encryption encryption = null, IEnumerable extendedNetworkBlocks = null, PrivateCloudProvisioningState? provisioningState = null, Circuit circuit = null, Endpoints endpoints = null, string networkBlock = null, string managementNetwork = null, string provisioningNetwork = null, string vmotionNetwork = null, string vcenterPassword = null, string nsxtPassword = null, string vcenterCertificateThumbprint = null, string nsxtCertificateThumbprint = null, IEnumerable externalCloudLinks = null, Circuit secondaryCircuit = null, NsxPublicIPQuotaRaisedEnum? nsxPublicIPQuotaRaised = null, ResourceIdentifier virtualNetworkId = null, DnsZoneType? dnsZoneType = null) + { + identitySources ??= new List(); + extendedNetworkBlocks ??= new List(); + externalCloudLinks ??= new List(); + + return new PrivateCloudProperties( + managementCluster, + internet, + identitySources?.ToList(), + availability, + encryption, + extendedNetworkBlocks?.ToList(), provisioningState, - displayName, - path, + circuit, + endpoints, + networkBlock, + managementNetwork, + provisioningNetwork, + vmotionNetwork, + vcenterPassword, + nsxtPassword, + vcenterCertificateThumbprint, + nsxtCertificateThumbprint, + externalCloudLinks?.ToList(), + secondaryCircuit, + nsxPublicIPQuotaRaised, + virtualNetworkId, + dnsZoneType, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The cluster size. + /// The state of the cluster provisioning. + /// The identity. + /// The hosts. + /// Name of the vsan datastore associated with the cluster. + /// A new instance for mocking. + public static ManagementCluster ManagementCluster(int? clusterSize = null, ClusterProvisioningState? provisioningState = null, int? clusterId = null, IEnumerable hosts = null, string vsanDatastoreName = null) + { + hosts ??= new List(); + + return new ManagementCluster( + clusterSize, + provisioningState, + clusterId, + hosts?.ToList(), + vsanDatastoreName, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the key. + /// The version of the key. + /// The auto-detected version of the key if versionType is auto-detected. + /// The URL of the vault. + /// The state of key provided. + /// Property of the key if user provided or auto detected. + /// A new instance for mocking. + public static EncryptionKeyVaultProperties EncryptionKeyVaultProperties(string keyName = null, string keyVersion = null, string autoDetectedKeyVersion = null, string keyVaultUri = null, EncryptionKeyStatus? keyState = null, EncryptionVersionType? versionType = null) + { + return new EncryptionKeyVaultProperties( + keyName, + keyVersion, + autoDetectedKeyVersion, + keyVaultUri, + keyState, + versionType, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// CIDR of primary subnet. + /// CIDR of secondary subnet. + /// Identifier of the ExpressRoute Circuit (Microsoft Colo only). + /// ExpressRoute Circuit private peering identifier. + /// A new instance for mocking. + public static Circuit Circuit(string primarySubnet = null, string secondarySubnet = null, string expressRouteId = null, string expressRoutePrivatePeeringId = null) + { + return new Circuit(primarySubnet, secondarySubnet, expressRouteId, expressRoutePrivatePeeringId, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Endpoint FQDN for the NSX-T Data Center manager. + /// Endpoint FQDN for Virtual Center Server Appliance. + /// Endpoint FQDN for the HCX Cloud Manager. + /// Endpoint IP for the NSX-T Data Center manager. + /// Endpoint IP for Virtual Center Server Appliance. + /// Endpoint IP for the HCX Cloud Manager. + /// A new instance for mocking. + public static Endpoints Endpoints(string nsxtManager = null, string vcsa = null, string hcxCloudManager = null, string nsxtManagerIP = null, string vcenterIP = null, string hcxCloudManagerIP = null) + { + return new Endpoints( + nsxtManager, + vcsa, + hcxCloudManager, + nsxtManagerIP, + vcenterIP, + hcxCloudManagerIP, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// NSX-T Manager username. + /// NSX-T Manager password. + /// vCenter admin username. + /// vCenter admin password. + /// A new instance for mocking. + public static AdminCredentials AdminCredentials(string nsxtUsername = null, string nsxtPassword = null, string vcenterUsername = null, string vcenterPassword = null) + { + return new AdminCredentials(nsxtUsername, nsxtPassword, vcenterUsername, vcenterPassword, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Display name of the port mirroring profile. - /// Direction of port mirroring profile. - /// Source VM Group. - /// Destination VM Group. - /// Port Mirroring Status. - /// The provisioning state. - /// NSX revision number. - /// A new instance for mocking. - public static WorkloadNetworkPortMirroringProfileData WorkloadNetworkPortMirroringProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, PortMirroringProfileDirection? direction = null, string source = null, string destination = null, PortMirroringProfileStatus? status = null, WorkloadNetworkPortMirroringProfileProvisioningState? provisioningState = null, long? revision = null) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ProvisionedNetworkData ProvisionedNetworkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProvisionedNetworkProperties properties = null) { - return new WorkloadNetworkPortMirroringProfileData( + return new ProvisionedNetworkData( id, name, resourceType, systemData, - displayName, - direction, - source, - destination, - status, - provisioningState, - revision, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// The address prefixes of the provisioned network in CIDR notation. + /// The type of network provisioned. + /// A new instance for mocking. + public static ProvisionedNetworkProperties ProvisionedNetworkProperties(ProvisionedNetworkProvisioningState? provisioningState = null, string addressPrefix = null, ProvisionedNetworkType? networkType = null) + { + return new ProvisionedNetworkProperties(provisioningState, addressPrefix, networkType, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Display name of the Public IP Block. - /// Number of Public IPs requested. - /// CIDR Block of the Public IP Block. - /// The provisioning state. - /// A new instance for mocking. - public static WorkloadNetworkPublicIPData WorkloadNetworkPublicIPData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, long? numberOfPublicIPs = null, string publicIPBlock = null, WorkloadNetworkPublicIPProvisioningState? provisioningState = null) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static PureStoragePolicyData PureStoragePolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PureStoragePolicyProperties properties = null) { - return new WorkloadNetworkPublicIPData( + return new PureStoragePolicyData( id, name, resourceType, systemData, - displayName, - numberOfPublicIPs, - publicIPBlock, - provisioningState, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// Definition of a Pure Storage Policy Based Management policy. + /// Azure resource ID of the Pure Storage Pool associated with the storage policy. + /// The state of the Pure Storage Policy Based Management policy provisioning. + /// A new instance for mocking. + public static PureStoragePolicyProperties PureStoragePolicyProperties(string storagePolicyDefinition = null, string storagePoolId = null, PureStoragePolicyProvisioningState? provisioningState = null) + { + return new PureStoragePolicyProperties(storagePolicyDefinition, storagePoolId, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Display name of the segment. - /// Gateway which to connect segment to. - /// Subnet which to connect segment to. - /// Port Vif which segment is associated with. - /// Segment status. - /// The provisioning state. - /// NSX revision number. - /// A new instance for mocking. - public static WorkloadNetworkSegmentData WorkloadNetworkSegmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, string connectedGateway = null, WorkloadNetworkSegmentSubnet subnet = null, IEnumerable portVif = null, WorkloadNetworkSegmentStatus? status = null, WorkloadNetworkSegmentProvisioningState? provisioningState = null, long? revision = null) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ScriptCmdletData ScriptCmdletData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ScriptCmdletProperties properties = null) { - portVif ??= new List(); - - return new WorkloadNetworkSegmentData( + return new ScriptCmdletData( id, name, resourceType, systemData, - displayName, - connectedGateway, - subnet, - portVif?.ToList(), - status, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// Description of the scripts functionality. + /// Recommended time limit for execution. + /// Specifies whether a script cmdlet is intended to be invoked only through automation or visible to customers. + /// Parameters the script will accept. + /// A new instance for mocking. + public static ScriptCmdletProperties ScriptCmdletProperties(ScriptCmdletProvisioningState? provisioningState = null, string description = null, string timeout = null, ScriptCmdletAudience? audience = null, IEnumerable parameters = null) + { + parameters ??= new List(); + + return new ScriptCmdletProperties( provisioningState, - revision, + description, + timeout, + audience, + parameters?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Name of port or VIF attached to segment. - /// A new instance for mocking. - public static WorkloadNetworkSegmentPortVif WorkloadNetworkSegmentPortVif(string portName = null) + /// Initializes a new instance of . + /// + /// The type of parameter the script is expecting. psCredential is a + /// PSCredentialObject + /// + /// The parameter name that the script will expect a parameter value for. + /// User friendly description of the parameter. + /// + /// Should this parameter be visible to arm and passed in the parameters argument + /// when executing + /// + /// Is this parameter required or optional. + /// A new instance for mocking. + public static ScriptParameter ScriptParameter(ScriptParameterType? type = null, string name = null, string description = null, VisibilityParameterEnum? visibility = null, OptionalParamEnum? optional = null) { - return new WorkloadNetworkSegmentPortVif(portName, serializedAdditionalRawData: null); + return new ScriptParameter( + type, + name, + description, + visibility, + optional, + serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. - /// Display name of the VM. - /// Virtual machine type. - /// A new instance for mocking. - public static WorkloadNetworkVirtualMachineData WorkloadNetworkVirtualMachineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkProvisioningState? provisioningState = null, string displayName = null, WorkloadNetworkVmType? vmType = null) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ScriptExecutionData ScriptExecutionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ScriptExecutionProperties properties = null) { - return new WorkloadNetworkVirtualMachineData( + return new ScriptExecutionData( id, name, resourceType, systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// A reference to the script cmdlet resource if user is running a AVS script. + /// + /// Parameters the script will accept + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// + /// Parameters that will be hidden/not visible to ARM, such as passwords and + /// credentials + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// + /// Error message if the script was able to run, but if the script itself had + /// errors or powershell threw an exception + /// + /// Time limit for execution. + /// Time to live for the resource. If not provided, will be available for 60 days. + /// Time the script execution was submitted. + /// Time the script execution was started. + /// Time the script execution was finished. + /// The state of the script execution resource. + /// Standard output stream from the powershell execution. + /// User-defined dictionary. + /// Standard information out stream from the powershell execution. + /// Standard warning out stream from the powershell execution. + /// Standard error output stream from the powershell execution. + /// A new instance for mocking. + public static ScriptExecutionProperties ScriptExecutionProperties(string scriptCmdletId = null, IEnumerable parameters = null, IEnumerable hiddenParameters = null, string failureReason = null, string timeout = null, string retention = null, DateTimeOffset? submittedOn = null, DateTimeOffset? startedOn = null, DateTimeOffset? finishedOn = null, ScriptExecutionProvisioningState? provisioningState = null, IEnumerable output = null, IDictionary namedOutputs = null, IEnumerable information = null, IEnumerable warnings = null, IEnumerable errors = null) + { + parameters ??= new List(); + hiddenParameters ??= new List(); + output ??= new List(); + namedOutputs ??= new Dictionary(); + information ??= new List(); + warnings ??= new List(); + errors ??= new List(); + + return new ScriptExecutionProperties( + scriptCmdletId, + parameters?.ToList(), + hiddenParameters?.ToList(), + failureReason, + timeout, + retention, + submittedOn, + startedOn, + finishedOn, provisioningState, - displayName, - vmType, + output?.ToList(), + namedOutputs, + information?.ToList(), + warnings?.ToList(), + errors?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Display name of the VM group. - /// Virtual machine members of this group. - /// VM Group status. - /// The provisioning state. - /// NSX revision number. - /// A new instance for mocking. - public static WorkloadNetworkVmGroupData WorkloadNetworkVmGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, IEnumerable members = null, WorkloadNetworkVmGroupStatus? status = null, WorkloadNetworkVmGroupProvisioningState? provisioningState = null, long? revision = null) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ScriptPackageData ScriptPackageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ScriptPackageProperties properties = null) { - members ??= new List(); - - return new WorkloadNetworkVmGroupData( + return new ScriptPackageData( id, name, resourceType, systemData, - displayName, - members?.ToList(), - status, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// User friendly description of the package. + /// Module version. + /// Company that created and supports the package. + /// Link to support by the package vendor. + /// A new instance for mocking. + public static ScriptPackageProperties ScriptPackageProperties(ScriptPackageProvisioningState? provisioningState = null, string description = null, string version = null, string company = null, string uri = null) + { + return new ScriptPackageProperties( provisioningState, - revision, + description, + version, + company, + uri, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The state of the addon provisioning. - /// The VMware vCenter resource ID. - /// A new instance for mocking. - public static AddonArcProperties AddonArcProperties(AddonProvisioningState? provisioningState = null, string vCenter = null) + /// Initializes a new instance of . + /// The type of resource the SKU applies to. + /// The name of the SKU. + /// The tier of virtual machines in a scale set. + /// The size of the SKU. + /// The family of the SKU. + /// The set of locations that the SKU is available. + /// A list of locations and availability zones in those locations where the SKU is available. + /// Name value pairs to describe the capability. + /// The restrictions of the SKU. + /// A new instance for mocking. + public static ResourceSku ResourceSku(ResourceSkuResourceType resourceType = default, string name = null, string tier = null, string size = null, string family = null, IEnumerable locations = null, IEnumerable locationInfo = null, IEnumerable capabilities = null, IEnumerable restrictions = null) { - return new AddonArcProperties(AddonType.Arc, provisioningState, serializedAdditionalRawData: null, vCenter); + locations ??= new List(); + locationInfo ??= new List(); + capabilities ??= new List(); + restrictions ??= new List(); + + return new ResourceSku( + resourceType, + name, + tier, + size, + family, + locations?.ToList(), + locationInfo?.ToList(), + capabilities?.ToList(), + restrictions?.ToList(), + serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The state of the addon provisioning. - /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). - /// A new instance for mocking. - public static AddonHcxProperties AddonHcxProperties(AddonProvisioningState? provisioningState = null, string offer = null) + /// Initializes a new instance of . + /// Location of the SKU. + /// List of availability zones where the SKU is supported. + /// Gets details of capabilities available to a SKU in specific zones. + /// A new instance for mocking. + public static ResourceSkuLocationInfo ResourceSkuLocationInfo(AzureLocation location = default, IEnumerable zones = null, IEnumerable zoneDetails = null) { - return new AddonHcxProperties(AddonType.HCX, provisioningState, serializedAdditionalRawData: null, offer); + zones ??= new List(); + zoneDetails ??= new List(); + + return new ResourceSkuLocationInfo(location, zones?.ToList(), zoneDetails?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The state of the addon provisioning. - /// The Site Recovery Manager (SRM) license. - /// A new instance for mocking. - public static AddonSrmProperties AddonSrmProperties(AddonProvisioningState? provisioningState = null, string licenseKey = null) + /// Initializes a new instance of . + /// Gets the set of zones that the SKU is available in with the specified capabilities. + /// A list of capabilities that are available for the SKU in the specified list of zones. + /// A new instance for mocking. + public static ResourceSkuZoneDetails ResourceSkuZoneDetails(IEnumerable name = null, IEnumerable capabilities = null) { - return new AddonSrmProperties(AddonType.SRM, provisioningState, serializedAdditionalRawData: null, licenseKey); + name ??= new List(); + capabilities ??= new List(); + + return new ResourceSkuZoneDetails(name?.ToList(), capabilities?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The state of the addon provisioning. - /// The vSphere Replication Server (VRS) count. - /// A new instance for mocking. - public static AddonVrProperties AddonVrProperties(AddonProvisioningState? provisioningState = null, int vrsCount = default) + /// Initializes a new instance of . + /// The name of the SKU capability. + /// The value of the SKU capability. + /// A new instance for mocking. + public static ResourceSkuCapabilities ResourceSkuCapabilities(string name = null, string value = null) { - return new AddonVrProperties(AddonType.VR, provisioningState, serializedAdditionalRawData: null, vrsCount); + return new ResourceSkuCapabilities(name, value, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Whether the placement policy is enabled or disabled. - /// Display name of the placement policy. - /// The provisioning state. - /// Virtual machine members list. - /// Host members list. - /// placement policy affinity type. - /// vm-host placement policy affinity strength (should/must). - /// placement policy azure hybrid benefit opt-in type. - /// A new instance for mocking. - public static VmHostPlacementPolicyProperties VmHostPlacementPolicyProperties(PlacementPolicyState? state = null, string displayName = null, PlacementPolicyProvisioningState? provisioningState = null, IEnumerable vmMembers = null, IEnumerable hostMembers = null, AvsPlacementPolicyAffinityType affinityType = default, VmHostPlacementPolicyAffinityStrength? affinityStrength = null, AzureHybridBenefitType? azureHybridBenefitType = null) + /// Initializes a new instance of . + /// the type of restrictions. + /// The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. + /// The information about the restriction where the SKU cannot be used. + /// the reason for restriction. + /// A new instance for mocking. + public static ResourceSkuRestrictions ResourceSkuRestrictions(ResourceSkuRestrictionsType? type = null, IEnumerable values = null, ResourceSkuRestrictionInfo restrictionInfo = null, ResourceSkuRestrictionsReasonCode? reasonCode = null) { - vmMembers ??= new List(); - hostMembers ??= new List(); + values ??= new List(); - return new VmHostPlacementPolicyProperties( - PlacementPolicyType.VmHost, - state, - displayName, - provisioningState, - serializedAdditionalRawData: null, - vmMembers?.ToList(), - hostMembers?.ToList(), - affinityType, - affinityStrength, - azureHybridBenefitType); + return new ResourceSkuRestrictions(type, values?.ToList(), restrictionInfo, reasonCode, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Whether the placement policy is enabled or disabled. - /// Display name of the placement policy. - /// The provisioning state. - /// Virtual machine members list. - /// placement policy affinity type. - /// A new instance for mocking. - public static VmPlacementPolicyProperties VmPlacementPolicyProperties(PlacementPolicyState? state = null, string displayName = null, PlacementPolicyProvisioningState? provisioningState = null, IEnumerable vmMembers = null, AvsPlacementPolicyAffinityType affinityType = default) + /// Initializes a new instance of . + /// Locations where the SKU is restricted. + /// List of availability zones where the SKU is restricted. + /// A new instance for mocking. + public static ResourceSkuRestrictionInfo ResourceSkuRestrictionInfo(IEnumerable locations = null, IEnumerable zones = null) { - vmMembers ??= new List(); + locations ??= new List(); + zones ??= new List(); - return new VmPlacementPolicyProperties( - PlacementPolicyType.VmVm, - state, - displayName, + return new ResourceSkuRestrictionInfo(locations?.ToList(), zones?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static VirtualMachineData VirtualMachineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, VirtualMachineProperties properties = null) + { + return new VirtualMachineData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// Display name of the VM. + /// vCenter managed object reference ID of the virtual machine. + /// Path to virtual machine's folder starting from datacenter virtual machine folder. + /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). + /// A new instance for mocking. + public static VirtualMachineProperties VirtualMachineProperties(VirtualMachineProvisioningState? provisioningState = null, string displayName = null, string moRefId = null, string folderPath = null, VirtualMachineRestrictMovementState? restrictMovement = null) + { + return new VirtualMachineProperties( provisioningState, - serializedAdditionalRawData: null, - vmMembers?.ToList(), - affinityType); + displayName, + moRefId, + folderPath, + restrictMovement, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// The resource-specific properties for this resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static WorkloadNetworkDhcp WorkloadNetworkDhcp(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkDhcpEntity properties = null) + { + return new WorkloadNetworkDhcp( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// Type of DHCP: SERVER or RELAY. /// Display name of the DHCP entity. /// NSX Segments consuming DHCP. /// The provisioning state. /// NSX revision number. - /// DHCP Relay Addresses. Max 3. - /// A new instance for mocking. - public static WorkloadNetworkDhcpRelay WorkloadNetworkDhcpRelay(string displayName = null, IEnumerable segments = null, WorkloadNetworkDhcpProvisioningState? provisioningState = null, long? revision = null, IEnumerable serverAddresses = null) + /// A new instance for mocking. + public static WorkloadNetworkDhcpEntity WorkloadNetworkDhcpEntity(string dhcpType = null, string displayName = null, IEnumerable segments = null, WorkloadNetworkDhcpProvisioningState? provisioningState = null, long? revision = null) { segments ??= new List(); - serverAddresses ??= new List(); - return new WorkloadNetworkDhcpRelay( - DhcpTypeEnum.Relay, + return new UnknownWorkloadNetworkDhcpEntity( + dhcpType == null ? default : new DhcpTypeEnum(dhcpType), displayName, segments?.ToList(), provisioningState, revision, - serializedAdditionalRawData: null, - serverAddresses?.ToList()); + serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -1063,7 +1155,7 @@ public static WorkloadNetworkDhcpServer WorkloadNetworkDhcpServer(string display segments ??= new List(); return new WorkloadNetworkDhcpServer( - DhcpTypeEnum.Server, + DhcpTypeEnum.SERVER, displayName, segments?.ToList(), provisioningState, @@ -1073,158 +1165,344 @@ public static WorkloadNetworkDhcpServer WorkloadNetworkDhcpServer(string display leaseTime); } - /// Initializes a new instance of . - /// Endpoint for the NSX-T Data Center manager. - /// Endpoint for Virtual Center Server Appliance. - /// Endpoint for the HCX Cloud Manager. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static AvsPrivateCloudEndpoints AvsPrivateCloudEndpoints(string nsxtManager, string vcsa, string hcxCloudManager) + /// Initializes a new instance of . + /// Display name of the DHCP entity. + /// NSX Segments consuming DHCP. + /// The provisioning state. + /// NSX revision number. + /// DHCP Relay Addresses. Max 3. + /// A new instance for mocking. + public static WorkloadNetworkDhcpRelay WorkloadNetworkDhcpRelay(string displayName = null, IEnumerable segments = null, WorkloadNetworkDhcpProvisioningState? provisioningState = null, long? revision = null, IEnumerable serverAddresses = null) { - return AvsPrivateCloudEndpoints(nsxtManager: nsxtManager, vcsa: vcsa, hcxCloudManager: hcxCloudManager, nsxtManagerIP: default, vcenterIP: default, hcxCloudManagerIP: default); - } + segments ??= new List(); + serverAddresses ??= new List(); - /// Initializes a new instance of . - /// The cluster size. - /// The state of the cluster provisioning. - /// The identity. - /// The hosts. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static AvsManagementCluster AvsManagementCluster(int? clusterSize, AvsPrivateCloudClusterProvisioningState? provisioningState, int? clusterId, IEnumerable hosts) - { - return AvsManagementCluster(clusterSize: clusterSize, provisioningState: provisioningState, clusterId: clusterId, hosts: hosts, vsanDatastoreName: default); + return new WorkloadNetworkDhcpRelay( + DhcpTypeEnum.RELAY, + displayName, + segments?.ToList(), + provisioningState, + revision, + serializedAdditionalRawData: null, + serverAddresses?.ToList()); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The state of the datastore provisioning. - /// An Azure NetApp Files volume. - /// An iSCSI volume. - /// The operational status of the datastore. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static AvsPrivateCloudDatastoreData AvsPrivateCloudDatastoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsPrivateCloudDatastoreProvisioningState? provisioningState, ResourceIdentifier netAppVolumeId, DiskPoolVolume diskPoolVolume, DatastoreStatus? status) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static WorkloadNetworkDnsService WorkloadNetworkDnsService(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkDnsServiceProperties properties = null) + { + return new WorkloadNetworkDnsService( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display name of the DNS Service. + /// DNS service IP of the DNS Service. + /// Default DNS zone of the DNS Service. + /// FQDN zones of the DNS Service. + /// DNS Service log level. + /// DNS Service status. + /// The provisioning state. + /// NSX revision number. + /// A new instance for mocking. + public static WorkloadNetworkDnsServiceProperties WorkloadNetworkDnsServiceProperties(string displayName = null, string dnsServiceIP = null, string defaultDnsZone = null, IEnumerable fqdnZones = null, DnsServiceLogLevelEnum? logLevel = null, DnsServiceStatusEnum? status = null, WorkloadNetworkDnsServiceProvisioningState? provisioningState = null, long? revision = null) { - return AvsPrivateCloudDatastoreData(id: id, name: name, resourceType: resourceType, systemData: systemData, provisioningState: provisioningState, netAppVolumeId: netAppVolumeId, diskPoolVolume: diskPoolVolume, elasticSanVolumeTargetId: default, status: status); + fqdnZones ??= new List(); + + return new WorkloadNetworkDnsServiceProperties( + displayName, + dnsServiceIP, + defaultDnsZone, + fqdnZones?.ToList(), + logLevel, + status, + provisioningState, + revision, + serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The activation key. - /// The status of the HCX Enterprise Site. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static HcxEnterpriseSiteData HcxEnterpriseSiteData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string activationKey, HcxEnterpriseSiteStatus? status) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static WorkloadNetworkDnsZone WorkloadNetworkDnsZone(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkDnsZoneProperties properties = null) + { + return new WorkloadNetworkDnsZone( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display name of the DNS Zone. + /// Domain names of the DNS Zone. + /// DNS Server IP array of the DNS Zone. + /// Source IP of the DNS Zone. + /// Number of DNS Services using the DNS zone. + /// The provisioning state. + /// NSX revision number. + /// A new instance for mocking. + public static WorkloadNetworkDnsZoneProperties WorkloadNetworkDnsZoneProperties(string displayName = null, IEnumerable domain = null, IEnumerable dnsServerIPs = null, string sourceIP = null, long? dnsServices = null, WorkloadNetworkDnsZoneProvisioningState? provisioningState = null, long? revision = null) { - return HcxEnterpriseSiteData(id: id, name: name, resourceType: resourceType, systemData: systemData, provisioningState: default, activationKey: activationKey, status: status); + domain ??= new List(); + dnsServerIPs ??= new List(); + + return new WorkloadNetworkDnsZoneProperties( + displayName, + domain?.ToList(), + dnsServerIPs?.ToList(), + sourceIP, + dnsServices, + provisioningState, + revision, + serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static WorkloadNetworkData WorkloadNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static WorkloadNetworkGatewayData WorkloadNetworkGatewayData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkGatewayProperties properties = null) + { + return new WorkloadNetworkGatewayData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// Display name of the DHCP entity. + /// NSX Gateway Path. + /// A new instance for mocking. + public static WorkloadNetworkGatewayProperties WorkloadNetworkGatewayProperties(WorkloadNetworkProvisioningState? provisioningState = null, string displayName = null, string path = null) { - return WorkloadNetworkData(id: id, name: name, resourceType: resourceType, systemData: systemData, provisioningState: default); + return new WorkloadNetworkGatewayProperties(provisioningState, displayName, path, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Display name of the DHCP entity. - /// NSX Gateway Path. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static WorkloadNetworkGatewayData WorkloadNetworkGatewayData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string path) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static WorkloadNetworkPortMirroring WorkloadNetworkPortMirroring(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkPortMirroringProperties properties = null) + { + return new WorkloadNetworkPortMirroring( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display name of the port mirroring profile. + /// Direction of port mirroring profile. + /// Source VM Group. + /// Destination VM Group. + /// Port Mirroring Status. + /// The provisioning state. + /// NSX revision number. + /// A new instance for mocking. + public static WorkloadNetworkPortMirroringProperties WorkloadNetworkPortMirroringProperties(string displayName = null, PortMirroringDirectionEnum? direction = null, string source = null, string destination = null, PortMirroringStatusEnum? status = null, WorkloadNetworkPortMirroringProvisioningState? provisioningState = null, long? revision = null) { - return WorkloadNetworkGatewayData(id: id, name: name, resourceType: resourceType, systemData: systemData, provisioningState: default, displayName: displayName, path: path); + return new WorkloadNetworkPortMirroringProperties( + displayName, + direction, + source, + destination, + status, + provisioningState, + revision, + serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Display name of the VM. - /// Virtual machine type. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static WorkloadNetworkVirtualMachineData WorkloadNetworkVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, WorkloadNetworkVmType? vmType) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static WorkloadNetworkPublicIP WorkloadNetworkPublicIP(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkPublicIPProperties properties = null) + { + return new WorkloadNetworkPublicIP( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display name of the Public IP Block. + /// Number of Public IPs requested. + /// CIDR Block of the Public IP Block. + /// The provisioning state. + /// A new instance for mocking. + public static WorkloadNetworkPublicIPProperties WorkloadNetworkPublicIPProperties(string displayName = null, long? numberOfPublicIPs = null, string publicIPBlock = null, WorkloadNetworkPublicIPProvisioningState? provisioningState = null) { - return WorkloadNetworkVirtualMachineData(id: id, name: name, resourceType: resourceType, systemData: systemData, provisioningState: default, displayName: displayName, vmType: vmType); + return new WorkloadNetworkPublicIPProperties(displayName, numberOfPublicIPs, publicIPBlock, provisioningState, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The state of the cloud link. - /// Identifier of the other private cloud participating in the link. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static AvsCloudLinkData AvsCloudLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsCloudLinkStatus? status, ResourceIdentifier linkedCloud) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static WorkloadNetworkSegmentData WorkloadNetworkSegmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkSegmentProperties properties = null) + { + return new WorkloadNetworkSegmentData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display name of the segment. + /// Gateway which to connect segment to. + /// Subnet which to connect segment to. + /// Port Vif which segment is associated with. + /// Segment status. + /// The provisioning state. + /// NSX revision number. + /// A new instance for mocking. + public static WorkloadNetworkSegmentProperties WorkloadNetworkSegmentProperties(string displayName = null, string connectedGateway = null, WorkloadNetworkSegmentSubnet subnet = null, IEnumerable portVif = null, SegmentStatusEnum? status = null, WorkloadNetworkSegmentProvisioningState? provisioningState = null, long? revision = null) + { + portVif ??= new List(); + + return new WorkloadNetworkSegmentProperties( + displayName, + connectedGateway, + subnet, + portVif?.ToList(), + status, + provisioningState, + revision, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of port or VIF attached to segment. + /// A new instance for mocking. + public static WorkloadNetworkSegmentPortVif WorkloadNetworkSegmentPortVif(string portName = null) { - return AvsCloudLinkData(id: id, name: name, resourceType: resourceType, systemData: systemData, provisioningState: default, status: status, linkedCloud: linkedCloud); + return new WorkloadNetworkSegmentPortVif(portName, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static WorkloadNetworkVirtualMachineData WorkloadNetworkVirtualMachineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkVirtualMachineProperties properties = null) + { + return new WorkloadNetworkVirtualMachineData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. /// Display name of the VM. - /// Virtual machine managed object reference id. - /// Path to virtual machine's folder starting from datacenter virtual machine folder. - /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static AvsPrivateCloudClusterVirtualMachineData AvsPrivateCloudClusterVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string moRefId, string folderPath, VirtualMachineRestrictMovementState? restrictMovement) + /// Virtual machine type. + /// A new instance for mocking. + public static WorkloadNetworkVirtualMachineProperties WorkloadNetworkVirtualMachineProperties(WorkloadNetworkProvisioningState? provisioningState = null, string displayName = null, VmTypeEnum? vmType = null) { - return AvsPrivateCloudClusterVirtualMachineData(id: id, name: name, resourceType: resourceType, systemData: systemData, provisioningState: default, displayName: displayName, moRefId: moRefId, folderPath: folderPath, restrictMovement: restrictMovement); + return new WorkloadNetworkVirtualMachineProperties(provisioningState, displayName, vmType, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// User friendly description of the package. - /// Module version. - /// Company that created and supports the package. - /// Link to support by the package vendor. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static ScriptPackageData ScriptPackageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, string version, string company, Uri uri) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static WorkloadNetworkVmGroup WorkloadNetworkVmGroup(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkVmGroupProperties properties = null) + { + return new WorkloadNetworkVmGroup( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display name of the VM group. + /// Virtual machine members of this group. + /// VM Group status. + /// The provisioning state. + /// NSX revision number. + /// A new instance for mocking. + public static WorkloadNetworkVmGroupProperties WorkloadNetworkVmGroupProperties(string displayName = null, IEnumerable members = null, VmGroupStatusEnum? status = null, WorkloadNetworkVmGroupProvisioningState? provisioningState = null, long? revision = null) { - return ScriptPackageData(id: id, name: name, resourceType: resourceType, systemData: systemData, provisioningState: default, description: description, version: version, company: company, uri: uri); + members ??= new List(); + + return new WorkloadNetworkVmGroupProperties( + displayName, + members?.ToList(), + status, + provisioningState, + revision, + serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Description of the scripts functionality. - /// Recommended time limit for execution. - /// Parameters the script will accept. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static ScriptCmdletData ScriptCmdletData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, TimeSpan? timeout, IEnumerable parameters) + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static WorkloadNetworkData WorkloadNetworkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadNetworkProvisioningState? workloadNetworkProvisioningState = null) { - return ScriptCmdletData(id: id, name: name, resourceType: resourceType, systemData: systemData, provisioningState: default, description: description, timeout: timeout, audience: default, parameters: parameters); + return new WorkloadNetworkData( + id, + name, + resourceType, + systemData, + workloadNetworkProvisioningState != null ? new WorkloadNetworkProperties(workloadNetworkProvisioningState, serializedAdditionalRawData: null) : null, + serializedAdditionalRawData: null); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkResource.Serialization.cs deleted file mode 100644 index 8e3357bd28bf..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class AvsCloudLinkResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - AvsCloudLinkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - AvsCloudLinkData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonResource.Serialization.cs deleted file mode 100644 index ae365b94e793..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class AvsPrivateCloudAddonResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - AvsPrivateCloudAddonData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - AvsPrivateCloudAddonData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterData.Serialization.cs deleted file mode 100644 index a09dcdedb699..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterData.Serialization.cs +++ /dev/null @@ -1,249 +0,0 @@ -// 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; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Avs -{ - public partial class AvsPrivateCloudClusterData : 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 override 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(AvsPrivateCloudClusterData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(ClusterSize)) - { - writer.WritePropertyName("clusterSize"u8); - writer.WriteNumberValue(ClusterSize.Value); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(ClusterId)) - { - writer.WritePropertyName("clusterId"u8); - writer.WriteNumberValue(ClusterId.Value); - } - if (Optional.IsCollectionDefined(Hosts)) - { - writer.WritePropertyName("hosts"u8); - writer.WriteStartArray(); - foreach (var item in Hosts) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(VsanDatastoreName)) - { - writer.WritePropertyName("vsanDatastoreName"u8); - writer.WriteStringValue(VsanDatastoreName); - } - writer.WriteEndObject(); - } - - AvsPrivateCloudClusterData 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(AvsPrivateCloudClusterData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudClusterData(document.RootElement, options); - } - - internal static AvsPrivateCloudClusterData DeserializeAvsPrivateCloudClusterData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AvsSku sku = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - int? clusterSize = default; - AvsPrivateCloudClusterProvisioningState? provisioningState = default; - int? clusterId = default; - IList hosts = default; - string vsanDatastoreName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sku"u8)) - { - sku = AvsSku.DeserializeAvsSku(property.Value, options); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("clusterSize"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - clusterSize = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new AvsPrivateCloudClusterProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("clusterId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - clusterId = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("hosts"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - hosts = array; - continue; - } - if (property0.NameEquals("vsanDatastoreName"u8)) - { - vsanDatastoreName = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudClusterData( - id, - name, - type, - systemData, - sku, - clusterSize, - provisioningState, - clusterId, - hosts ?? new ChangeTrackingList(), - vsanDatastoreName, - 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); - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterData)} does not support writing '{options.Format}' format."); - } - } - - AvsPrivateCloudClusterData 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 DeserializeAvsPrivateCloudClusterData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.Serialization.cs deleted file mode 100644 index 5ba465e7062a..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class AvsPrivateCloudClusterResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - AvsPrivateCloudClusterData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - AvsPrivateCloudClusterData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineData.Serialization.cs deleted file mode 100644 index e8a2e5be5df4..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineData.Serialization.cs +++ /dev/null @@ -1,222 +0,0 @@ -// 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; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Avs -{ - public partial class AvsPrivateCloudClusterVirtualMachineData : 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 override 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(AvsPrivateCloudClusterVirtualMachineData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (options.Format != "W" && Optional.IsDefined(MoRefId)) - { - writer.WritePropertyName("moRefId"u8); - writer.WriteStringValue(MoRefId); - } - if (options.Format != "W" && Optional.IsDefined(FolderPath)) - { - writer.WritePropertyName("folderPath"u8); - writer.WriteStringValue(FolderPath); - } - if (options.Format != "W" && Optional.IsDefined(RestrictMovement)) - { - writer.WritePropertyName("restrictMovement"u8); - writer.WriteStringValue(RestrictMovement.Value.ToString()); - } - writer.WriteEndObject(); - } - - AvsPrivateCloudClusterVirtualMachineData 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(AvsPrivateCloudClusterVirtualMachineData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudClusterVirtualMachineData(document.RootElement, options); - } - - internal static AvsPrivateCloudClusterVirtualMachineData DeserializeAvsPrivateCloudClusterVirtualMachineData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - AvsVirtualMachineProvisioningState? provisioningState = default; - string displayName = default; - string moRefId = default; - string folderPath = default; - VirtualMachineRestrictMovementState? restrictMovement = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new AvsVirtualMachineProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("moRefId"u8)) - { - moRefId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("folderPath"u8)) - { - folderPath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("restrictMovement"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - restrictMovement = new VirtualMachineRestrictMovementState(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudClusterVirtualMachineData( - id, - name, - type, - systemData, - provisioningState, - displayName, - moRefId, - folderPath, - restrictMovement, - 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); - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterVirtualMachineData)} does not support writing '{options.Format}' format."); - } - } - - AvsPrivateCloudClusterVirtualMachineData 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 DeserializeAvsPrivateCloudClusterVirtualMachineData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterVirtualMachineData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineResource.Serialization.cs deleted file mode 100644 index db8705e5724b..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class AvsPrivateCloudClusterVirtualMachineResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - AvsPrivateCloudClusterVirtualMachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - AvsPrivateCloudClusterVirtualMachineData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudData.Serialization.cs deleted file mode 100644 index 8c1e5ea73185..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudData.Serialization.cs +++ /dev/null @@ -1,564 +0,0 @@ -// 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; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Avs -{ - public partial class AvsPrivateCloudData : 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 override 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(AvsPrivateCloudData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - JsonSerializer.Serialize(writer, Identity); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(ManagementCluster)) - { - writer.WritePropertyName("managementCluster"u8); - writer.WriteObjectValue(ManagementCluster, options); - } - if (Optional.IsDefined(Internet)) - { - writer.WritePropertyName("internet"u8); - writer.WriteStringValue(Internet.Value.ToString()); - } - if (Optional.IsCollectionDefined(IdentitySources)) - { - writer.WritePropertyName("identitySources"u8); - writer.WriteStartArray(); - foreach (var item in IdentitySources) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(Availability)) - { - writer.WritePropertyName("availability"u8); - writer.WriteObjectValue(Availability, options); - } - if (Optional.IsDefined(Encryption)) - { - writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption, options); - } - if (Optional.IsCollectionDefined(ExtendedNetworkBlocks)) - { - writer.WritePropertyName("extendedNetworkBlocks"u8); - writer.WriteStartArray(); - foreach (var item in ExtendedNetworkBlocks) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(Circuit)) - { - writer.WritePropertyName("circuit"u8); - writer.WriteObjectValue(Circuit, options); - } - if (options.Format != "W" && Optional.IsDefined(Endpoints)) - { - writer.WritePropertyName("endpoints"u8); - writer.WriteObjectValue(Endpoints, options); - } - if (Optional.IsDefined(NetworkBlock)) - { - writer.WritePropertyName("networkBlock"u8); - writer.WriteStringValue(NetworkBlock); - } - if (options.Format != "W" && Optional.IsDefined(ManagementNetwork)) - { - writer.WritePropertyName("managementNetwork"u8); - writer.WriteStringValue(ManagementNetwork); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningNetwork)) - { - writer.WritePropertyName("provisioningNetwork"u8); - writer.WriteStringValue(ProvisioningNetwork); - } - if (options.Format != "W" && Optional.IsDefined(VMotionNetwork)) - { - writer.WritePropertyName("vmotionNetwork"u8); - writer.WriteStringValue(VMotionNetwork); - } - if (Optional.IsDefined(VCenterPassword)) - { - writer.WritePropertyName("vcenterPassword"u8); - writer.WriteStringValue(VCenterPassword); - } - if (Optional.IsDefined(NsxtPassword)) - { - writer.WritePropertyName("nsxtPassword"u8); - writer.WriteStringValue(NsxtPassword); - } - if (options.Format != "W" && Optional.IsDefined(VCenterCertificateThumbprint)) - { - writer.WritePropertyName("vcenterCertificateThumbprint"u8); - writer.WriteStringValue(VCenterCertificateThumbprint); - } - if (options.Format != "W" && Optional.IsDefined(NsxtCertificateThumbprint)) - { - writer.WritePropertyName("nsxtCertificateThumbprint"u8); - writer.WriteStringValue(NsxtCertificateThumbprint); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ExternalCloudLinks)) - { - writer.WritePropertyName("externalCloudLinks"u8); - writer.WriteStartArray(); - foreach (var item in ExternalCloudLinks) - { - if (item == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(SecondaryCircuit)) - { - writer.WritePropertyName("secondaryCircuit"u8); - writer.WriteObjectValue(SecondaryCircuit, options); - } - if (options.Format != "W" && Optional.IsDefined(NsxPublicIPQuotaRaised)) - { - writer.WritePropertyName("nsxPublicIpQuotaRaised"u8); - writer.WriteStringValue(NsxPublicIPQuotaRaised.Value.ToString()); - } - if (Optional.IsDefined(VirtualNetworkId)) - { - writer.WritePropertyName("virtualNetworkId"u8); - writer.WriteStringValue(VirtualNetworkId); - } - if (Optional.IsDefined(DnsZoneType)) - { - writer.WritePropertyName("dnsZoneType"u8); - writer.WriteStringValue(DnsZoneType.Value.ToString()); - } - writer.WriteEndObject(); - } - - AvsPrivateCloudData 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(AvsPrivateCloudData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudData(document.RootElement, options); - } - - internal static AvsPrivateCloudData DeserializeAvsPrivateCloudData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AvsSku sku = default; - ManagedServiceIdentity identity = default; - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - AvsManagementCluster managementCluster = default; - InternetConnectivityState? internet = default; - IList identitySources = default; - PrivateCloudAvailabilityProperties availability = default; - CustomerManagedEncryption encryption = default; - IList extendedNetworkBlocks = default; - AvsPrivateCloudProvisioningState? provisioningState = default; - ExpressRouteCircuit circuit = default; - AvsPrivateCloudEndpoints endpoints = default; - string networkBlock = default; - string managementNetwork = default; - string provisioningNetwork = default; - string vmotionNetwork = default; - string vcenterPassword = default; - string nsxtPassword = default; - string vcenterCertificateThumbprint = default; - string nsxtCertificateThumbprint = default; - IReadOnlyList externalCloudLinks = default; - ExpressRouteCircuit secondaryCircuit = default; - NsxPublicIPQuotaRaisedEnum? nsxPublicIPQuotaRaised = default; - ResourceIdentifier virtualNetworkId = default; - AvsDnsZoneType? dnsZoneType = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sku"u8)) - { - sku = AvsSku.DeserializeAvsSku(property.Value, options); - continue; - } - if (property.NameEquals("identity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("managementCluster"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - managementCluster = AvsManagementCluster.DeserializeAvsManagementCluster(property0.Value, options); - continue; - } - if (property0.NameEquals("internet"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - internet = new InternetConnectivityState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("identitySources"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(SingleSignOnIdentitySource.DeserializeSingleSignOnIdentitySource(item, options)); - } - identitySources = array; - continue; - } - if (property0.NameEquals("availability"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - availability = PrivateCloudAvailabilityProperties.DeserializePrivateCloudAvailabilityProperties(property0.Value, options); - continue; - } - if (property0.NameEquals("encryption"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - encryption = CustomerManagedEncryption.DeserializeCustomerManagedEncryption(property0.Value, options); - continue; - } - if (property0.NameEquals("extendedNetworkBlocks"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - extendedNetworkBlocks = array; - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new AvsPrivateCloudProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("circuit"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - circuit = ExpressRouteCircuit.DeserializeExpressRouteCircuit(property0.Value, options); - continue; - } - if (property0.NameEquals("endpoints"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - endpoints = AvsPrivateCloudEndpoints.DeserializeAvsPrivateCloudEndpoints(property0.Value, options); - continue; - } - if (property0.NameEquals("networkBlock"u8)) - { - networkBlock = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("managementNetwork"u8)) - { - managementNetwork = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningNetwork"u8)) - { - provisioningNetwork = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("vmotionNetwork"u8)) - { - vmotionNetwork = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("vcenterPassword"u8)) - { - vcenterPassword = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("nsxtPassword"u8)) - { - nsxtPassword = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("vcenterCertificateThumbprint"u8)) - { - vcenterCertificateThumbprint = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("nsxtCertificateThumbprint"u8)) - { - nsxtCertificateThumbprint = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("externalCloudLinks"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(new ResourceIdentifier(item.GetString())); - } - } - externalCloudLinks = array; - continue; - } - if (property0.NameEquals("secondaryCircuit"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - secondaryCircuit = ExpressRouteCircuit.DeserializeExpressRouteCircuit(property0.Value, options); - continue; - } - if (property0.NameEquals("nsxPublicIpQuotaRaised"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nsxPublicIPQuotaRaised = new NsxPublicIPQuotaRaisedEnum(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("virtualNetworkId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - virtualNetworkId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("dnsZoneType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dnsZoneType = new AvsDnsZoneType(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudData( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - sku, - identity, - managementCluster, - internet, - identitySources ?? new ChangeTrackingList(), - availability, - encryption, - extendedNetworkBlocks ?? new ChangeTrackingList(), - provisioningState, - circuit, - endpoints, - networkBlock, - managementNetwork, - provisioningNetwork, - vmotionNetwork, - vcenterPassword, - nsxtPassword, - vcenterCertificateThumbprint, - nsxtCertificateThumbprint, - externalCloudLinks ?? new ChangeTrackingList(), - secondaryCircuit, - nsxPublicIPQuotaRaised, - virtualNetworkId, - dnsZoneType, - 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); - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudData)} does not support writing '{options.Format}' format."); - } - } - - AvsPrivateCloudData 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 DeserializeAvsPrivateCloudData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreData.Serialization.cs deleted file mode 100644 index 52598b8077ff..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreData.Serialization.cs +++ /dev/null @@ -1,235 +0,0 @@ -// 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; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.Avs -{ - public partial class AvsPrivateCloudDatastoreData : 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 override 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(AvsPrivateCloudDatastoreData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(NetAppVolume)) - { - writer.WritePropertyName("netAppVolume"u8); - JsonSerializer.Serialize(writer, NetAppVolume); - } - if (Optional.IsDefined(DiskPoolVolume)) - { - writer.WritePropertyName("diskPoolVolume"u8); - writer.WriteObjectValue(DiskPoolVolume, options); - } - if (Optional.IsDefined(ElasticSanVolume)) - { - writer.WritePropertyName("elasticSanVolume"u8); - writer.WriteObjectValue(ElasticSanVolume, options); - } - if (options.Format != "W" && Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - writer.WriteEndObject(); - } - - AvsPrivateCloudDatastoreData 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(AvsPrivateCloudDatastoreData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudDatastoreData(document.RootElement, options); - } - - internal static AvsPrivateCloudDatastoreData DeserializeAvsPrivateCloudDatastoreData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - AvsPrivateCloudDatastoreProvisioningState? provisioningState = default; - WritableSubResource netAppVolume = default; - DiskPoolVolume diskPoolVolume = default; - ElasticSanVolume elasticSanVolume = default; - DatastoreStatus? status = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new AvsPrivateCloudDatastoreProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("netAppVolume"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netAppVolume = JsonSerializer.Deserialize(property0.Value.GetRawText()); - continue; - } - if (property0.NameEquals("diskPoolVolume"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - diskPoolVolume = DiskPoolVolume.DeserializeDiskPoolVolume(property0.Value, options); - continue; - } - if (property0.NameEquals("elasticSanVolume"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - elasticSanVolume = ElasticSanVolume.DeserializeElasticSanVolume(property0.Value, options); - continue; - } - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new DatastoreStatus(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudDatastoreData( - id, - name, - type, - systemData, - provisioningState, - netAppVolume, - diskPoolVolume, - elasticSanVolume, - status, - 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); - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudDatastoreData)} does not support writing '{options.Format}' format."); - } - } - - AvsPrivateCloudDatastoreData 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 DeserializeAvsPrivateCloudDatastoreData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AvsPrivateCloudDatastoreData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreResource.Serialization.cs deleted file mode 100644 index 9ec947b222bf..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class AvsPrivateCloudDatastoreResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - AvsPrivateCloudDatastoreData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - AvsPrivateCloudDatastoreData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.Serialization.cs deleted file mode 100644 index 4aeeaeb62f7c..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class AvsPrivateCloudResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - AvsPrivateCloudData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - AvsPrivateCloudData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs similarity index 62% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs index c316424f14b0..12411780d9e5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs @@ -18,28 +18,28 @@ namespace Azure.ResourceManager.Avs { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetAvsCloudLinks method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetCloudLinks method from an instance of . /// - public partial class AvsCloudLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class CloudLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _avsCloudLinkCloudLinksClientDiagnostics; - private readonly CloudLinksRestOperations _avsCloudLinkCloudLinksRestClient; + private readonly ClientDiagnostics _cloudLinkClientDiagnostics; + private readonly CloudLinksRestOperations _cloudLinkRestClient; - /// Initializes a new instance of the class for mocking. - protected AvsCloudLinkCollection() + /// Initializes a new instance of the class for mocking. + protected CloudLinkCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal AvsCloudLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal CloudLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsCloudLinkCloudLinksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", AvsCloudLinkResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(AvsCloudLinkResource.ResourceType, out string avsCloudLinkCloudLinksApiVersion); - _avsCloudLinkCloudLinksRestClient = new CloudLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsCloudLinkCloudLinksApiVersion); + _cloudLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", CloudLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(CloudLinkResource.ResourceType, out string cloudLinkApiVersion); + _cloudLinkRestClient = new CloudLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, cloudLinkApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -47,8 +47,8 @@ internal AvsCloudLinkCollection(ArmClient client, ResourceIdentifier id) : base( internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudResource.ResourceType), nameof(id)); + if (id.ResourceType != PrivateCloudResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloudResource.ResourceType), nameof(id)); } /// @@ -60,15 +60,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// CloudLinks_CreateOrUpdate + /// CloudLink_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -78,17 +78,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string cloudLinkName, AvsCloudLinkData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string cloudLinkName, CloudLinkData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(cloudLinkName, nameof(cloudLinkName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkCollection.CreateOrUpdate"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _avsCloudLinkCloudLinksRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new AvsCloudLinkOperationSource(Client), _avsCloudLinkCloudLinksClientDiagnostics, Pipeline, _avsCloudLinkCloudLinksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _cloudLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new CloudLinkOperationSource(Client), _cloudLinkClientDiagnostics, Pipeline, _cloudLinkRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -109,15 +109,15 @@ public virtual async Task> CreateOrUpdateAsyn /// /// /// Operation Id - /// CloudLinks_CreateOrUpdate + /// CloudLink_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -127,17 +127,17 @@ public virtual async Task> CreateOrUpdateAsyn /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string cloudLinkName, AvsCloudLinkData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string cloudLinkName, CloudLinkData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(cloudLinkName, nameof(cloudLinkName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkCollection.CreateOrUpdate"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkCollection.CreateOrUpdate"); scope.Start(); try { - var response = _avsCloudLinkCloudLinksRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, data, cancellationToken); - var operation = new AvsArmOperation(new AvsCloudLinkOperationSource(Client), _avsCloudLinkCloudLinksClientDiagnostics, Pipeline, _avsCloudLinkCloudLinksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _cloudLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, data, cancellationToken); + var operation = new AvsArmOperation(new CloudLinkOperationSource(Client), _cloudLinkClientDiagnostics, Pipeline, _cloudLinkRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -158,15 +158,15 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitU /// /// /// Operation Id - /// CloudLinks_Get + /// CloudLink_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -174,18 +174,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitU /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string cloudLinkName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string cloudLinkName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(cloudLinkName, nameof(cloudLinkName)); - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkCollection.Get"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkCollection.Get"); scope.Start(); try { - var response = await _avsCloudLinkCloudLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken).ConfigureAwait(false); + var response = await _cloudLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsCloudLinkResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new CloudLinkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -203,15 +203,15 @@ public virtual async Task> GetAsync(string cloudL /// /// /// Operation Id - /// CloudLinks_Get + /// CloudLink_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -219,18 +219,18 @@ public virtual async Task> GetAsync(string cloudL /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string cloudLinkName, CancellationToken cancellationToken = default) + public virtual Response Get(string cloudLinkName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(cloudLinkName, nameof(cloudLinkName)); - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkCollection.Get"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkCollection.Get"); scope.Start(); try { - var response = _avsCloudLinkCloudLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken); + var response = _cloudLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsCloudLinkResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new CloudLinkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -248,25 +248,25 @@ public virtual Response Get(string cloudLinkName, Cancella /// /// /// Operation Id - /// CloudLinks_List + /// CloudLink_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsCloudLinkCloudLinksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsCloudLinkCloudLinksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsCloudLinkResource(Client, AvsCloudLinkData.DeserializeAvsCloudLinkData(e)), _avsCloudLinkCloudLinksClientDiagnostics, Pipeline, "AvsCloudLinkCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudLinkRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudLinkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudLinkResource(Client, CloudLinkData.DeserializeCloudLinkData(e)), _cloudLinkClientDiagnostics, Pipeline, "CloudLinkCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -278,25 +278,25 @@ public virtual AsyncPageable GetAllAsync(CancellationToken /// /// /// Operation Id - /// CloudLinks_List + /// CloudLink_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsCloudLinkCloudLinksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsCloudLinkCloudLinksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsCloudLinkResource(Client, AvsCloudLinkData.DeserializeAvsCloudLinkData(e)), _avsCloudLinkCloudLinksClientDiagnostics, Pipeline, "AvsCloudLinkCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudLinkRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudLinkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudLinkResource(Client, CloudLinkData.DeserializeCloudLinkData(e)), _cloudLinkClientDiagnostics, Pipeline, "CloudLinkCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -308,15 +308,15 @@ public virtual Pageable GetAll(CancellationToken cancellat /// /// /// Operation Id - /// CloudLinks_Get + /// CloudLink_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -328,11 +328,11 @@ public virtual async Task> ExistsAsync(string cloudLinkName, Canc { Argument.AssertNotNullOrEmpty(cloudLinkName, nameof(cloudLinkName)); - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkCollection.Exists"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkCollection.Exists"); scope.Start(); try { - var response = await _avsCloudLinkCloudLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _cloudLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -351,15 +351,15 @@ public virtual async Task> ExistsAsync(string cloudLinkName, Canc /// /// /// Operation Id - /// CloudLinks_Get + /// CloudLink_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -371,11 +371,11 @@ public virtual Response Exists(string cloudLinkName, CancellationToken can { Argument.AssertNotNullOrEmpty(cloudLinkName, nameof(cloudLinkName)); - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkCollection.Exists"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkCollection.Exists"); scope.Start(); try { - var response = _avsCloudLinkCloudLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken); + var response = _cloudLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -394,15 +394,15 @@ public virtual Response Exists(string cloudLinkName, CancellationToken can /// /// /// Operation Id - /// CloudLinks_Get + /// CloudLink_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -410,18 +410,18 @@ public virtual Response Exists(string cloudLinkName, CancellationToken can /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string cloudLinkName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string cloudLinkName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(cloudLinkName, nameof(cloudLinkName)); - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkCollection.GetIfExists"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkCollection.GetIfExists"); scope.Start(); try { - var response = await _avsCloudLinkCloudLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _cloudLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsCloudLinkResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudLinkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -439,15 +439,15 @@ public virtual async Task> GetIfExistsAsy /// /// /// Operation Id - /// CloudLinks_Get + /// CloudLink_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -455,18 +455,18 @@ public virtual async Task> GetIfExistsAsy /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string cloudLinkName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string cloudLinkName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(cloudLinkName, nameof(cloudLinkName)); - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkCollection.GetIfExists"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkCollection.GetIfExists"); scope.Start(); try { - var response = _avsCloudLinkCloudLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken); + var response = _cloudLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsCloudLinkResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CloudLinkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -475,7 +475,7 @@ public virtual NullableResponse GetIfExists(string cloudLi } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -485,7 +485,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.Serialization.cs new file mode 100644 index 000000000000..942b2fb0fae2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.Serialization.cs @@ -0,0 +1,155 @@ +// 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; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class CloudLinkData : 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 override 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(CloudLinkData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + CloudLinkData 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(CloudLinkData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCloudLinkData(document.RootElement, options); + } + + internal static CloudLinkData DeserializeCloudLinkData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CloudLinkProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = CloudLinkProperties.DeserializeCloudLinkProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CloudLinkData( + id, + name, + type, + systemData, + properties, + 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); + default: + throw new FormatException($"The model {nameof(CloudLinkData)} does not support writing '{options.Format}' format."); + } + } + + CloudLinkData 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 DeserializeCloudLinkData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CloudLinkData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs new file mode 100644 index 000000000000..4f58486ebe7a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing the CloudLink data model. + /// A cloud link resource + /// + public partial class CloudLinkData : ResourceData + { + /// + /// 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 . + public CloudLinkData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal CloudLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CloudLinkProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public CloudLinkProperties Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkResource.Serialization.cs new file mode 100644 index 000000000000..a9047d15a77e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Avs +{ + public partial class CloudLinkResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + CloudLinkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + CloudLinkData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkResource.cs similarity index 65% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkResource.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkResource.cs index becf6cebb180..e11dd6c7a36e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkResource.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.Avs { /// - /// A Class representing an AvsCloudLink along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetAvsCloudLinkResource method. - /// Otherwise you can get one from its parent resource using the GetAvsCloudLink method. + /// A Class representing a CloudLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetCloudLinkResource method. + /// Otherwise you can get one from its parent resource using the GetCloudLink method. /// - public partial class AvsCloudLinkResource : ArmResource + public partial class CloudLinkResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The privateCloudName. @@ -33,35 +33,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _avsCloudLinkCloudLinksClientDiagnostics; - private readonly CloudLinksRestOperations _avsCloudLinkCloudLinksRestClient; - private readonly AvsCloudLinkData _data; + private readonly ClientDiagnostics _cloudLinkClientDiagnostics; + private readonly CloudLinksRestOperations _cloudLinkRestClient; + private readonly CloudLinkData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/cloudLinks"; - /// Initializes a new instance of the class for mocking. - protected AvsCloudLinkResource() + /// Initializes a new instance of the class for mocking. + protected CloudLinkResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal AvsCloudLinkResource(ArmClient client, AvsCloudLinkData data) : this(client, data.Id) + internal CloudLinkResource(ArmClient client, CloudLinkData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal AvsCloudLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal CloudLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsCloudLinkCloudLinksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string avsCloudLinkCloudLinksApiVersion); - _avsCloudLinkCloudLinksRestClient = new CloudLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsCloudLinkCloudLinksApiVersion); + _cloudLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string cloudLinkApiVersion); + _cloudLinkRestClient = new CloudLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, cloudLinkApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -72,7 +72,7 @@ internal AvsCloudLinkResource(ArmClient client, ResourceIdentifier id) : base(cl /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual AvsCloudLinkData Data + public virtual CloudLinkData Data { get { @@ -97,29 +97,29 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// CloudLinks_Get + /// CloudLink_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkResource.Get"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkResource.Get"); scope.Start(); try { - var response = await _avsCloudLinkCloudLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _cloudLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsCloudLinkResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new CloudLinkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -137,29 +137,29 @@ public virtual async Task> GetAsync(CancellationT /// /// /// Operation Id - /// CloudLinks_Get + /// CloudLink_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkResource.Get"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkResource.Get"); scope.Start(); try { - var response = _avsCloudLinkCloudLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _cloudLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsCloudLinkResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new CloudLinkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -177,15 +177,15 @@ public virtual Response Get(CancellationToken cancellation /// /// /// Operation Id - /// CloudLinks_Delete + /// CloudLink_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -193,12 +193,12 @@ public virtual Response Get(CancellationToken cancellation /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkResource.Delete"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkResource.Delete"); scope.Start(); try { - var response = await _avsCloudLinkCloudLinksRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_avsCloudLinkCloudLinksClientDiagnostics, Pipeline, _avsCloudLinkCloudLinksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _cloudLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_cloudLinkClientDiagnostics, Pipeline, _cloudLinkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -219,15 +219,15 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// CloudLinks_Delete + /// CloudLink_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -235,12 +235,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkResource.Delete"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkResource.Delete"); scope.Start(); try { - var response = _avsCloudLinkCloudLinksRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_avsCloudLinkCloudLinksClientDiagnostics, Pipeline, _avsCloudLinkCloudLinksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _cloudLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new AvsArmOperation(_cloudLinkClientDiagnostics, Pipeline, _cloudLinkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -261,15 +261,15 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// CloudLinks_CreateOrUpdate + /// CloudLink_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -277,16 +277,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Resource create parameters. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, AvsCloudLinkData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, CloudLinkData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkResource.Update"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkResource.Update"); scope.Start(); try { - var response = await _avsCloudLinkCloudLinksRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new AvsCloudLinkOperationSource(Client), _avsCloudLinkCloudLinksClientDiagnostics, Pipeline, _avsCloudLinkCloudLinksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _cloudLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new CloudLinkOperationSource(Client), _cloudLinkClientDiagnostics, Pipeline, _cloudLinkRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -307,15 +307,15 @@ public virtual async Task> UpdateAsync(WaitUn /// /// /// Operation Id - /// CloudLinks_CreateOrUpdate + /// CloudLink_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -323,16 +323,16 @@ public virtual async Task> UpdateAsync(WaitUn /// Resource create parameters. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, AvsCloudLinkData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, CloudLinkData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsCloudLinkCloudLinksClientDiagnostics.CreateScope("AvsCloudLinkResource.Update"); + using var scope = _cloudLinkClientDiagnostics.CreateScope("CloudLinkResource.Update"); scope.Start(); try { - var response = _avsCloudLinkCloudLinksRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new AvsArmOperation(new AvsCloudLinkOperationSource(Client), _avsCloudLinkCloudLinksClientDiagnostics, Pipeline, _avsCloudLinkCloudLinksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _cloudLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new AvsArmOperation(new CloudLinkOperationSource(Client), _cloudLinkClientDiagnostics, Pipeline, _cloudLinkRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs similarity index 60% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs index d18d4e7f6bf4..73d193f3d57b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs @@ -18,28 +18,28 @@ namespace Azure.ResourceManager.Avs { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetAvsPrivateCloudClusters method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetClusters method from an instance of . /// - public partial class AvsPrivateCloudClusterCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ClusterCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _avsPrivateCloudClusterClustersClientDiagnostics; - private readonly ClustersRestOperations _avsPrivateCloudClusterClustersRestClient; + private readonly ClientDiagnostics _clusterClientDiagnostics; + private readonly ClustersRestOperations _clusterRestClient; - /// Initializes a new instance of the class for mocking. - protected AvsPrivateCloudClusterCollection() + /// Initializes a new instance of the class for mocking. + protected ClusterCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal AvsPrivateCloudClusterCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ClusterCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsPrivateCloudClusterClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", AvsPrivateCloudClusterResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(AvsPrivateCloudClusterResource.ResourceType, out string avsPrivateCloudClusterClustersApiVersion); - _avsPrivateCloudClusterClustersRestClient = new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsPrivateCloudClusterClustersApiVersion); + _clusterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ClusterResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ClusterResource.ResourceType, out string clusterApiVersion); + _clusterRestClient = new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, clusterApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -47,8 +47,8 @@ internal AvsPrivateCloudClusterCollection(ArmClient client, ResourceIdentifier i internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudResource.ResourceType), nameof(id)); + if (id.ResourceType != PrivateCloudResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloudResource.ResourceType), nameof(id)); } /// @@ -60,15 +60,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Clusters_CreateOrUpdate + /// Cluster_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -78,17 +78,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string clusterName, AvsPrivateCloudClusterData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string clusterName, ClusterData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterCollection.CreateOrUpdate"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _avsPrivateCloudClusterClustersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new AvsPrivateCloudClusterOperationSource(Client), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, _avsPrivateCloudClusterClustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _clusterRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new ClusterOperationSource(Client), _clusterClientDiagnostics, Pipeline, _clusterRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -109,15 +109,15 @@ public virtual async Task> CreateOr /// /// /// Operation Id - /// Clusters_CreateOrUpdate + /// Cluster_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -127,17 +127,17 @@ public virtual async Task> CreateOr /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string clusterName, AvsPrivateCloudClusterData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string clusterName, ClusterData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterCollection.CreateOrUpdate"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterCollection.CreateOrUpdate"); scope.Start(); try { - var response = _avsPrivateCloudClusterClustersRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, data, cancellationToken); - var operation = new AvsArmOperation(new AvsPrivateCloudClusterOperationSource(Client), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, _avsPrivateCloudClusterClustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _clusterRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, data, cancellationToken); + var operation = new AvsArmOperation(new ClusterOperationSource(Client), _clusterClientDiagnostics, Pipeline, _clusterRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -158,15 +158,15 @@ public virtual ArmOperation CreateOrUpdate(WaitU /// /// /// Operation Id - /// Clusters_Get + /// Cluster_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -174,18 +174,18 @@ public virtual ArmOperation CreateOrUpdate(WaitU /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string clusterName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterCollection.Get"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterCollection.Get"); scope.Start(); try { - var response = await _avsPrivateCloudClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken).ConfigureAwait(false); + var response = await _clusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -203,15 +203,15 @@ public virtual async Task> GetAsync(str /// /// /// Operation Id - /// Clusters_Get + /// Cluster_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -219,18 +219,18 @@ public virtual async Task> GetAsync(str /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string clusterName, CancellationToken cancellationToken = default) + public virtual Response Get(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterCollection.Get"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterCollection.Get"); scope.Start(); try { - var response = _avsPrivateCloudClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken); + var response = _clusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -248,25 +248,25 @@ public virtual Response Get(string clusterName, /// /// /// Operation Id - /// Clusters_List + /// Cluster_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudClusterClustersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudClusterResource(Client, AvsPrivateCloudClusterData.DeserializeAvsPrivateCloudClusterData(e)), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, "AvsPrivateCloudClusterCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _clusterRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _clusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ClusterResource(Client, ClusterData.DeserializeClusterData(e)), _clusterClientDiagnostics, Pipeline, "ClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -278,25 +278,25 @@ public virtual AsyncPageable GetAllAsync(Cancell /// /// /// Operation Id - /// Clusters_List + /// Cluster_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudClusterClustersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudClusterResource(Client, AvsPrivateCloudClusterData.DeserializeAvsPrivateCloudClusterData(e)), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, "AvsPrivateCloudClusterCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _clusterRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _clusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ClusterResource(Client, ClusterData.DeserializeClusterData(e)), _clusterClientDiagnostics, Pipeline, "ClusterCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -308,15 +308,15 @@ public virtual Pageable GetAll(CancellationToken /// /// /// Operation Id - /// Clusters_Get + /// Cluster_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -328,11 +328,11 @@ public virtual async Task> ExistsAsync(string clusterName, Cancel { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterCollection.Exists"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterCollection.Exists"); scope.Start(); try { - var response = await _avsPrivateCloudClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _clusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -351,15 +351,15 @@ public virtual async Task> ExistsAsync(string clusterName, Cancel /// /// /// Operation Id - /// Clusters_Get + /// Cluster_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -371,11 +371,11 @@ public virtual Response Exists(string clusterName, CancellationToken cance { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterCollection.Exists"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterCollection.Exists"); scope.Start(); try { - var response = _avsPrivateCloudClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); + var response = _clusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -394,15 +394,15 @@ public virtual Response Exists(string clusterName, CancellationToken cance /// /// /// Operation Id - /// Clusters_Get + /// Cluster_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -410,18 +410,18 @@ public virtual Response Exists(string clusterName, CancellationToken cance /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterCollection.GetIfExists"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterCollection.GetIfExists"); scope.Start(); try { - var response = await _avsPrivateCloudClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _clusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -439,15 +439,15 @@ public virtual async Task> GetI /// /// /// Operation Id - /// Clusters_Get + /// Cluster_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -455,18 +455,18 @@ public virtual async Task> GetI /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterCollection.GetIfExists"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterCollection.GetIfExists"); scope.Start(); try { - var response = _avsPrivateCloudClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); + var response = _clusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -475,7 +475,7 @@ public virtual NullableResponse GetIfExists(stri } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -485,7 +485,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.Serialization.cs new file mode 100644 index 000000000000..ed9ea6913a01 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.Serialization.cs @@ -0,0 +1,164 @@ +// 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; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class ClusterData : 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 override 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(ClusterData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + + ClusterData 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(ClusterData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeClusterData(document.RootElement, options); + } + + internal static ClusterData DeserializeClusterData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ClusterProperties properties = default; + AvsSku sku = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ClusterProperties.DeserializeClusterProperties(property.Value, options); + continue; + } + if (property.NameEquals("sku"u8)) + { + sku = AvsSku.DeserializeAvsSku(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ClusterData( + id, + name, + type, + systemData, + properties, + sku, + 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); + default: + throw new FormatException($"The model {nameof(ClusterData)} does not support writing '{options.Format}' format."); + } + } + + ClusterData 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 DeserializeClusterData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ClusterData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs new file mode 100644 index 000000000000..b5e9443aaef3 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing the Cluster data model. + /// A cluster resource + /// + public partial class ClusterData : ResourceData + { + /// + /// 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 SKU (Stock Keeping Unit) assigned to this resource. + /// is null. + public ClusterData(AvsSku sku) + { + Argument.AssertNotNull(sku, nameof(sku)); + + Sku = sku; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal ClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ClusterProperties properties, AvsSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ClusterData() + { + } + + /// The resource-specific properties for this resource. + public ClusterProperties Properties { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + public AvsSku Sku { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterResource.Serialization.cs new file mode 100644 index 000000000000..710decc39273 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Avs +{ + public partial class ClusterResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ClusterData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + ClusterData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterResource.cs similarity index 62% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterResource.cs index 5ce32f2aa835..e8cd1b5a218d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterResource.cs @@ -9,7 +9,6 @@ using System.Globalization; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager.Avs.Models; @@ -17,14 +16,14 @@ namespace Azure.ResourceManager.Avs { /// - /// A Class representing an AvsPrivateCloudCluster along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetAvsPrivateCloudClusterResource method. - /// Otherwise you can get one from its parent resource using the GetAvsPrivateCloudCluster method. + /// A Class representing a Cluster along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetClusterResource method. + /// Otherwise you can get one from its parent resource using the GetCluster method. /// - public partial class AvsPrivateCloudClusterResource : ArmResource + public partial class ClusterResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The privateCloudName. @@ -35,35 +34,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _avsPrivateCloudClusterClustersClientDiagnostics; - private readonly ClustersRestOperations _avsPrivateCloudClusterClustersRestClient; - private readonly AvsPrivateCloudClusterData _data; + private readonly ClientDiagnostics _clusterClientDiagnostics; + private readonly ClustersRestOperations _clusterRestClient; + private readonly ClusterData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters"; - /// Initializes a new instance of the class for mocking. - protected AvsPrivateCloudClusterResource() + /// Initializes a new instance of the class for mocking. + protected ClusterResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal AvsPrivateCloudClusterResource(ArmClient client, AvsPrivateCloudClusterData data) : this(client, data.Id) + internal ClusterResource(ArmClient client, ClusterData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal AvsPrivateCloudClusterResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ClusterResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsPrivateCloudClusterClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string avsPrivateCloudClusterClustersApiVersion); - _avsPrivateCloudClusterClustersRestClient = new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsPrivateCloudClusterClustersApiVersion); + _clusterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string clusterApiVersion); + _clusterRestClient = new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, clusterApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -74,7 +73,7 @@ internal AvsPrivateCloudClusterResource(ArmClient client, ResourceIdentifier id) /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual AvsPrivateCloudClusterData Data + public virtual ClusterData Data { get { @@ -90,11 +89,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of AvsPrivateCloudDatastoreResources in the AvsPrivateCloudCluster. - /// An object representing collection of AvsPrivateCloudDatastoreResources and their operations over a AvsPrivateCloudDatastoreResource. - public virtual AvsPrivateCloudDatastoreCollection GetAvsPrivateCloudDatastores() + /// Gets a collection of DatastoreResources in the Cluster. + /// An object representing collection of DatastoreResources and their operations over a DatastoreResource. + public virtual DatastoreCollection GetDatastores() { - return GetCachedClient(client => new AvsPrivateCloudDatastoreCollection(client, Id)); + return GetCachedClient(client => new DatastoreCollection(client, Id)); } /// @@ -106,15 +105,15 @@ public virtual AvsPrivateCloudDatastoreCollection GetAvsPrivateCloudDatastores() /// /// /// Operation Id - /// Datastores_Get + /// Datastore_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -123,9 +122,9 @@ public virtual AvsPrivateCloudDatastoreCollection GetAvsPrivateCloudDatastores() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetAvsPrivateCloudDatastoreAsync(string datastoreName, CancellationToken cancellationToken = default) + public virtual async Task> GetDatastoreAsync(string datastoreName, CancellationToken cancellationToken = default) { - return await GetAvsPrivateCloudDatastores().GetAsync(datastoreName, cancellationToken).ConfigureAwait(false); + return await GetDatastores().GetAsync(datastoreName, cancellationToken).ConfigureAwait(false); } /// @@ -137,15 +136,15 @@ public virtual async Task> GetAvsPriv /// /// /// Operation Id - /// Datastores_Get + /// Datastore_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -154,12 +153,81 @@ public virtual async Task> GetAvsPriv /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetAvsPrivateCloudDatastore(string datastoreName, CancellationToken cancellationToken = default) + public virtual Response GetDatastore(string datastoreName, CancellationToken cancellationToken = default) { - return GetAvsPrivateCloudDatastores().Get(datastoreName, cancellationToken); + return GetDatastores().Get(datastoreName, cancellationToken); } - /// Gets a collection of PlacementPolicyResources in the AvsPrivateCloudCluster. + /// Gets a collection of HostResources in the Cluster. + /// An object representing collection of HostResources and their operations over a HostResource. + public virtual HostCollection GetHosts() + { + return GetCachedClient(client => new HostCollection(client, Id)); + } + + /// + /// Get a Host + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId} + /// + /// + /// Operation Id + /// Host_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The host identifier. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHostAsync(string hostId, CancellationToken cancellationToken = default) + { + return await GetHosts().GetAsync(hostId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Host + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId} + /// + /// + /// Operation Id + /// Host_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The host identifier. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHost(string hostId, CancellationToken cancellationToken = default) + { + return GetHosts().Get(hostId, cancellationToken); + } + + /// Gets a collection of PlacementPolicyResources in the Cluster. /// An object representing collection of PlacementPolicyResources and their operations over a PlacementPolicyResource. public virtual PlacementPolicyCollection GetPlacementPolicies() { @@ -175,11 +243,11 @@ public virtual PlacementPolicyCollection GetPlacementPolicies() /// /// /// Operation Id - /// PlacementPolicies_Get + /// PlacementPolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -206,11 +274,11 @@ public virtual async Task> GetPlacementPolicyA /// /// /// Operation Id - /// PlacementPolicies_Get + /// PlacementPolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -228,11 +296,11 @@ public virtual Response GetPlacementPolicy(string place return GetPlacementPolicies().Get(placementPolicyName, cancellationToken); } - /// Gets a collection of AvsPrivateCloudClusterVirtualMachineResources in the AvsPrivateCloudCluster. - /// An object representing collection of AvsPrivateCloudClusterVirtualMachineResources and their operations over a AvsPrivateCloudClusterVirtualMachineResource. - public virtual AvsPrivateCloudClusterVirtualMachineCollection GetAvsPrivateCloudClusterVirtualMachines() + /// Gets a collection of VirtualMachineResources in the Cluster. + /// An object representing collection of VirtualMachineResources and their operations over a VirtualMachineResource. + public virtual VirtualMachineCollection GetVirtualMachines() { - return GetCachedClient(client => new AvsPrivateCloudClusterVirtualMachineCollection(client, Id)); + return GetCachedClient(client => new VirtualMachineCollection(client, Id)); } /// @@ -244,15 +312,15 @@ public virtual AvsPrivateCloudClusterVirtualMachineCollection GetAvsPrivateCloud /// /// /// Operation Id - /// VirtualMachines_Get + /// VirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -261,9 +329,9 @@ public virtual AvsPrivateCloudClusterVirtualMachineCollection GetAvsPrivateCloud /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetAvsPrivateCloudClusterVirtualMachineAsync(string virtualMachineId, CancellationToken cancellationToken = default) + public virtual async Task> GetVirtualMachineAsync(string virtualMachineId, CancellationToken cancellationToken = default) { - return await GetAvsPrivateCloudClusterVirtualMachines().GetAsync(virtualMachineId, cancellationToken).ConfigureAwait(false); + return await GetVirtualMachines().GetAsync(virtualMachineId, cancellationToken).ConfigureAwait(false); } /// @@ -275,15 +343,15 @@ public virtual async Task /// /// /// Operation Id - /// VirtualMachines_Get + /// VirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -292,9 +360,9 @@ public virtual async Task /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetAvsPrivateCloudClusterVirtualMachine(string virtualMachineId, CancellationToken cancellationToken = default) + public virtual Response GetVirtualMachine(string virtualMachineId, CancellationToken cancellationToken = default) { - return GetAvsPrivateCloudClusterVirtualMachines().Get(virtualMachineId, cancellationToken); + return GetVirtualMachines().Get(virtualMachineId, cancellationToken); } /// @@ -306,29 +374,29 @@ public virtual Response GetAvsPriv /// /// /// Operation Id - /// Clusters_Get + /// Cluster_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterResource.Get"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterResource.Get"); scope.Start(); try { - var response = await _avsPrivateCloudClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _clusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -346,29 +414,29 @@ public virtual async Task> GetAsync(Can /// /// /// Operation Id - /// Clusters_Get + /// Cluster_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterResource.Get"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterResource.Get"); scope.Start(); try { - var response = _avsPrivateCloudClusterClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _clusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -386,15 +454,15 @@ public virtual Response Get(CancellationToken ca /// /// /// Operation Id - /// Clusters_Delete + /// Cluster_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -402,12 +470,12 @@ public virtual Response Get(CancellationToken ca /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterResource.Delete"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterResource.Delete"); scope.Start(); try { - var response = await _avsPrivateCloudClusterClustersRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, _avsPrivateCloudClusterClustersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _clusterRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_clusterClientDiagnostics, Pipeline, _clusterRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -428,15 +496,15 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// Clusters_Delete + /// Cluster_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -444,12 +512,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterResource.Delete"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterResource.Delete"); scope.Start(); try { - var response = _avsPrivateCloudClusterClustersRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, _avsPrivateCloudClusterClustersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _clusterRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new AvsArmOperation(_clusterClientDiagnostics, Pipeline, _clusterRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -470,32 +538,32 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Clusters_Update + /// Cluster_Update /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cluster properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, AvsPrivateCloudClusterPatch patch, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ClusterPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterResource.Update"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterResource.Update"); scope.Start(); try { - var response = await _avsPrivateCloudClusterClustersRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new AvsPrivateCloudClusterOperationSource(Client), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, _avsPrivateCloudClusterClustersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = await _clusterRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new ClusterOperationSource(Client), _clusterClientDiagnostics, Pipeline, _clusterRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -516,32 +584,32 @@ public virtual async Task> UpdateAs /// /// /// Operation Id - /// Clusters_Update + /// Cluster_Update /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cluster properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, AvsPrivateCloudClusterPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ClusterPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _avsPrivateCloudClusterClustersClientDiagnostics.CreateScope("AvsPrivateCloudClusterResource.Update"); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterResource.Update"); scope.Start(); try { - var response = _avsPrivateCloudClusterClustersRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new AvsArmOperation(new AvsPrivateCloudClusterOperationSource(Client), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, _avsPrivateCloudClusterClustersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = _clusterRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new AvsArmOperation(new ClusterOperationSource(Client), _clusterClientDiagnostics, Pipeline, _clusterRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -566,20 +634,29 @@ public virtual ArmOperation Update(WaitUntil wai /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetZonesAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetZonesAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudClusterClustersRestClient.CreateListZonesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => AvsClusterZone.DeserializeAvsClusterZone(e), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, "AvsPrivateCloudClusterResource.GetZones", "zones", null, cancellationToken); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterResource.GetZones"); + scope.Start(); + try + { + var response = await _clusterRestClient.ListZonesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// @@ -595,20 +672,29 @@ public virtual AsyncPageable GetZonesAsync(CancellationToken can /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetZones(CancellationToken cancellationToken = default) + public virtual Response GetZones(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudClusterClustersRestClient.CreateListZonesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => AvsClusterZone.DeserializeAvsClusterZone(e), _avsPrivateCloudClusterClustersClientDiagnostics, Pipeline, "AvsPrivateCloudClusterResource.GetZones", "zones", null, cancellationToken); + using var scope = _clusterClientDiagnostics.CreateScope("ClusterResource.GetZones"); + scope.Start(); + try + { + var response = _clusterRestClient.ListZones(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs similarity index 59% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs index 3f2fb7336422..71dc9463c665 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs @@ -18,28 +18,28 @@ namespace Azure.ResourceManager.Avs { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetAvsPrivateCloudDatastores method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDatastores method from an instance of . /// - public partial class AvsPrivateCloudDatastoreCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class DatastoreCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _avsPrivateCloudDatastoreDatastoresClientDiagnostics; - private readonly DatastoresRestOperations _avsPrivateCloudDatastoreDatastoresRestClient; + private readonly ClientDiagnostics _datastoreClientDiagnostics; + private readonly DatastoresRestOperations _datastoreRestClient; - /// Initializes a new instance of the class for mocking. - protected AvsPrivateCloudDatastoreCollection() + /// Initializes a new instance of the class for mocking. + protected DatastoreCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal AvsPrivateCloudDatastoreCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal DatastoreCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsPrivateCloudDatastoreDatastoresClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", AvsPrivateCloudDatastoreResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(AvsPrivateCloudDatastoreResource.ResourceType, out string avsPrivateCloudDatastoreDatastoresApiVersion); - _avsPrivateCloudDatastoreDatastoresRestClient = new DatastoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsPrivateCloudDatastoreDatastoresApiVersion); + _datastoreClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", DatastoreResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DatastoreResource.ResourceType, out string datastoreApiVersion); + _datastoreRestClient = new DatastoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, datastoreApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -47,8 +47,8 @@ internal AvsPrivateCloudDatastoreCollection(ArmClient client, ResourceIdentifier internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudClusterResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudClusterResource.ResourceType), nameof(id)); + if (id.ResourceType != ClusterResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ClusterResource.ResourceType), nameof(id)); } /// @@ -60,15 +60,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Datastores_CreateOrUpdate + /// Datastore_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -78,17 +78,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string datastoreName, AvsPrivateCloudDatastoreData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string datastoreName, DatastoreData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreCollection.CreateOrUpdate"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _avsPrivateCloudDatastoreDatastoresRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new AvsPrivateCloudDatastoreOperationSource(Client), _avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, _avsPrivateCloudDatastoreDatastoresRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _datastoreRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new DatastoreOperationSource(Client), _datastoreClientDiagnostics, Pipeline, _datastoreRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -109,15 +109,15 @@ public virtual async Task> Create /// /// /// Operation Id - /// Datastores_CreateOrUpdate + /// Datastore_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -127,17 +127,17 @@ public virtual async Task> Create /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string datastoreName, AvsPrivateCloudDatastoreData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string datastoreName, DatastoreData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreCollection.CreateOrUpdate"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreCollection.CreateOrUpdate"); scope.Start(); try { - var response = _avsPrivateCloudDatastoreDatastoresRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, data, cancellationToken); - var operation = new AvsArmOperation(new AvsPrivateCloudDatastoreOperationSource(Client), _avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, _avsPrivateCloudDatastoreDatastoresRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _datastoreRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, data, cancellationToken); + var operation = new AvsArmOperation(new DatastoreOperationSource(Client), _datastoreClientDiagnostics, Pipeline, _datastoreRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -158,15 +158,15 @@ public virtual ArmOperation CreateOrUpdate(Wai /// /// /// Operation Id - /// Datastores_Get + /// Datastore_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -174,18 +174,18 @@ public virtual ArmOperation CreateOrUpdate(Wai /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string datastoreName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string datastoreName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreCollection.Get"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreCollection.Get"); scope.Start(); try { - var response = await _avsPrivateCloudDatastoreDatastoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken).ConfigureAwait(false); + var response = await _datastoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudDatastoreResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new DatastoreResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -203,15 +203,15 @@ public virtual async Task> GetAsync(s /// /// /// Operation Id - /// Datastores_Get + /// Datastore_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -219,18 +219,18 @@ public virtual async Task> GetAsync(s /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string datastoreName, CancellationToken cancellationToken = default) + public virtual Response Get(string datastoreName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreCollection.Get"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreCollection.Get"); scope.Start(); try { - var response = _avsPrivateCloudDatastoreDatastoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken); + var response = _datastoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudDatastoreResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new DatastoreResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -248,25 +248,25 @@ public virtual Response Get(string datastoreNa /// /// /// Operation Id - /// Datastores_List + /// Datastore_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudDatastoreDatastoresRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudDatastoreDatastoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudDatastoreResource(Client, AvsPrivateCloudDatastoreData.DeserializeAvsPrivateCloudDatastoreData(e)), _avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, "AvsPrivateCloudDatastoreCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _datastoreRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _datastoreRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatastoreResource(Client, DatastoreData.DeserializeDatastoreData(e)), _datastoreClientDiagnostics, Pipeline, "DatastoreCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -278,25 +278,25 @@ public virtual AsyncPageable GetAllAsync(Cance /// /// /// Operation Id - /// Datastores_List + /// Datastore_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudDatastoreDatastoresRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudDatastoreDatastoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudDatastoreResource(Client, AvsPrivateCloudDatastoreData.DeserializeAvsPrivateCloudDatastoreData(e)), _avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, "AvsPrivateCloudDatastoreCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _datastoreRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _datastoreRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatastoreResource(Client, DatastoreData.DeserializeDatastoreData(e)), _datastoreClientDiagnostics, Pipeline, "DatastoreCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -308,15 +308,15 @@ public virtual Pageable GetAll(CancellationTok /// /// /// Operation Id - /// Datastores_Get + /// Datastore_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -328,11 +328,11 @@ public virtual async Task> ExistsAsync(string datastoreName, Canc { Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreCollection.Exists"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreCollection.Exists"); scope.Start(); try { - var response = await _avsPrivateCloudDatastoreDatastoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _datastoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -351,15 +351,15 @@ public virtual async Task> ExistsAsync(string datastoreName, Canc /// /// /// Operation Id - /// Datastores_Get + /// Datastore_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -371,11 +371,11 @@ public virtual Response Exists(string datastoreName, CancellationToken can { Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreCollection.Exists"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreCollection.Exists"); scope.Start(); try { - var response = _avsPrivateCloudDatastoreDatastoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken); + var response = _datastoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -394,15 +394,15 @@ public virtual Response Exists(string datastoreName, CancellationToken can /// /// /// Operation Id - /// Datastores_Get + /// Datastore_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -410,18 +410,18 @@ public virtual Response Exists(string datastoreName, CancellationToken can /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string datastoreName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string datastoreName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreCollection.GetIfExists"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreCollection.GetIfExists"); scope.Start(); try { - var response = await _avsPrivateCloudDatastoreDatastoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _datastoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudDatastoreResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatastoreResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -439,15 +439,15 @@ public virtual async Task> Ge /// /// /// Operation Id - /// Datastores_Get + /// Datastore_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -455,18 +455,18 @@ public virtual async Task> Ge /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string datastoreName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string datastoreName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(datastoreName, nameof(datastoreName)); - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreCollection.GetIfExists"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreCollection.GetIfExists"); scope.Start(); try { - var response = _avsPrivateCloudDatastoreDatastoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken); + var response = _datastoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudDatastoreResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatastoreResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -475,7 +475,7 @@ public virtual NullableResponse GetIfExists(st } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -485,7 +485,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.Serialization.cs new file mode 100644 index 000000000000..e0552a26ff8b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.Serialization.cs @@ -0,0 +1,155 @@ +// 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; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class DatastoreData : 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 override 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(DatastoreData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + DatastoreData 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(DatastoreData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatastoreData(document.RootElement, options); + } + + internal static DatastoreData DeserializeDatastoreData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DatastoreProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DatastoreProperties.DeserializeDatastoreProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatastoreData( + id, + name, + type, + systemData, + properties, + 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); + default: + throw new FormatException($"The model {nameof(DatastoreData)} does not support writing '{options.Format}' format."); + } + } + + DatastoreData 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 DeserializeDatastoreData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatastoreData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs new file mode 100644 index 000000000000..b8fa986c223a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing the Datastore data model. + /// A datastore resource + /// + public partial class DatastoreData : ResourceData + { + /// + /// 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 . + public DatastoreData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal DatastoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DatastoreProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public DatastoreProperties Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreResource.Serialization.cs new file mode 100644 index 000000000000..be39640a03ec --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Avs +{ + public partial class DatastoreResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DatastoreData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DatastoreData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreResource.cs similarity index 63% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreResource.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreResource.cs index f5fccd0ff906..432eb24eaa43 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreResource.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.Avs { /// - /// A Class representing an AvsPrivateCloudDatastore along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetAvsPrivateCloudDatastoreResource method. - /// Otherwise you can get one from its parent resource using the GetAvsPrivateCloudDatastore method. + /// A Class representing a Datastore along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDatastoreResource method. + /// Otherwise you can get one from its parent resource using the GetDatastore method. /// - public partial class AvsPrivateCloudDatastoreResource : ArmResource + public partial class DatastoreResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The privateCloudName. @@ -34,35 +34,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _avsPrivateCloudDatastoreDatastoresClientDiagnostics; - private readonly DatastoresRestOperations _avsPrivateCloudDatastoreDatastoresRestClient; - private readonly AvsPrivateCloudDatastoreData _data; + private readonly ClientDiagnostics _datastoreClientDiagnostics; + private readonly DatastoresRestOperations _datastoreRestClient; + private readonly DatastoreData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters/datastores"; - /// Initializes a new instance of the class for mocking. - protected AvsPrivateCloudDatastoreResource() + /// Initializes a new instance of the class for mocking. + protected DatastoreResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal AvsPrivateCloudDatastoreResource(ArmClient client, AvsPrivateCloudDatastoreData data) : this(client, data.Id) + internal DatastoreResource(ArmClient client, DatastoreData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal AvsPrivateCloudDatastoreResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal DatastoreResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsPrivateCloudDatastoreDatastoresClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string avsPrivateCloudDatastoreDatastoresApiVersion); - _avsPrivateCloudDatastoreDatastoresRestClient = new DatastoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsPrivateCloudDatastoreDatastoresApiVersion); + _datastoreClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string datastoreApiVersion); + _datastoreRestClient = new DatastoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, datastoreApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -73,7 +73,7 @@ internal AvsPrivateCloudDatastoreResource(ArmClient client, ResourceIdentifier i /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual AvsPrivateCloudDatastoreData Data + public virtual DatastoreData Data { get { @@ -98,29 +98,29 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Datastores_Get + /// Datastore_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreResource.Get"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreResource.Get"); scope.Start(); try { - var response = await _avsPrivateCloudDatastoreDatastoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _datastoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudDatastoreResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new DatastoreResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -138,29 +138,29 @@ public virtual async Task> GetAsync(C /// /// /// Operation Id - /// Datastores_Get + /// Datastore_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreResource.Get"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreResource.Get"); scope.Start(); try { - var response = _avsPrivateCloudDatastoreDatastoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _datastoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudDatastoreResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new DatastoreResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -178,15 +178,15 @@ public virtual Response Get(CancellationToken /// /// /// Operation Id - /// Datastores_Delete + /// Datastore_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -194,12 +194,12 @@ public virtual Response Get(CancellationToken /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreResource.Delete"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreResource.Delete"); scope.Start(); try { - var response = await _avsPrivateCloudDatastoreDatastoresRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, _avsPrivateCloudDatastoreDatastoresRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _datastoreRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_datastoreClientDiagnostics, Pipeline, _datastoreRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -220,15 +220,15 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// Datastores_Delete + /// Datastore_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -236,12 +236,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreResource.Delete"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreResource.Delete"); scope.Start(); try { - var response = _avsPrivateCloudDatastoreDatastoresRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, _avsPrivateCloudDatastoreDatastoresRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _datastoreRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new AvsArmOperation(_datastoreClientDiagnostics, Pipeline, _datastoreRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -262,15 +262,15 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Datastores_CreateOrUpdate + /// Datastore_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -278,16 +278,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Resource create parameters. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, AvsPrivateCloudDatastoreData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DatastoreData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreResource.Update"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreResource.Update"); scope.Start(); try { - var response = await _avsPrivateCloudDatastoreDatastoresRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new AvsPrivateCloudDatastoreOperationSource(Client), _avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, _avsPrivateCloudDatastoreDatastoresRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _datastoreRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new DatastoreOperationSource(Client), _datastoreClientDiagnostics, Pipeline, _datastoreRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -308,15 +308,15 @@ public virtual async Task> Update /// /// /// Operation Id - /// Datastores_CreateOrUpdate + /// Datastore_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -324,16 +324,16 @@ public virtual async Task> Update /// Resource create parameters. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, AvsPrivateCloudDatastoreData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, DatastoreData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudDatastoreDatastoresClientDiagnostics.CreateScope("AvsPrivateCloudDatastoreResource.Update"); + using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreResource.Update"); scope.Start(); try { - var response = _avsPrivateCloudDatastoreDatastoresRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new AvsArmOperation(new AvsPrivateCloudDatastoreOperationSource(Client), _avsPrivateCloudDatastoreDatastoresClientDiagnostics, Pipeline, _avsPrivateCloudDatastoreDatastoresRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _datastoreRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new AvsArmOperation(new DatastoreOperationSource(Client), _datastoreClientDiagnostics, Pipeline, _datastoreRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs index b430c3f597fc..05a91fd1a983 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs @@ -19,8 +19,8 @@ namespace Azure.ResourceManager.Avs { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetExpressRouteAuthorizations method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetExpressRouteAuthorizations method from an instance of . /// public partial class ExpressRouteAuthorizationCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -47,8 +47,8 @@ internal ExpressRouteAuthorizationCollection(ArmClient client, ResourceIdentifie internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudResource.ResourceType), nameof(id)); + if (id.ResourceType != PrivateCloudResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloudResource.ResourceType), nameof(id)); } /// @@ -60,11 +60,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Authorizations_CreateOrUpdate + /// ExpressRouteAuthorization_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -109,11 +109,11 @@ public virtual async Task> Creat /// /// /// Operation Id - /// Authorizations_CreateOrUpdate + /// ExpressRouteAuthorization_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -158,11 +158,11 @@ public virtual ArmOperation CreateOrUpdate(Wa /// /// /// Operation Id - /// Authorizations_Get + /// ExpressRouteAuthorization_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -203,11 +203,11 @@ public virtual async Task> GetAsync( /// /// /// Operation Id - /// Authorizations_Get + /// ExpressRouteAuthorization_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -248,11 +248,11 @@ public virtual Response Get(string authorizat /// /// /// Operation Id - /// Authorizations_List + /// ExpressRouteAuthorization_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -278,11 +278,11 @@ public virtual AsyncPageable GetAllAsync(Canc /// /// /// Operation Id - /// Authorizations_List + /// ExpressRouteAuthorization_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -308,11 +308,11 @@ public virtual Pageable GetAll(CancellationTo /// /// /// Operation Id - /// Authorizations_Get + /// ExpressRouteAuthorization_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -351,11 +351,11 @@ public virtual async Task> ExistsAsync(string authorizationName, /// /// /// Operation Id - /// Authorizations_Get + /// ExpressRouteAuthorization_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -394,11 +394,11 @@ public virtual Response Exists(string authorizationName, CancellationToken /// /// /// Operation Id - /// Authorizations_Get + /// ExpressRouteAuthorization_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -439,11 +439,11 @@ public virtual async Task> G /// /// /// Operation Id - /// Authorizations_Get + /// ExpressRouteAuthorization_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.Serialization.cs index c68407d94029..16f33b351af8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.Serialization.cs @@ -37,29 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(ExpressRouteAuthorizationId)) - { - writer.WritePropertyName("expressRouteAuthorizationId"u8); - writer.WriteStringValue(ExpressRouteAuthorizationId); - } - if (options.Format != "W" && Optional.IsDefined(ExpressRouteAuthorizationKey)) - { - writer.WritePropertyName("expressRouteAuthorizationKey"u8); - writer.WriteStringValue(ExpressRouteAuthorizationKey); - } - if (Optional.IsDefined(ExpressRouteId)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("expressRouteId"u8); - writer.WriteStringValue(ExpressRouteId); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } ExpressRouteAuthorizationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -82,18 +64,24 @@ internal static ExpressRouteAuthorizationData DeserializeExpressRouteAuthorizati { return null; } + ExpressRouteAuthorizationProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - ExpressRouteAuthorizationProvisioningState? provisioningState = default; - ResourceIdentifier expressRouteAuthorizationId = default; - string expressRouteAuthorizationKey = default; - ResourceIdentifier expressRouteId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ExpressRouteAuthorizationProperties.DeserializeExpressRouteAuthorizationProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -118,50 +106,6 @@ internal static ExpressRouteAuthorizationData DeserializeExpressRouteAuthorizati systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new ExpressRouteAuthorizationProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("expressRouteAuthorizationId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - expressRouteAuthorizationId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("expressRouteAuthorizationKey"u8)) - { - expressRouteAuthorizationKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("expressRouteId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - expressRouteId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -173,10 +117,7 @@ internal static ExpressRouteAuthorizationData DeserializeExpressRouteAuthorizati name, type, systemData, - provisioningState, - expressRouteAuthorizationId, - expressRouteAuthorizationKey, - expressRouteId, + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs index 44fde78ecc03..25711b652774 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs @@ -61,27 +61,15 @@ public ExpressRouteAuthorizationData() /// The name. /// The resourceType. /// The systemData. - /// The state of the ExpressRoute Circuit Authorization provisioning. - /// The ID of the ExpressRoute Circuit Authorization. - /// The key of the ExpressRoute Circuit Authorization. - /// The ID of the ExpressRoute Circuit. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal ExpressRouteAuthorizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExpressRouteAuthorizationProvisioningState? provisioningState, ResourceIdentifier expressRouteAuthorizationId, string expressRouteAuthorizationKey, ResourceIdentifier expressRouteId, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ExpressRouteAuthorizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExpressRouteAuthorizationProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - ProvisioningState = provisioningState; - ExpressRouteAuthorizationId = expressRouteAuthorizationId; - ExpressRouteAuthorizationKey = expressRouteAuthorizationKey; - ExpressRouteId = expressRouteId; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The state of the ExpressRoute Circuit Authorization provisioning. - public ExpressRouteAuthorizationProvisioningState? ProvisioningState { get; } - /// The ID of the ExpressRoute Circuit Authorization. - public ResourceIdentifier ExpressRouteAuthorizationId { get; } - /// The key of the ExpressRoute Circuit Authorization. - public string ExpressRouteAuthorizationKey { get; } - /// The ID of the ExpressRoute Circuit. - public ResourceIdentifier ExpressRouteId { get; set; } + /// The resource-specific properties for this resource. + public ExpressRouteAuthorizationProperties Properties { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationResource.cs index 82f3991609a0..db210fdad8b6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationResource.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Avs /// A Class representing an ExpressRouteAuthorization along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetExpressRouteAuthorizationResource method. - /// Otherwise you can get one from its parent resource using the GetExpressRouteAuthorization method. + /// Otherwise you can get one from its parent resource using the GetExpressRouteAuthorization method. /// public partial class ExpressRouteAuthorizationResource : ArmResource { @@ -97,11 +97,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Authorizations_Get + /// ExpressRouteAuthorization_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -137,11 +137,11 @@ public virtual async Task> GetAsync( /// /// /// Operation Id - /// Authorizations_Get + /// ExpressRouteAuthorization_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -177,11 +177,11 @@ public virtual Response Get(CancellationToken /// /// /// Operation Id - /// Authorizations_Delete + /// ExpressRouteAuthorization_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -219,11 +219,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// Authorizations_Delete + /// ExpressRouteAuthorization_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -261,11 +261,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Authorizations_CreateOrUpdate + /// ExpressRouteAuthorization_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -307,11 +307,11 @@ public virtual async Task> Updat /// /// /// Operation Id - /// Authorizations_CreateOrUpdate + /// ExpressRouteAuthorization_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/AvsExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/AvsExtensions.cs index 50ae0b65f1ce..ea2e227e4364 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/AvsExtensions.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/AvsExtensions.cs @@ -34,41 +34,22 @@ private static MockableAvsSubscriptionResource GetMockableAvsSubscriptionResourc } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static AvsPrivateCloudResource GetAvsPrivateCloudResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static AddonResource GetAddonResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetAvsPrivateCloudResource(id); - } - - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static AvsPrivateCloudAddonResource GetAvsPrivateCloudAddonResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableAvsArmClient(client).GetAvsPrivateCloudAddonResource(id); + return GetMockableAvsArmClient(client).GetAddonResource(id); } /// @@ -91,98 +72,60 @@ public static ExpressRouteAuthorizationResource GetExpressRouteAuthorizationReso } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static AvsCloudLinkResource GetAvsCloudLinkResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static CloudLinkResource GetCloudLinkResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetAvsCloudLinkResource(id); + return GetMockableAvsArmClient(client).GetCloudLinkResource(id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static AvsPrivateCloudClusterResource GetAvsPrivateCloudClusterResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ClusterResource GetClusterResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetAvsPrivateCloudClusterResource(id); + return GetMockableAvsArmClient(client).GetClusterResource(id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static AvsPrivateCloudDatastoreResource GetAvsPrivateCloudDatastoreResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static DatastoreResource GetDatastoreResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetAvsPrivateCloudDatastoreResource(id); - } - - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static PlacementPolicyResource GetPlacementPolicyResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableAvsArmClient(client).GetPlacementPolicyResource(id); - } - - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static AvsPrivateCloudClusterVirtualMachineResource GetAvsPrivateCloudClusterVirtualMachineResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableAvsArmClient(client).GetAvsPrivateCloudClusterVirtualMachineResource(id); + return GetMockableAvsArmClient(client).GetDatastoreResource(id); } /// @@ -224,212 +167,212 @@ public static HcxEnterpriseSiteResource GetHcxEnterpriseSiteResource(this ArmCli } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static IscsiPathResource GetIscsiPathResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static HostResource GetHostResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetIscsiPathResource(id); + return GetMockableAvsArmClient(client).GetHostResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ScriptExecutionResource GetScriptExecutionResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static IscsiPathResource GetIscsiPathResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetScriptExecutionResource(id); + return GetMockableAvsArmClient(client).GetIscsiPathResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ScriptPackageResource GetScriptPackageResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static PlacementPolicyResource GetPlacementPolicyResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetScriptPackageResource(id); + return GetMockableAvsArmClient(client).GetPlacementPolicyResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static ScriptCmdletResource GetScriptCmdletResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static PrivateCloudResource GetPrivateCloudResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetScriptCmdletResource(id); + return GetMockableAvsArmClient(client).GetPrivateCloudResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static WorkloadNetworkResource GetWorkloadNetworkResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ProvisionedNetworkResource GetProvisionedNetworkResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetWorkloadNetworkResource(id); + return GetMockableAvsArmClient(client).GetProvisionedNetworkResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static WorkloadNetworkDhcpResource GetWorkloadNetworkDhcpResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static PureStoragePolicyResource GetPureStoragePolicyResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetWorkloadNetworkDhcpResource(id); + return GetMockableAvsArmClient(client).GetPureStoragePolicyResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static WorkloadNetworkDnsServiceResource GetWorkloadNetworkDnsServiceResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ScriptCmdletResource GetScriptCmdletResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetWorkloadNetworkDnsServiceResource(id); + return GetMockableAvsArmClient(client).GetScriptCmdletResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static WorkloadNetworkDnsZoneResource GetWorkloadNetworkDnsZoneResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ScriptExecutionResource GetScriptExecutionResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetWorkloadNetworkDnsZoneResource(id); + return GetMockableAvsArmClient(client).GetScriptExecutionResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static WorkloadNetworkGatewayResource GetWorkloadNetworkGatewayResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ScriptPackageResource GetScriptPackageResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetWorkloadNetworkGatewayResource(id); + return GetMockableAvsArmClient(client).GetScriptPackageResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static WorkloadNetworkPortMirroringProfileResource GetWorkloadNetworkPortMirroringProfileResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static VirtualMachineResource GetVirtualMachineResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetWorkloadNetworkPortMirroringProfileResource(id); + return GetMockableAvsArmClient(client).GetVirtualMachineResource(id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static WorkloadNetworkPublicIPResource GetWorkloadNetworkPublicIPResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static WorkloadNetworkGatewayResource GetWorkloadNetworkGatewayResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetWorkloadNetworkPublicIPResource(id); + return GetMockableAvsArmClient(client).GetWorkloadNetworkGatewayResource(id); } /// @@ -471,39 +414,39 @@ public static WorkloadNetworkVirtualMachineResource GetWorkloadNetworkVirtualMac } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static WorkloadNetworkVmGroupResource GetWorkloadNetworkVmGroupResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static WorkloadNetworkResource GetWorkloadNetworkResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableAvsArmClient(client).GetWorkloadNetworkVmGroupResource(id); + return GetMockableAvsArmClient(client).GetWorkloadNetworkResource(id); } /// - /// Gets a collection of AvsPrivateCloudResources in the ResourceGroupResource. + /// Gets a collection of PrivateCloudResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of AvsPrivateCloudResources and their operations over a AvsPrivateCloudResource. - public static AvsPrivateCloudCollection GetAvsPrivateClouds(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of PrivateCloudResources and their operations over a PrivateCloudResource. + public static PrivateCloudCollection GetPrivateClouds(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableAvsResourceGroupResource(resourceGroupResource).GetAvsPrivateClouds(); + return GetMockableAvsResourceGroupResource(resourceGroupResource).GetPrivateClouds(); } /// @@ -515,20 +458,20 @@ public static AvsPrivateCloudCollection GetAvsPrivateClouds(this ResourceGroupRe /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -537,11 +480,11 @@ public static AvsPrivateCloudCollection GetAvsPrivateClouds(this ResourceGroupRe /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetAvsPrivateCloudAsync(this ResourceGroupResource resourceGroupResource, string privateCloudName, CancellationToken cancellationToken = default) + public static async Task> GetPrivateCloudAsync(this ResourceGroupResource resourceGroupResource, string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableAvsResourceGroupResource(resourceGroupResource).GetAvsPrivateCloudAsync(privateCloudName, cancellationToken).ConfigureAwait(false); + return await GetMockableAvsResourceGroupResource(resourceGroupResource).GetPrivateCloudAsync(privateCloudName, cancellationToken).ConfigureAwait(false); } /// @@ -553,20 +496,20 @@ public static async Task> GetAvsPrivateCloudAs /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -575,43 +518,79 @@ public static async Task> GetAvsPrivateCloudAs /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetAvsPrivateCloud(this ResourceGroupResource resourceGroupResource, string privateCloudName, CancellationToken cancellationToken = default) + public static Response GetPrivateCloud(this ResourceGroupResource resourceGroupResource, string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableAvsResourceGroupResource(resourceGroupResource).GetAvsPrivateCloud(privateCloudName, cancellationToken); + return GetMockableAvsResourceGroupResource(resourceGroupResource).GetPrivateCloud(privateCloudName, cancellationToken); } /// - /// Return quota for subscription by region + /// Return trial status for subscription by region /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability /// /// /// Operation Id - /// Locations_CheckQuotaAvailability + /// Locations_CheckTrialAvailability /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the Azure region. + /// A location in a subscription. + /// Optionally, check for a specific SKU. /// The cancellation token to use. - /// is null. - public static async Task> CheckAvsQuotaAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public static async Task> CheckTrialAvailabilityLocationAsync(this SubscriptionResource subscriptionResource, string location, AvsSku sku = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableAvsSubscriptionResource(subscriptionResource).CheckTrialAvailabilityLocationAsync(location, sku, cancellationToken).ConfigureAwait(false); + } + + /// + /// Return trial status for subscription by region + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability + /// + /// + /// Operation Id + /// Locations_CheckTrialAvailability + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// A location in a subscription. + /// Optionally, check for a specific SKU. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public static Response CheckTrialAvailabilityLocation(this SubscriptionResource subscriptionResource, string location, AvsSku sku = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableAvsSubscriptionResource(subscriptionResource).CheckAvsQuotaAvailabilityAsync(location, cancellationToken).ConfigureAwait(false); + return GetMockableAvsSubscriptionResource(subscriptionResource).CheckTrialAvailabilityLocation(location, sku, cancellationToken); } /// @@ -627,89 +606,93 @@ public static async Task> Check /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the Azure region. + /// A location in a subscription. /// The cancellation token to use. - /// is null. - public static Response CheckAvsQuotaAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public static async Task> CheckQuotaAvailabilityLocationAsync(this SubscriptionResource subscriptionResource, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableAvsSubscriptionResource(subscriptionResource).CheckAvsQuotaAvailability(location, cancellationToken); + return await GetMockableAvsSubscriptionResource(subscriptionResource).CheckQuotaAvailabilityLocationAsync(location, cancellationToken).ConfigureAwait(false); } /// - /// Return trial status for subscription by region + /// Return quota for subscription by region /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability /// /// /// Operation Id - /// Locations_CheckTrialAvailability + /// Locations_CheckQuotaAvailability /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the Azure region. - /// Optionally, check for a specific SKU. + /// A location in a subscription. /// The cancellation token to use. - /// is null. - public static async Task> CheckAvsTrialAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public static Response CheckQuotaAvailabilityLocation(this SubscriptionResource subscriptionResource, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableAvsSubscriptionResource(subscriptionResource).CheckAvsTrialAvailabilityAsync(location, sku, cancellationToken).ConfigureAwait(false); + return GetMockableAvsSubscriptionResource(subscriptionResource).CheckQuotaAvailabilityLocation(location, cancellationToken); } /// - /// Return trial status for subscription by region + /// List PrivateCloud resources by subscription ID /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds /// /// /// Operation Id - /// Locations_CheckTrialAvailability + /// PrivateCloud_ListInSubscription /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 + /// + /// + /// Resource + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the Azure region. - /// Optionally, check for a specific SKU. /// The cancellation token to use. /// is null. - public static Response CheckAvsTrialAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetPrivateCloudsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableAvsSubscriptionResource(subscriptionResource).CheckAvsTrialAvailability(location, sku, cancellationToken); + return GetMockableAvsSubscriptionResource(subscriptionResource).GetPrivateCloudsAsync(cancellationToken); } /// @@ -721,67 +704,95 @@ public static Response CheckAvsTrialAvai /// /// /// Operation Id - /// PrivateClouds_ListInSubscription + /// PrivateCloud_ListInSubscription /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetAvsPrivateCloudsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetPrivateClouds(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableAvsSubscriptionResource(subscriptionResource).GetAvsPrivateCloudsAsync(cancellationToken); + return GetMockableAvsSubscriptionResource(subscriptionResource).GetPrivateClouds(cancellationToken); } /// - /// List PrivateCloud resources by subscription ID + /// A list of SKUs. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/skus /// /// /// Operation Id - /// PrivateClouds_ListInSubscription + /// Skus_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// + /// /// - /// Resource - /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAvsSubscriptionResource(subscriptionResource).GetSkusAsync(cancellationToken); + } + + /// + /// A list of SKUs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// Default Api Version + /// 2024-09-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetAvsPrivateClouds(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableAvsSubscriptionResource(subscriptionResource).GetAvsPrivateClouds(cancellationToken); + return GetMockableAvsSubscriptionResource(subscriptionResource).GetSkus(cancellationToken); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsArmClient.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsArmClient.cs index daf42488f4d4..6db0efc5c624 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsArmClient.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsArmClient.cs @@ -35,27 +35,15 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual AvsPrivateCloudResource GetAvsPrivateCloudResource(ResourceIdentifier id) + /// Returns a object. + public virtual AddonResource GetAddonResource(ResourceIdentifier id) { - AvsPrivateCloudResource.ValidateResourceId(id); - return new AvsPrivateCloudResource(Client, id); - } - - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual AvsPrivateCloudAddonResource GetAvsPrivateCloudAddonResource(ResourceIdentifier id) - { - AvsPrivateCloudAddonResource.ValidateResourceId(id); - return new AvsPrivateCloudAddonResource(Client, id); + AddonResource.ValidateResourceId(id); + return new AddonResource(Client, id); } /// @@ -71,63 +59,39 @@ public virtual ExpressRouteAuthorizationResource GetExpressRouteAuthorizationRes } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual AvsCloudLinkResource GetAvsCloudLinkResource(ResourceIdentifier id) - { - AvsCloudLinkResource.ValidateResourceId(id); - return new AvsCloudLinkResource(Client, id); - } - - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual AvsPrivateCloudClusterResource GetAvsPrivateCloudClusterResource(ResourceIdentifier id) - { - AvsPrivateCloudClusterResource.ValidateResourceId(id); - return new AvsPrivateCloudClusterResource(Client, id); - } - - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual AvsPrivateCloudDatastoreResource GetAvsPrivateCloudDatastoreResource(ResourceIdentifier id) + /// Returns a object. + public virtual CloudLinkResource GetCloudLinkResource(ResourceIdentifier id) { - AvsPrivateCloudDatastoreResource.ValidateResourceId(id); - return new AvsPrivateCloudDatastoreResource(Client, id); + CloudLinkResource.ValidateResourceId(id); + return new CloudLinkResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual PlacementPolicyResource GetPlacementPolicyResource(ResourceIdentifier id) + /// Returns a object. + public virtual ClusterResource GetClusterResource(ResourceIdentifier id) { - PlacementPolicyResource.ValidateResourceId(id); - return new PlacementPolicyResource(Client, id); + ClusterResource.ValidateResourceId(id); + return new ClusterResource(Client, id); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual AvsPrivateCloudClusterVirtualMachineResource GetAvsPrivateCloudClusterVirtualMachineResource(ResourceIdentifier id) + /// Returns a object. + public virtual DatastoreResource GetDatastoreResource(ResourceIdentifier id) { - AvsPrivateCloudClusterVirtualMachineResource.ValidateResourceId(id); - return new AvsPrivateCloudClusterVirtualMachineResource(Client, id); + DatastoreResource.ValidateResourceId(id); + return new DatastoreResource(Client, id); } /// @@ -155,135 +119,135 @@ public virtual HcxEnterpriseSiteResource GetHcxEnterpriseSiteResource(ResourceId } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual IscsiPathResource GetIscsiPathResource(ResourceIdentifier id) + /// Returns a object. + public virtual HostResource GetHostResource(ResourceIdentifier id) { - IscsiPathResource.ValidateResourceId(id); - return new IscsiPathResource(Client, id); + HostResource.ValidateResourceId(id); + return new HostResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ScriptExecutionResource GetScriptExecutionResource(ResourceIdentifier id) + /// Returns a object. + public virtual IscsiPathResource GetIscsiPathResource(ResourceIdentifier id) { - ScriptExecutionResource.ValidateResourceId(id); - return new ScriptExecutionResource(Client, id); + IscsiPathResource.ValidateResourceId(id); + return new IscsiPathResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ScriptPackageResource GetScriptPackageResource(ResourceIdentifier id) + /// Returns a object. + public virtual PlacementPolicyResource GetPlacementPolicyResource(ResourceIdentifier id) { - ScriptPackageResource.ValidateResourceId(id); - return new ScriptPackageResource(Client, id); + PlacementPolicyResource.ValidateResourceId(id); + return new PlacementPolicyResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ScriptCmdletResource GetScriptCmdletResource(ResourceIdentifier id) + /// Returns a object. + public virtual PrivateCloudResource GetPrivateCloudResource(ResourceIdentifier id) { - ScriptCmdletResource.ValidateResourceId(id); - return new ScriptCmdletResource(Client, id); + PrivateCloudResource.ValidateResourceId(id); + return new PrivateCloudResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual WorkloadNetworkResource GetWorkloadNetworkResource(ResourceIdentifier id) + /// Returns a object. + public virtual ProvisionedNetworkResource GetProvisionedNetworkResource(ResourceIdentifier id) { - WorkloadNetworkResource.ValidateResourceId(id); - return new WorkloadNetworkResource(Client, id); + ProvisionedNetworkResource.ValidateResourceId(id); + return new ProvisionedNetworkResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual WorkloadNetworkDhcpResource GetWorkloadNetworkDhcpResource(ResourceIdentifier id) + /// Returns a object. + public virtual PureStoragePolicyResource GetPureStoragePolicyResource(ResourceIdentifier id) { - WorkloadNetworkDhcpResource.ValidateResourceId(id); - return new WorkloadNetworkDhcpResource(Client, id); + PureStoragePolicyResource.ValidateResourceId(id); + return new PureStoragePolicyResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual WorkloadNetworkDnsServiceResource GetWorkloadNetworkDnsServiceResource(ResourceIdentifier id) + /// Returns a object. + public virtual ScriptCmdletResource GetScriptCmdletResource(ResourceIdentifier id) { - WorkloadNetworkDnsServiceResource.ValidateResourceId(id); - return new WorkloadNetworkDnsServiceResource(Client, id); + ScriptCmdletResource.ValidateResourceId(id); + return new ScriptCmdletResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual WorkloadNetworkDnsZoneResource GetWorkloadNetworkDnsZoneResource(ResourceIdentifier id) + /// Returns a object. + public virtual ScriptExecutionResource GetScriptExecutionResource(ResourceIdentifier id) { - WorkloadNetworkDnsZoneResource.ValidateResourceId(id); - return new WorkloadNetworkDnsZoneResource(Client, id); + ScriptExecutionResource.ValidateResourceId(id); + return new ScriptExecutionResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual WorkloadNetworkGatewayResource GetWorkloadNetworkGatewayResource(ResourceIdentifier id) + /// Returns a object. + public virtual ScriptPackageResource GetScriptPackageResource(ResourceIdentifier id) { - WorkloadNetworkGatewayResource.ValidateResourceId(id); - return new WorkloadNetworkGatewayResource(Client, id); + ScriptPackageResource.ValidateResourceId(id); + return new ScriptPackageResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual WorkloadNetworkPortMirroringProfileResource GetWorkloadNetworkPortMirroringProfileResource(ResourceIdentifier id) + /// Returns a object. + public virtual VirtualMachineResource GetVirtualMachineResource(ResourceIdentifier id) { - WorkloadNetworkPortMirroringProfileResource.ValidateResourceId(id); - return new WorkloadNetworkPortMirroringProfileResource(Client, id); + VirtualMachineResource.ValidateResourceId(id); + return new VirtualMachineResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual WorkloadNetworkPublicIPResource GetWorkloadNetworkPublicIPResource(ResourceIdentifier id) + /// Returns a object. + public virtual WorkloadNetworkGatewayResource GetWorkloadNetworkGatewayResource(ResourceIdentifier id) { - WorkloadNetworkPublicIPResource.ValidateResourceId(id); - return new WorkloadNetworkPublicIPResource(Client, id); + WorkloadNetworkGatewayResource.ValidateResourceId(id); + return new WorkloadNetworkGatewayResource(Client, id); } /// @@ -311,15 +275,15 @@ public virtual WorkloadNetworkVirtualMachineResource GetWorkloadNetworkVirtualMa } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual WorkloadNetworkVmGroupResource GetWorkloadNetworkVmGroupResource(ResourceIdentifier id) + /// Returns a object. + public virtual WorkloadNetworkResource GetWorkloadNetworkResource(ResourceIdentifier id) { - WorkloadNetworkVmGroupResource.ValidateResourceId(id); - return new WorkloadNetworkVmGroupResource(Client, id); + WorkloadNetworkResource.ValidateResourceId(id); + return new WorkloadNetworkResource(Client, id); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsResourceGroupResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsResourceGroupResource.cs index 13641e496b0f..85097f2817e0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsResourceGroupResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsResourceGroupResource.cs @@ -33,11 +33,11 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// Gets a collection of AvsPrivateCloudResources in the ResourceGroupResource. - /// An object representing collection of AvsPrivateCloudResources and their operations over a AvsPrivateCloudResource. - public virtual AvsPrivateCloudCollection GetAvsPrivateClouds() + /// Gets a collection of PrivateCloudResources in the ResourceGroupResource. + /// An object representing collection of PrivateCloudResources and their operations over a PrivateCloudResource. + public virtual PrivateCloudCollection GetPrivateClouds() { - return GetCachedClient(client => new AvsPrivateCloudCollection(client, Id)); + return GetCachedClient(client => new PrivateCloudCollection(client, Id)); } /// @@ -49,15 +49,15 @@ public virtual AvsPrivateCloudCollection GetAvsPrivateClouds() /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -66,9 +66,9 @@ public virtual AvsPrivateCloudCollection GetAvsPrivateClouds() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetAvsPrivateCloudAsync(string privateCloudName, CancellationToken cancellationToken = default) + public virtual async Task> GetPrivateCloudAsync(string privateCloudName, CancellationToken cancellationToken = default) { - return await GetAvsPrivateClouds().GetAsync(privateCloudName, cancellationToken).ConfigureAwait(false); + return await GetPrivateClouds().GetAsync(privateCloudName, cancellationToken).ConfigureAwait(false); } /// @@ -80,15 +80,15 @@ public virtual async Task> GetAvsPrivateCloudA /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -97,9 +97,9 @@ public virtual async Task> GetAvsPrivateCloudA /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetAvsPrivateCloud(string privateCloudName, CancellationToken cancellationToken = default) + public virtual Response GetPrivateCloud(string privateCloudName, CancellationToken cancellationToken = default) { - return GetAvsPrivateClouds().Get(privateCloudName, cancellationToken); + return GetPrivateClouds().Get(privateCloudName, cancellationToken); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsSubscriptionResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsSubscriptionResource.cs index 343d2169e16b..4f946eeaff56 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsSubscriptionResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsSubscriptionResource.cs @@ -20,8 +20,10 @@ public partial class MockableAvsSubscriptionResource : ArmResource { private ClientDiagnostics _locationsClientDiagnostics; private LocationsRestOperations _locationsRestClient; - private ClientDiagnostics _avsPrivateCloudPrivateCloudsClientDiagnostics; - private PrivateCloudsRestOperations _avsPrivateCloudPrivateCloudsRestClient; + private ClientDiagnostics _privateCloudClientDiagnostics; + private PrivateCloudsRestOperations _privateCloudRestClient; + private ClientDiagnostics _skusClientDiagnostics; + private SkusRestOperations _skusRestClient; /// Initializes a new instance of the class for mocking. protected MockableAvsSubscriptionResource() @@ -37,8 +39,10 @@ internal MockableAvsSubscriptionResource(ArmClient client, ResourceIdentifier id private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Avs", ProviderConstants.DefaultProviderNamespace, Diagnostics); private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AvsPrivateCloudPrivateCloudsClientDiagnostics => _avsPrivateCloudPrivateCloudsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Avs", AvsPrivateCloudResource.ResourceType.Namespace, Diagnostics); - private PrivateCloudsRestOperations AvsPrivateCloudPrivateCloudsRestClient => _avsPrivateCloudPrivateCloudsRestClient ??= new PrivateCloudsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AvsPrivateCloudResource.ResourceType)); + private ClientDiagnostics PrivateCloudClientDiagnostics => _privateCloudClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Avs", PrivateCloudResource.ResourceType.Namespace, Diagnostics); + private PrivateCloudsRestOperations PrivateCloudRestClient => _privateCloudRestClient ??= new PrivateCloudsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PrivateCloudResource.ResourceType)); + private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Avs", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -47,31 +51,36 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// Return quota for subscription by region + /// Return trial status for subscription by region /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability /// /// /// Operation Id - /// Locations_CheckQuotaAvailability + /// Locations_CheckTrialAvailability /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// - /// The name of the Azure region. + /// A location in a subscription. + /// Optionally, check for a specific SKU. /// The cancellation token to use. - public virtual async Task> CheckAvsQuotaAvailabilityAsync(AzureLocation location, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CheckTrialAvailabilityLocationAsync(string location, AvsSku sku = null, CancellationToken cancellationToken = default) { - using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckAvsQuotaAvailability"); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckTrialAvailabilityLocation"); scope.Start(); try { - var response = await LocationsRestClient.CheckQuotaAvailabilityAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + var response = await LocationsRestClient.CheckTrialAvailabilityAsync(Id.SubscriptionId, location, sku, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -82,31 +91,36 @@ public virtual async Task> Chec } /// - /// Return quota for subscription by region + /// Return trial status for subscription by region /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability /// /// /// Operation Id - /// Locations_CheckQuotaAvailability + /// Locations_CheckTrialAvailability /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// - /// The name of the Azure region. + /// A location in a subscription. + /// Optionally, check for a specific SKU. /// The cancellation token to use. - public virtual Response CheckAvsQuotaAvailability(AzureLocation location, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CheckTrialAvailabilityLocation(string location, AvsSku sku = null, CancellationToken cancellationToken = default) { - using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckAvsQuotaAvailability"); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckTrialAvailabilityLocation"); scope.Start(); try { - var response = LocationsRestClient.CheckQuotaAvailability(Id.SubscriptionId, location, cancellationToken); + var response = LocationsRestClient.CheckTrialAvailability(Id.SubscriptionId, location, sku, cancellationToken); return response; } catch (Exception e) @@ -117,32 +131,35 @@ public virtual Response CheckAvsQuotaAva } /// - /// Return trial status for subscription by region + /// Return quota for subscription by region /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability /// /// /// Operation Id - /// Locations_CheckTrialAvailability + /// Locations_CheckQuotaAvailability /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// - /// The name of the Azure region. - /// Optionally, check for a specific SKU. + /// A location in a subscription. /// The cancellation token to use. - public virtual async Task> CheckAvsTrialAvailabilityAsync(AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CheckQuotaAvailabilityLocationAsync(string location, CancellationToken cancellationToken = default) { - using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckAvsTrialAvailability"); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckQuotaAvailabilityLocation"); scope.Start(); try { - var response = await LocationsRestClient.CheckTrialAvailabilityAsync(Id.SubscriptionId, location, sku, cancellationToken).ConfigureAwait(false); + var response = await LocationsRestClient.CheckQuotaAvailabilityAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -153,32 +170,35 @@ public virtual async Task> Chec } /// - /// Return trial status for subscription by region + /// Return quota for subscription by region /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability /// /// /// Operation Id - /// Locations_CheckTrialAvailability + /// Locations_CheckQuotaAvailability /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// - /// The name of the Azure region. - /// Optionally, check for a specific SKU. + /// A location in a subscription. /// The cancellation token to use. - public virtual Response CheckAvsTrialAvailability(AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CheckQuotaAvailabilityLocation(string location, CancellationToken cancellationToken = default) { - using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckAvsTrialAvailability"); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckQuotaAvailabilityLocation"); scope.Start(); try { - var response = LocationsRestClient.CheckTrialAvailability(Id.SubscriptionId, location, sku, cancellationToken); + var response = LocationsRestClient.CheckQuotaAvailability(Id.SubscriptionId, location, cancellationToken); return response; } catch (Exception e) @@ -197,25 +217,25 @@ public virtual Response CheckAvsTrialAva /// /// /// Operation Id - /// PrivateClouds_ListInSubscription + /// PrivateCloud_ListInSubscription /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvsPrivateCloudsAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPrivateCloudsAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), AvsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "MockableAvsSubscriptionResource.GetAvsPrivateClouds", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateCloudRestClient.CreateListInSubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateCloudRestClient.CreateListInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PrivateCloudResource(Client, PrivateCloudData.DeserializePrivateCloudData(e)), PrivateCloudClientDiagnostics, Pipeline, "MockableAvsSubscriptionResource.GetPrivateClouds", "value", "nextLink", cancellationToken); } /// @@ -227,25 +247,77 @@ public virtual AsyncPageable GetAvsPrivateCloudsAsync(C /// /// /// Operation Id - /// PrivateClouds_ListInSubscription + /// PrivateCloud_ListInSubscription /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPrivateClouds(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateCloudRestClient.CreateListInSubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateCloudRestClient.CreateListInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PrivateCloudResource(Client, PrivateCloudData.DeserializePrivateCloudData(e)), PrivateCloudClientDiagnostics, Pipeline, "MockableAvsSubscriptionResource.GetPrivateClouds", "value", "nextLink", cancellationToken); + } + + /// + /// A list of SKUs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ResourceSku.DeserializeResourceSku(e), SkusClientDiagnostics, Pipeline, "MockableAvsSubscriptionResource.GetSkus", "value", "nextLink", cancellationToken); + } + + /// + /// A list of SKUs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// Default Api Version + /// 2024-09-01 /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvsPrivateClouds(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkus(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), AvsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "MockableAvsSubscriptionResource.GetAvsPrivateClouds", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ResourceSku.DeserializeResourceSku(e), SkusClientDiagnostics, Pipeline, "MockableAvsSubscriptionResource.GetSkus", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs index 236924e4f6fa..63142e39f5ca 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs @@ -19,8 +19,8 @@ namespace Azure.ResourceManager.Avs { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetGlobalReachConnections method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetGlobalReachConnections method from an instance of . /// public partial class GlobalReachConnectionCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -47,8 +47,8 @@ internal GlobalReachConnectionCollection(ArmClient client, ResourceIdentifier id internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudResource.ResourceType), nameof(id)); + if (id.ResourceType != PrivateCloudResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloudResource.ResourceType), nameof(id)); } /// @@ -60,11 +60,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// GlobalReachConnections_CreateOrUpdate + /// GlobalReachConnection_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -109,11 +109,11 @@ public virtual async Task> CreateOrU /// /// /// Operation Id - /// GlobalReachConnections_CreateOrUpdate + /// GlobalReachConnection_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -158,11 +158,11 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// /// /// Operation Id - /// GlobalReachConnections_Get + /// GlobalReachConnection_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -203,11 +203,11 @@ public virtual async Task> GetAsync(stri /// /// /// Operation Id - /// GlobalReachConnections_Get + /// GlobalReachConnection_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -248,11 +248,11 @@ public virtual Response Get(string globalReachCon /// /// /// Operation Id - /// GlobalReachConnections_List + /// GlobalReachConnection_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -278,11 +278,11 @@ public virtual AsyncPageable GetAllAsync(Cancella /// /// /// Operation Id - /// GlobalReachConnections_List + /// GlobalReachConnection_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -308,11 +308,11 @@ public virtual Pageable GetAll(CancellationToken /// /// /// Operation Id - /// GlobalReachConnections_Get + /// GlobalReachConnection_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -351,11 +351,11 @@ public virtual async Task> ExistsAsync(string globalReachConnecti /// /// /// Operation Id - /// GlobalReachConnections_Get + /// GlobalReachConnection_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -394,11 +394,11 @@ public virtual Response Exists(string globalReachConnectionName, Cancellat /// /// /// Operation Id - /// GlobalReachConnections_Get + /// GlobalReachConnection_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -439,11 +439,11 @@ public virtual async Task> GetIf /// /// /// Operation Id - /// GlobalReachConnections_Get + /// GlobalReachConnection_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.Serialization.cs index 47aead90e867..dd8d7028981f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.Serialization.cs @@ -37,39 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(AddressPrefix)) - { - writer.WritePropertyName("addressPrefix"u8); - writer.WriteStringValue(AddressPrefix); - } - if (Optional.IsDefined(AuthorizationKey)) - { - writer.WritePropertyName("authorizationKey"u8); - writer.WriteStringValue(AuthorizationKey); - } - if (options.Format != "W" && Optional.IsDefined(CircuitConnectionStatus)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("circuitConnectionStatus"u8); - writer.WriteStringValue(CircuitConnectionStatus.Value.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(PeerExpressRouteCircuit)) - { - writer.WritePropertyName("peerExpressRouteCircuit"u8); - writer.WriteStringValue(PeerExpressRouteCircuit); - } - if (Optional.IsDefined(ExpressRouteId)) - { - writer.WritePropertyName("expressRouteId"u8); - writer.WriteStringValue(ExpressRouteId); - } - writer.WriteEndObject(); } GlobalReachConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -92,20 +64,24 @@ internal static GlobalReachConnectionData DeserializeGlobalReachConnectionData(J { return null; } + GlobalReachConnectionProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - GlobalReachConnectionProvisioningState? provisioningState = default; - string addressPrefix = default; - string authorizationKey = default; - GlobalReachConnectionStatus? circuitConnectionStatus = default; - ResourceIdentifier peerExpressRouteCircuit = default; - ResourceIdentifier expressRouteId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = GlobalReachConnectionProperties.DeserializeGlobalReachConnectionProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -130,64 +106,6 @@ internal static GlobalReachConnectionData DeserializeGlobalReachConnectionData(J systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new GlobalReachConnectionProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("addressPrefix"u8)) - { - addressPrefix = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("authorizationKey"u8)) - { - authorizationKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("circuitConnectionStatus"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - circuitConnectionStatus = new GlobalReachConnectionStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("peerExpressRouteCircuit"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - peerExpressRouteCircuit = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("expressRouteId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - expressRouteId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -199,12 +117,7 @@ internal static GlobalReachConnectionData DeserializeGlobalReachConnectionData(J name, type, systemData, - provisioningState, - addressPrefix, - authorizationKey, - circuitConnectionStatus, - peerExpressRouteCircuit, - expressRouteId, + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs index d2053e09b5a5..8ffb54b4506e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs @@ -61,59 +61,15 @@ public GlobalReachConnectionData() /// The name. /// The resourceType. /// The systemData. - /// The state of the ExpressRoute Circuit Authorization provisioning. - /// - /// The network used for global reach carved out from the original network block - /// provided for the private cloud - /// - /// - /// Authorization key from the peer express route used for the global reach - /// connection - /// - /// The connection status of the global reach connection. - /// - /// Identifier of the ExpressRoute Circuit to peer with in the global reach - /// connection - /// - /// - /// The ID of the Private Cloud's ExpressRoute Circuit that is participating in the - /// global reach connection - /// + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal GlobalReachConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GlobalReachConnectionProvisioningState? provisioningState, string addressPrefix, string authorizationKey, GlobalReachConnectionStatus? circuitConnectionStatus, ResourceIdentifier peerExpressRouteCircuit, ResourceIdentifier expressRouteId, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal GlobalReachConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, GlobalReachConnectionProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - ProvisioningState = provisioningState; - AddressPrefix = addressPrefix; - AuthorizationKey = authorizationKey; - CircuitConnectionStatus = circuitConnectionStatus; - PeerExpressRouteCircuit = peerExpressRouteCircuit; - ExpressRouteId = expressRouteId; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The state of the ExpressRoute Circuit Authorization provisioning. - public GlobalReachConnectionProvisioningState? ProvisioningState { get; } - /// - /// The network used for global reach carved out from the original network block - /// provided for the private cloud - /// - public string AddressPrefix { get; } - /// - /// Authorization key from the peer express route used for the global reach - /// connection - /// - public string AuthorizationKey { get; set; } - /// The connection status of the global reach connection. - public GlobalReachConnectionStatus? CircuitConnectionStatus { get; } - /// - /// Identifier of the ExpressRoute Circuit to peer with in the global reach - /// connection - /// - public ResourceIdentifier PeerExpressRouteCircuit { get; set; } - /// - /// The ID of the Private Cloud's ExpressRoute Circuit that is participating in the - /// global reach connection - /// - public ResourceIdentifier ExpressRouteId { get; set; } + /// The resource-specific properties for this resource. + public GlobalReachConnectionProperties Properties { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionResource.cs index 66f72b742510..e0922399290d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionResource.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Avs /// A Class representing a GlobalReachConnection along with the instance operations that can be performed on it. /// If you have a you can construct a /// from an instance of using the GetGlobalReachConnectionResource method. - /// Otherwise you can get one from its parent resource using the GetGlobalReachConnection method. + /// Otherwise you can get one from its parent resource using the GetGlobalReachConnection method. /// public partial class GlobalReachConnectionResource : ArmResource { @@ -97,11 +97,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// GlobalReachConnections_Get + /// GlobalReachConnection_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -137,11 +137,11 @@ public virtual async Task> GetAsync(Canc /// /// /// Operation Id - /// GlobalReachConnections_Get + /// GlobalReachConnection_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -177,11 +177,11 @@ public virtual Response Get(CancellationToken can /// /// /// Operation Id - /// GlobalReachConnections_Delete + /// GlobalReachConnection_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -219,11 +219,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// GlobalReachConnections_Delete + /// GlobalReachConnection_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -261,11 +261,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// GlobalReachConnections_CreateOrUpdate + /// GlobalReachConnection_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -307,11 +307,11 @@ public virtual async Task> UpdateAsy /// /// /// Operation Id - /// GlobalReachConnections_CreateOrUpdate + /// GlobalReachConnection_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs index 5416b3e25775..5f5d543e1ac7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs @@ -19,8 +19,8 @@ namespace Azure.ResourceManager.Avs { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetHcxEnterpriseSites method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetHcxEnterpriseSites method from an instance of . /// public partial class HcxEnterpriseSiteCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -47,8 +47,8 @@ internal HcxEnterpriseSiteCollection(ArmClient client, ResourceIdentifier id) : internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudResource.ResourceType), nameof(id)); + if (id.ResourceType != PrivateCloudResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloudResource.ResourceType), nameof(id)); } /// @@ -60,11 +60,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// HcxEnterpriseSites_CreateOrUpdate + /// HcxEnterpriseSite_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -111,11 +111,11 @@ public virtual async Task> CreateOrUpdat /// /// /// Operation Id - /// HcxEnterpriseSites_CreateOrUpdate + /// HcxEnterpriseSite_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -162,11 +162,11 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Operation Id - /// HcxEnterpriseSites_Get + /// HcxEnterpriseSite_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -207,11 +207,11 @@ public virtual async Task> GetAsync(string h /// /// /// Operation Id - /// HcxEnterpriseSites_Get + /// HcxEnterpriseSite_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -252,11 +252,11 @@ public virtual Response Get(string hcxEnterpriseSiteN /// /// /// Operation Id - /// HcxEnterpriseSites_List + /// HcxEnterpriseSite_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -282,11 +282,11 @@ public virtual AsyncPageable GetAllAsync(Cancellation /// /// /// Operation Id - /// HcxEnterpriseSites_List + /// HcxEnterpriseSite_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -312,11 +312,11 @@ public virtual Pageable GetAll(CancellationToken canc /// /// /// Operation Id - /// HcxEnterpriseSites_Get + /// HcxEnterpriseSite_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -355,11 +355,11 @@ public virtual async Task> ExistsAsync(string hcxEnterpriseSiteNa /// /// /// Operation Id - /// HcxEnterpriseSites_Get + /// HcxEnterpriseSite_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -398,11 +398,11 @@ public virtual Response Exists(string hcxEnterpriseSiteName, CancellationT /// /// /// Operation Id - /// HcxEnterpriseSites_Get + /// HcxEnterpriseSite_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -443,11 +443,11 @@ public virtual async Task> GetIfExis /// /// /// Operation Id - /// HcxEnterpriseSites_Get + /// HcxEnterpriseSite_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.Serialization.cs index c8dedce205bf..f9186b0e057f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.Serialization.cs @@ -37,24 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(ActivationKey)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("activationKey"u8); - writer.WriteStringValue(ActivationKey); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - writer.WriteEndObject(); } HcxEnterpriseSiteData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -77,17 +64,24 @@ internal static HcxEnterpriseSiteData DeserializeHcxEnterpriseSiteData(JsonEleme { return null; } + HcxEnterpriseSiteProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - HcxEnterpriseSiteProvisioningState? provisioningState = default; - string activationKey = default; - HcxEnterpriseSiteStatus? status = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = HcxEnterpriseSiteProperties.DeserializeHcxEnterpriseSiteProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -112,41 +106,6 @@ internal static HcxEnterpriseSiteData DeserializeHcxEnterpriseSiteData(JsonEleme systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new HcxEnterpriseSiteProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("activationKey"u8)) - { - activationKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new HcxEnterpriseSiteStatus(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -158,9 +117,7 @@ internal static HcxEnterpriseSiteData DeserializeHcxEnterpriseSiteData(JsonEleme name, type, systemData, - provisioningState, - activationKey, - status, + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs index 9bdb7f093ba6..4829c6fcf219 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs @@ -61,23 +61,15 @@ public HcxEnterpriseSiteData() /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. - /// The activation key. - /// The status of the HCX Enterprise Site. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal HcxEnterpriseSiteData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HcxEnterpriseSiteProvisioningState? provisioningState, string activationKey, HcxEnterpriseSiteStatus? status, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal HcxEnterpriseSiteData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HcxEnterpriseSiteProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - ProvisioningState = provisioningState; - ActivationKey = activationKey; - Status = status; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The provisioning state of the resource. - public HcxEnterpriseSiteProvisioningState? ProvisioningState { get; } - /// The activation key. - public string ActivationKey { get; } - /// The status of the HCX Enterprise Site. - public HcxEnterpriseSiteStatus? Status { get; } + /// The resource-specific properties for this resource. + public HcxEnterpriseSiteProperties Properties { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteResource.cs index 1de9641912c0..a0c98b5cd591 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteResource.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Avs /// A Class representing a HcxEnterpriseSite along with the instance operations that can be performed on it. /// If you have a you can construct a /// from an instance of using the GetHcxEnterpriseSiteResource method. - /// Otherwise you can get one from its parent resource using the GetHcxEnterpriseSite method. + /// Otherwise you can get one from its parent resource using the GetHcxEnterpriseSite method. /// public partial class HcxEnterpriseSiteResource : ArmResource { @@ -97,11 +97,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// HcxEnterpriseSites_Get + /// HcxEnterpriseSite_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -137,11 +137,11 @@ public virtual async Task> GetAsync(Cancella /// /// /// Operation Id - /// HcxEnterpriseSites_Get + /// HcxEnterpriseSite_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -177,11 +177,11 @@ public virtual Response Get(CancellationToken cancell /// /// /// Operation Id - /// HcxEnterpriseSites_Delete + /// HcxEnterpriseSite_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -221,11 +221,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// HcxEnterpriseSites_Delete + /// HcxEnterpriseSite_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -265,11 +265,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// HcxEnterpriseSites_CreateOrUpdate + /// HcxEnterpriseSite_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -313,11 +313,11 @@ public virtual async Task> UpdateAsync(W /// /// /// Operation Id - /// HcxEnterpriseSites_CreateOrUpdate + /// HcxEnterpriseSite_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostCollection.cs new file mode 100644 index 000000000000..55a060f76755 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostCollection.cs @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetHosts method from an instance of . + /// + public partial class HostCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _hostClientDiagnostics; + private readonly HostsRestOperations _hostRestClient; + + /// Initializes a new instance of the class for mocking. + protected HostCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal HostCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _hostClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", HostResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(HostResource.ResourceType, out string hostApiVersion); + _hostRestClient = new HostsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, hostApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ClusterResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ClusterResource.ResourceType), nameof(id)); + } + + /// + /// Get a Host + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId} + /// + /// + /// Operation Id + /// Host_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The host identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string hostId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostId, nameof(hostId)); + + using var scope = _hostClientDiagnostics.CreateScope("HostCollection.Get"); + scope.Start(); + try + { + var response = await _hostRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hostId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new HostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Host + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId} + /// + /// + /// Operation Id + /// Host_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The host identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string hostId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostId, nameof(hostId)); + + using var scope = _hostClientDiagnostics.CreateScope("HostCollection.Get"); + scope.Start(); + try + { + var response = _hostRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hostId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new HostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Host resources by Cluster + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts + /// + /// + /// Operation Id + /// Host_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _hostRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HostResource(Client, HostData.DeserializeHostData(e)), _hostClientDiagnostics, Pipeline, "HostCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Host resources by Cluster + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts + /// + /// + /// Operation Id + /// Host_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _hostRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HostResource(Client, HostData.DeserializeHostData(e)), _hostClientDiagnostics, Pipeline, "HostCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId} + /// + /// + /// Operation Id + /// Host_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The host identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string hostId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostId, nameof(hostId)); + + using var scope = _hostClientDiagnostics.CreateScope("HostCollection.Exists"); + scope.Start(); + try + { + var response = await _hostRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hostId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId} + /// + /// + /// Operation Id + /// Host_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The host identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string hostId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostId, nameof(hostId)); + + using var scope = _hostClientDiagnostics.CreateScope("HostCollection.Exists"); + scope.Start(); + try + { + var response = _hostRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hostId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId} + /// + /// + /// Operation Id + /// Host_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The host identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string hostId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostId, nameof(hostId)); + + using var scope = _hostClientDiagnostics.CreateScope("HostCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _hostRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hostId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId} + /// + /// + /// Operation Id + /// Host_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The host identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string hostId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(hostId, nameof(hostId)); + + using var scope = _hostClientDiagnostics.CreateScope("HostCollection.GetIfExists"); + scope.Start(); + try + { + var response = _hostRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, hostId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostData.Serialization.cs new file mode 100644 index 000000000000..142348669a27 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostData.Serialization.cs @@ -0,0 +1,197 @@ +// 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; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class HostData : 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 override 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(HostData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + } + + HostData 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(HostData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHostData(document.RootElement, options); + } + + internal static HostData DeserializeHostData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HostProperties properties = default; + IReadOnlyList zones = default; + AvsSku sku = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = HostProperties.DeserializeHostProperties(property.Value, options); + continue; + } + if (property.NameEquals("zones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = AvsSku.DeserializeAvsSku(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HostData( + id, + name, + type, + systemData, + properties, + zones ?? new ChangeTrackingList(), + sku, + 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); + default: + throw new FormatException($"The model {nameof(HostData)} does not support writing '{options.Format}' format."); + } + } + + HostData 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 DeserializeHostData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HostData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostData.cs new file mode 100644 index 000000000000..90d2d81f42ab --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostData.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing the Host data model. + /// A host resource + /// + public partial class HostData : ResourceData + { + /// + /// 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 . + internal HostData() + { + Zones = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// The resource-specific properties for this resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// The availability zones. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal HostData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HostProperties properties, IReadOnlyList zones, AvsSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + Zones = zones; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The resource-specific properties for this resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public HostProperties Properties { get; } + /// The availability zones. + public IReadOnlyList Zones { get; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + public AvsSku Sku { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostResource.Serialization.cs new file mode 100644 index 000000000000..0644bb2af2b0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Avs +{ + public partial class HostResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + HostData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + HostData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostResource.cs new file mode 100644 index 000000000000..b102283a4e7f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HostResource.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A Class representing a Host along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetHostResource method. + /// Otherwise you can get one from its parent resource using the GetHost method. + /// + public partial class HostResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The clusterName. + /// The hostId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string hostId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _hostClientDiagnostics; + private readonly HostsRestOperations _hostRestClient; + private readonly HostData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters/hosts"; + + /// Initializes a new instance of the class for mocking. + protected HostResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal HostResource(ArmClient client, HostData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal HostResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _hostClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string hostApiVersion); + _hostRestClient = new HostsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, hostApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual HostData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a Host + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId} + /// + /// + /// Operation Id + /// Host_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _hostClientDiagnostics.CreateScope("HostResource.Get"); + scope.Start(); + try + { + var response = await _hostRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new HostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Host + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/hosts/{hostId} + /// + /// + /// Operation Id + /// Host_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _hostClientDiagnostics.CreateScope("HostResource.Get"); + scope.Start(); + try + { + var response = _hostRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new HostResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathData.Serialization.cs index 0ac3dfdaa8c8..4bc67e10b4eb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathData.Serialization.cs @@ -37,19 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(NetworkBlock)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("networkBlock"u8); - writer.WriteStringValue(NetworkBlock); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } IscsiPathData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -72,16 +64,24 @@ internal static IscsiPathData DeserializeIscsiPathData(JsonElement element, Mode { return null; } + IscsiPathProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - IscsiPathProvisioningState? provisioningState = default; - string networkBlock = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = IscsiPathProperties.DeserializeIscsiPathProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -106,32 +106,6 @@ internal static IscsiPathData DeserializeIscsiPathData(JsonElement element, Mode systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new IscsiPathProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("networkBlock"u8)) - { - networkBlock = property0.Value.GetString(); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -143,8 +117,7 @@ internal static IscsiPathData DeserializeIscsiPathData(JsonElement element, Mode name, type, systemData, - provisioningState, - networkBlock, + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathData.cs index 61250670f48d..4e7127d998c7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathData.cs @@ -61,19 +61,15 @@ public IscsiPathData() /// The name. /// The resourceType. /// The systemData. - /// The state of the iSCSI path provisioning. - /// CIDR Block for iSCSI path. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal IscsiPathData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IscsiPathProvisioningState? provisioningState, string networkBlock, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal IscsiPathData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IscsiPathProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - ProvisioningState = provisioningState; - NetworkBlock = networkBlock; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The state of the iSCSI path provisioning. - public IscsiPathProvisioningState? ProvisioningState { get; } - /// CIDR Block for iSCSI path. - public string NetworkBlock { get; set; } + /// The resource-specific properties for this resource. + public IscsiPathProperties Properties { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathResource.cs index 53542ba61ee6..fd58ee494f6c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/IscsiPathResource.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Avs /// A Class representing an IscsiPath along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetIscsiPathResource method. - /// Otherwise you can get one from its parent resource using the GetIscsiPath method. + /// Otherwise you can get one from its parent resource using the GetIscsiPath method. /// public partial class IscsiPathResource : ArmResource { @@ -96,11 +96,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// IscsiPaths_Get + /// IscsiPath_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -136,11 +136,11 @@ public virtual async Task> GetAsync(CancellationToke /// /// /// Operation Id - /// IscsiPaths_Get + /// IscsiPath_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -176,11 +176,11 @@ public virtual Response Get(CancellationToken cancellationTok /// /// /// Operation Id - /// IscsiPaths_Delete + /// IscsiPath_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -218,11 +218,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// IscsiPaths_Delete + /// IscsiPath_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -260,11 +260,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// IscsiPaths_CreateOrUpdate + /// IscsiPath_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -306,11 +306,11 @@ public virtual async Task> CreateOrUpdateAsync(W /// /// /// Operation Id - /// IscsiPaths_CreateOrUpdate + /// IscsiPath_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonOperationSource.cs new file mode 100644 index 000000000000..5d34e83f45b7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Avs +{ + internal class AddonOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal AddonOperationSource(ArmClient client) + { + _client = client; + } + + AddonResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new AddonResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new AddonResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudAddonOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudAddonOperationSource.cs deleted file mode 100644 index eca84536e73f..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudAddonOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.Avs -{ - internal class AvsPrivateCloudAddonOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal AvsPrivateCloudAddonOperationSource(ArmClient client) - { - _client = client; - } - - AvsPrivateCloudAddonResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content); - return new AvsPrivateCloudAddonResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new AvsPrivateCloudAddonResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudClusterOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudClusterOperationSource.cs deleted file mode 100644 index d2a5b2914d57..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudClusterOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.Avs -{ - internal class AvsPrivateCloudClusterOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal AvsPrivateCloudClusterOperationSource(ArmClient client) - { - _client = client; - } - - AvsPrivateCloudClusterResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content); - return new AvsPrivateCloudClusterResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new AvsPrivateCloudClusterResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudDatastoreOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudDatastoreOperationSource.cs deleted file mode 100644 index 2782664a3f26..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudDatastoreOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.Avs -{ - internal class AvsPrivateCloudDatastoreOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal AvsPrivateCloudDatastoreOperationSource(ArmClient client) - { - _client = client; - } - - AvsPrivateCloudDatastoreResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content); - return new AvsPrivateCloudDatastoreResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new AvsPrivateCloudDatastoreResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudOperationSource.cs deleted file mode 100644 index b02243a63c03..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsPrivateCloudOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.Avs -{ - internal class AvsPrivateCloudOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal AvsPrivateCloudOperationSource(ArmClient client) - { - _client = client; - } - - AvsPrivateCloudResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content); - return new AvsPrivateCloudResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new AvsPrivateCloudResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkOperationSource.cs new file mode 100644 index 000000000000..4d2d1f59cc51 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Avs +{ + internal class CloudLinkOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal CloudLinkOperationSource(ArmClient client) + { + _client = client; + } + + CloudLinkResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new CloudLinkResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new CloudLinkResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterOperationSource.cs new file mode 100644 index 000000000000..bb5472711539 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Avs +{ + internal class ClusterOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ClusterOperationSource(ArmClient client) + { + _client = client; + } + + ClusterResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new ClusterResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new ClusterResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreOperationSource.cs new file mode 100644 index 000000000000..07649a6f35f5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Avs +{ + internal class DatastoreOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DatastoreOperationSource(ArmClient client) + { + _client = client; + } + + DatastoreResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new DatastoreResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new DatastoreResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsCloudLinkOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudOperationSource.cs similarity index 51% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsCloudLinkOperationSource.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudOperationSource.cs index b72a8f7d3be2..3d498e412576 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AvsCloudLinkOperationSource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudOperationSource.cs @@ -12,25 +12,25 @@ namespace Azure.ResourceManager.Avs { - internal class AvsCloudLinkOperationSource : IOperationSource + internal class PrivateCloudOperationSource : IOperationSource { private readonly ArmClient _client; - internal AvsCloudLinkOperationSource(ArmClient client) + internal PrivateCloudOperationSource(ArmClient client) { _client = client; } - AvsCloudLinkResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + PrivateCloudResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return new AvsCloudLinkResource(_client, data); + var data = ModelReaderWriter.Read(response.Content); + return new PrivateCloudResource(_client, data); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new AvsCloudLinkResource(_client, data)).ConfigureAwait(false); + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new PrivateCloudResource(_client, data)).ConfigureAwait(false); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PureStoragePolicyOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PureStoragePolicyOperationSource.cs new file mode 100644 index 000000000000..f666860f3ee9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PureStoragePolicyOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Avs +{ + internal class PureStoragePolicyOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal PureStoragePolicyOperationSource(ArmClient client) + { + _client = client; + } + + PureStoragePolicyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new PureStoragePolicyResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new PureStoragePolicyResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDhcpOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDhcpOperationSource.cs index a11bf8046c03..26a33409fdcf 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDhcpOperationSource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDhcpOperationSource.cs @@ -5,32 +5,26 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Azure.Core; +using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs { - internal class WorkloadNetworkDhcpOperationSource : IOperationSource + internal class WorkloadNetworkDhcpOperationSource : IOperationSource { - private readonly ArmClient _client; - - internal WorkloadNetworkDhcpOperationSource(ArmClient client) - { - _client = client; - } - - WorkloadNetworkDhcpResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + WorkloadNetworkDhcp IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return new WorkloadNetworkDhcpResource(_client, data); + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new WorkloadNetworkDhcpResource(_client, data)).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDnsServiceOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDnsServiceOperationSource.cs index 333f7df37fed..21a21f43514d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDnsServiceOperationSource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDnsServiceOperationSource.cs @@ -5,32 +5,26 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Azure.Core; +using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs { - internal class WorkloadNetworkDnsServiceOperationSource : IOperationSource + internal class WorkloadNetworkDnsServiceOperationSource : IOperationSource { - private readonly ArmClient _client; - - internal WorkloadNetworkDnsServiceOperationSource(ArmClient client) - { - _client = client; - } - - WorkloadNetworkDnsServiceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + WorkloadNetworkDnsService IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return new WorkloadNetworkDnsServiceResource(_client, data); + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new WorkloadNetworkDnsServiceResource(_client, data)).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDnsZoneOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDnsZoneOperationSource.cs index 8699849b3dcc..15b89b3603bd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDnsZoneOperationSource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDnsZoneOperationSource.cs @@ -5,32 +5,26 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Azure.Core; +using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs { - internal class WorkloadNetworkDnsZoneOperationSource : IOperationSource + internal class WorkloadNetworkDnsZoneOperationSource : IOperationSource { - private readonly ArmClient _client; - - internal WorkloadNetworkDnsZoneOperationSource(ArmClient client) - { - _client = client; - } - - WorkloadNetworkDnsZoneResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + WorkloadNetworkDnsZone IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return new WorkloadNetworkDnsZoneResource(_client, data); + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new WorkloadNetworkDnsZoneResource(_client, data)).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkPortMirroringOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkPortMirroringOperationSource.cs new file mode 100644 index 000000000000..de97803a5773 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkPortMirroringOperationSource.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal class WorkloadNetworkPortMirroringOperationSource : IOperationSource + { + WorkloadNetworkPortMirroring IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkPortMirroringProfileOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkPortMirroringProfileOperationSource.cs deleted file mode 100644 index c13d44742f0b..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkPortMirroringProfileOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.Avs -{ - internal class WorkloadNetworkPortMirroringProfileOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal WorkloadNetworkPortMirroringProfileOperationSource(ArmClient client) - { - _client = client; - } - - WorkloadNetworkPortMirroringProfileResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content); - return new WorkloadNetworkPortMirroringProfileResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new WorkloadNetworkPortMirroringProfileResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkPublicIPOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkPublicIPOperationSource.cs index 5d35d62f70f3..eee8ee3948d5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkPublicIPOperationSource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkPublicIPOperationSource.cs @@ -5,32 +5,26 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Azure.Core; +using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs { - internal class WorkloadNetworkPublicIPOperationSource : IOperationSource + internal class WorkloadNetworkPublicIPOperationSource : IOperationSource { - private readonly ArmClient _client; - - internal WorkloadNetworkPublicIPOperationSource(ArmClient client) - { - _client = client; - } - - WorkloadNetworkPublicIPResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + WorkloadNetworkPublicIP IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return new WorkloadNetworkPublicIPResource(_client, data); + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new WorkloadNetworkPublicIPResource(_client, data)).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkVmGroupOperationSource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkVmGroupOperationSource.cs index 7fc5b21070f1..22c821c2d56f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkVmGroupOperationSource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkVmGroupOperationSource.cs @@ -5,32 +5,26 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Azure.Core; +using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs { - internal class WorkloadNetworkVmGroupOperationSource : IOperationSource + internal class WorkloadNetworkVmGroupOperationSource : IOperationSource { - private readonly ArmClient _client; - - internal WorkloadNetworkVmGroupOperationSource(ArmClient client) - { - _client = client; - } - - WorkloadNetworkVmGroupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + WorkloadNetworkVmGroup IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return new WorkloadNetworkVmGroupResource(_client, data); + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return WorkloadNetworkVmGroup.DeserializeWorkloadNetworkVmGroup(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content); - return await Task.FromResult(new WorkloadNetworkVmGroupResource(_client, data)).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkVmGroup.DeserializeWorkloadNetworkVmGroup(document.RootElement); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.cs index 8eb8b0c8d7c7..495636d3bdcc 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonArcProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// The properties of an Arc addon. - public partial class AddonArcProperties : AvsPrivateCloudAddonProperties + public partial class AddonArcProperties : AddonProperties { /// Initializes a new instance of . public AddonArcProperties() diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs index 299427ee0c23..3a03ed06c4f2 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs @@ -37,6 +37,16 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("offer"u8); writer.WriteStringValue(Offer); + if (Optional.IsDefined(ManagementNetwork)) + { + writer.WritePropertyName("managementNetwork"u8); + writer.WriteStringValue(ManagementNetwork); + } + if (Optional.IsDefined(UplinkNetwork)) + { + writer.WritePropertyName("uplinkNetwork"u8); + writer.WriteStringValue(UplinkNetwork); + } } AddonHcxProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -60,6 +70,8 @@ internal static AddonHcxProperties DeserializeAddonHcxProperties(JsonElement ele return null; } string offer = default; + string managementNetwork = default; + string uplinkNetwork = default; AddonType addonType = default; AddonProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; @@ -71,6 +83,16 @@ internal static AddonHcxProperties DeserializeAddonHcxProperties(JsonElement ele offer = property.Value.GetString(); continue; } + if (property.NameEquals("managementNetwork"u8)) + { + managementNetwork = property.Value.GetString(); + continue; + } + if (property.NameEquals("uplinkNetwork"u8)) + { + uplinkNetwork = property.Value.GetString(); + continue; + } if (property.NameEquals("addonType"u8)) { addonType = new AddonType(property.Value.GetString()); @@ -91,7 +113,13 @@ internal static AddonHcxProperties DeserializeAddonHcxProperties(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new AddonHcxProperties(addonType, provisioningState, serializedAdditionalRawData, offer); + return new AddonHcxProperties( + addonType, + provisioningState, + serializedAdditionalRawData, + offer, + managementNetwork, + uplinkNetwork); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs index 09b0bec3f4a0..31546d6458a2 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// The properties of an HCX addon. - public partial class AddonHcxProperties : AvsPrivateCloudAddonProperties + public partial class AddonHcxProperties : AddonProperties { /// Initializes a new instance of . /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). @@ -29,9 +29,13 @@ public AddonHcxProperties(string offer) /// The state of the addon provisioning. /// Keeps track of any properties unknown to the library. /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). - internal AddonHcxProperties(AddonType addonType, AddonProvisioningState? provisioningState, IDictionary serializedAdditionalRawData, string offer) : base(addonType, provisioningState, serializedAdditionalRawData) + /// HCX management network. + /// HCX uplink network. + internal AddonHcxProperties(AddonType addonType, AddonProvisioningState? provisioningState, IDictionary serializedAdditionalRawData, string offer, string managementNetwork, string uplinkNetwork) : base(addonType, provisioningState, serializedAdditionalRawData) { Offer = offer; + ManagementNetwork = managementNetwork; + UplinkNetwork = uplinkNetwork; AddonType = addonType; } @@ -42,5 +46,9 @@ internal AddonHcxProperties() /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). public string Offer { get; set; } + /// HCX management network. + public string ManagementNetwork { get; set; } + /// HCX uplink network. + public string UplinkNetwork { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs index 16a8fc9d74c1..fac0daaad58d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs @@ -83,7 +83,7 @@ internal static AddonList DeserializeAddonList(JsonElement element, ModelReaderW { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static AddonList DeserializeAddonList(JsonElement element, ModelReaderW { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(AvsPrivateCloudAddonData.DeserializeAvsPrivateCloudAddonData(item, options)); + array.Add(AddonData.DeserializeAddonData(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs index 32c35e075bc4..b98d45d7230a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs @@ -49,7 +49,7 @@ internal partial class AddonList /// Initializes a new instance of . /// The Addon items on this page. /// is null. - internal AddonList(IEnumerable value) + internal AddonList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal AddonList(IEnumerable value) /// The Addon items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal AddonList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal AddonList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal AddonList() } /// The Addon items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.Serialization.cs similarity index 65% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.Serialization.cs index 6bae23153ff2..54dda312e105 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { [PersistableModelProxy(typeof(UnknownAddonProperties))] - public partial class AvsPrivateCloudAddonProperties : IUtf8JsonSerializable, IJsonModel + public partial class AddonProperties : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AddonProperties)} does not support writing '{format}' format."); } writer.WritePropertyName("addonType"u8); @@ -58,19 +58,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AvsPrivateCloudAddonProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AddonProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AddonProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudAddonProperties(document.RootElement, options); + return DeserializeAddonProperties(document.RootElement, options); } - internal static AvsPrivateCloudAddonProperties DeserializeAvsPrivateCloudAddonProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static AddonProperties DeserializeAddonProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -91,35 +91,35 @@ internal static AvsPrivateCloudAddonProperties DeserializeAvsPrivateCloudAddonPr return UnknownAddonProperties.DeserializeUnknownAddonProperties(element, options); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AddonProperties)} does not support writing '{options.Format}' format."); } } - AvsPrivateCloudAddonProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AddonProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsPrivateCloudAddonProperties(document.RootElement, options); + return DeserializeAddonProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AddonProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.cs similarity index 81% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.cs index 586c832fb72e..d20b0040c25b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudAddonProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.cs @@ -12,10 +12,10 @@ namespace Azure.ResourceManager.Avs.Models { /// /// The properties of an addon - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , , and . /// - public abstract partial class AvsPrivateCloudAddonProperties + public abstract partial class AddonProperties { /// /// Keeps track of any properties unknown to the library. @@ -49,16 +49,16 @@ public abstract partial class AvsPrivateCloudAddonProperties /// private protected IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - protected AvsPrivateCloudAddonProperties() + /// Initializes a new instance of . + protected AddonProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Addon type. /// The state of the addon provisioning. /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudAddonProperties(AddonType addonType, AddonProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + internal AddonProperties(AddonType addonType, AddonProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) { AddonType = addonType; ProvisioningState = provisioningState; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs index 9331bc185335..d7bdd42f01ca 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// The properties of a Site Recovery Manager (SRM) addon. - public partial class AddonSrmProperties : AvsPrivateCloudAddonProperties + public partial class AddonSrmProperties : AddonProperties { /// Initializes a new instance of . public AddonSrmProperties() diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs index a0c82111f008..daf849106a95 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// The properties of a vSphere Replication (VR) addon. - public partial class AddonVrProperties : AvsPrivateCloudAddonProperties + public partial class AddonVrProperties : AddonProperties { /// Initializes a new instance of . /// The vSphere Replication Server (VRS) count. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs index db86d4117ad2..ae8255fa3ff8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs @@ -44,15 +44,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nsxtPassword"u8); writer.WriteStringValue(NsxtPassword); } - if (options.Format != "W" && Optional.IsDefined(VCenterUsername)) + if (options.Format != "W" && Optional.IsDefined(VcenterUsername)) { writer.WritePropertyName("vcenterUsername"u8); - writer.WriteStringValue(VCenterUsername); + writer.WriteStringValue(VcenterUsername); } - if (options.Format != "W" && Optional.IsDefined(VCenterPassword)) + if (options.Format != "W" && Optional.IsDefined(VcenterPassword)) { writer.WritePropertyName("vcenterPassword"u8); - writer.WriteStringValue(VCenterPassword); + writer.WriteStringValue(VcenterPassword); } if (options.Format != "W" && _serializedAdditionalRawData != null) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs index 68c2b59aed0d..b1de81677eeb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs @@ -53,15 +53,15 @@ internal AdminCredentials() /// Initializes a new instance of . /// NSX-T Manager username. /// NSX-T Manager password. - /// vCenter admin username. - /// vCenter admin password. + /// vCenter admin username. + /// vCenter admin password. /// Keeps track of any properties unknown to the library. - internal AdminCredentials(string nsxtUsername, string nsxtPassword, string vCenterUsername, string vCenterPassword, IDictionary serializedAdditionalRawData) + internal AdminCredentials(string nsxtUsername, string nsxtPassword, string vcenterUsername, string vcenterPassword, IDictionary serializedAdditionalRawData) { NsxtUsername = nsxtUsername; NsxtPassword = nsxtPassword; - VCenterUsername = vCenterUsername; - VCenterPassword = vCenterPassword; + VcenterUsername = vcenterUsername; + VcenterPassword = vcenterPassword; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -70,8 +70,8 @@ internal AdminCredentials(string nsxtUsername, string nsxtPassword, string vCent /// NSX-T Manager password. public string NsxtPassword { get; } /// vCenter admin username. - public string VCenterUsername { get; } + public string VcenterUsername { get; } /// vCenter admin password. - public string VCenterPassword { get; } + public string VcenterPassword { get; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AffinityStrength.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AffinityStrength.cs new file mode 100644 index 000000000000..38a5535f5690 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AffinityStrength.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Affinity Strength. + public readonly partial struct AffinityStrength : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AffinityStrength(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ShouldValue = "Should"; + private const string MustValue = "Must"; + + /// is should. + public static AffinityStrength Should { get; } = new AffinityStrength(ShouldValue); + /// is must. + public static AffinityStrength Must { get; } = new AffinityStrength(MustValue); + /// Determines if two values are the same. + public static bool operator ==(AffinityStrength left, AffinityStrength right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AffinityStrength left, AffinityStrength right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AffinityStrength(string value) => new AffinityStrength(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AffinityStrength other && Equals(other); + /// + public bool Equals(AffinityStrength other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AffinityType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AffinityType.cs new file mode 100644 index 000000000000..ef96d23eb415 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AffinityType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Affinity type. + public readonly partial struct AffinityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AffinityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AffinityValue = "Affinity"; + private const string AntiAffinityValue = "AntiAffinity"; + + /// is affinity. + public static AffinityType Affinity { get; } = new AffinityType(AffinityValue); + /// is anti-affinity. + public static AffinityType AntiAffinity { get; } = new AffinityType(AntiAffinityValue); + /// Determines if two values are the same. + public static bool operator ==(AffinityType left, AffinityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AffinityType left, AffinityType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AffinityType(string value) => new AffinityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AffinityType other && Equals(other); + /// + public bool Equals(AffinityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.Serialization.cs similarity index 69% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.Serialization.cs index f7c355e897c1..4e97878a1700 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class PrivateCloudAvailabilityProperties : IUtf8JsonSerializable, IJsonModel + public partial class AvailabilityProperties : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(PrivateCloudAvailabilityProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AvailabilityProperties)} does not support writing '{format}' format."); } if (Optional.IsDefined(Strategy)) @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - PrivateCloudAvailabilityProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AvailabilityProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(PrivateCloudAvailabilityProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AvailabilityProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePrivateCloudAvailabilityProperties(document.RootElement, options); + return DeserializeAvailabilityProperties(document.RootElement, options); } - internal static PrivateCloudAvailabilityProperties DeserializePrivateCloudAvailabilityProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static AvailabilityProperties DeserializeAvailabilityProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -126,38 +126,38 @@ internal static PrivateCloudAvailabilityProperties DeserializePrivateCloudAvaila } } serializedAdditionalRawData = rawDataDictionary; - return new PrivateCloudAvailabilityProperties(strategy, zone, secondaryZone, serializedAdditionalRawData); + return new AvailabilityProperties(strategy, zone, secondaryZone, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(PrivateCloudAvailabilityProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AvailabilityProperties)} does not support writing '{options.Format}' format."); } } - PrivateCloudAvailabilityProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AvailabilityProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePrivateCloudAvailabilityProperties(document.RootElement, options); + return DeserializeAvailabilityProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(PrivateCloudAvailabilityProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AvailabilityProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.cs similarity index 84% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.cs index 4516aed85439..3a24a9f5bbdf 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudAvailabilityProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// The properties describing private cloud availability zone distribution. - public partial class PrivateCloudAvailabilityProperties + public partial class AvailabilityProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,17 +45,17 @@ public partial class PrivateCloudAvailabilityProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public PrivateCloudAvailabilityProperties() + /// Initializes a new instance of . + public AvailabilityProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The availability strategy for the private cloud. /// The primary availability zone for the private cloud. /// The secondary availability zone for the private cloud. /// Keeps track of any properties unknown to the library. - internal PrivateCloudAvailabilityProperties(AvailabilityStrategy? strategy, int? zone, int? secondaryZone, IDictionary serializedAdditionalRawData) + internal AvailabilityProperties(AvailabilityStrategy? strategy, int? zone, int? secondaryZone, IDictionary serializedAdditionalRawData) { Strategy = strategy; Zone = zone; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsCloudLinkProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsCloudLinkProvisioningState.cs deleted file mode 100644 index 6a341ae91ef3..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsCloudLinkProvisioningState.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// cloud link provisioning state. - public readonly partial struct AvsCloudLinkProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsCloudLinkProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CanceledValue = "Canceled"; - - /// Resource has been created. - public static AvsCloudLinkProvisioningState Succeeded { get; } = new AvsCloudLinkProvisioningState(SucceededValue); - /// Resource creation failed. - public static AvsCloudLinkProvisioningState Failed { get; } = new AvsCloudLinkProvisioningState(FailedValue); - /// Resource creation was canceled. - public static AvsCloudLinkProvisioningState Canceled { get; } = new AvsCloudLinkProvisioningState(CanceledValue); - /// Determines if two values are the same. - public static bool operator ==(AvsCloudLinkProvisioningState left, AvsCloudLinkProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsCloudLinkProvisioningState left, AvsCloudLinkProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsCloudLinkProvisioningState(string value) => new AvsCloudLinkProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsCloudLinkProvisioningState other && Equals(other); - /// - public bool Equals(AvsCloudLinkProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsCloudLinkStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsCloudLinkStatus.cs deleted file mode 100644 index de548a1996f0..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsCloudLinkStatus.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Cloud Link status. - public readonly partial struct AvsCloudLinkStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsCloudLinkStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ActiveValue = "Active"; - private const string BuildingValue = "Building"; - private const string DeletingValue = "Deleting"; - private const string FailedValue = "Failed"; - private const string DisconnectedValue = "Disconnected"; - - /// is active. - public static AvsCloudLinkStatus Active { get; } = new AvsCloudLinkStatus(ActiveValue); - /// is building. - public static AvsCloudLinkStatus Building { get; } = new AvsCloudLinkStatus(BuildingValue); - /// is deleting. - public static AvsCloudLinkStatus Deleting { get; } = new AvsCloudLinkStatus(DeletingValue); - /// is failed. - public static AvsCloudLinkStatus Failed { get; } = new AvsCloudLinkStatus(FailedValue); - /// is disconnected. - public static AvsCloudLinkStatus Disconnected { get; } = new AvsCloudLinkStatus(DisconnectedValue); - /// Determines if two values are the same. - public static bool operator ==(AvsCloudLinkStatus left, AvsCloudLinkStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsCloudLinkStatus left, AvsCloudLinkStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsCloudLinkStatus(string value) => new AvsCloudLinkStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsCloudLinkStatus other && Equals(other); - /// - public bool Equals(AvsCloudLinkStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionState.cs deleted file mode 100644 index 14825db6d4bd..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionState.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Whether encryption is enabled or disabled. - public readonly partial struct AvsEncryptionState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsEncryptionState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// is enabled. - public static AvsEncryptionState Enabled { get; } = new AvsEncryptionState(EnabledValue); - /// is disabled. - public static AvsEncryptionState Disabled { get; } = new AvsEncryptionState(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(AvsEncryptionState left, AvsEncryptionState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsEncryptionState left, AvsEncryptionState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsEncryptionState(string value) => new AvsEncryptionState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsEncryptionState other && Equals(other); - /// - public bool Equals(AvsEncryptionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionVersionType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionVersionType.cs deleted file mode 100644 index 73ed81140741..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionVersionType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Whether the encryption version is fixed or auto-detected. - public readonly partial struct AvsEncryptionVersionType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsEncryptionVersionType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string FixedValue = "Fixed"; - private const string AutoDetectedValue = "AutoDetected"; - - /// is fixed. - public static AvsEncryptionVersionType Fixed { get; } = new AvsEncryptionVersionType(FixedValue); - /// is auto-detected. - public static AvsEncryptionVersionType AutoDetected { get; } = new AvsEncryptionVersionType(AutoDetectedValue); - /// Determines if two values are the same. - public static bool operator ==(AvsEncryptionVersionType left, AvsEncryptionVersionType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsEncryptionVersionType left, AvsEncryptionVersionType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsEncryptionVersionType(string value) => new AvsEncryptionVersionType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsEncryptionVersionType other && Equals(other); - /// - public bool Equals(AvsEncryptionVersionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.cs deleted file mode 100644 index 2240ee04b204..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.Avs.Models -{ - /// The properties of a management cluster. - public partial class AvsManagementCluster - { - /// Initializes a new instance of . - public AvsManagementCluster() - { - Hosts = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The cluster size. - /// The state of the cluster provisioning. - /// The identity. - /// The hosts. - /// Name of the vsan datastore associated with the cluster. - /// Keeps track of any properties unknown to the library. - internal AvsManagementCluster(int? clusterSize, AvsPrivateCloudClusterProvisioningState? provisioningState, int? clusterId, IList hosts, string vsanDatastoreName, IDictionary serializedAdditionalRawData) - { - ClusterSize = clusterSize; - ProvisioningState = provisioningState; - ClusterId = clusterId; - Hosts = hosts; - VsanDatastoreName = vsanDatastoreName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - /// Name of the vsan datastore associated with the cluster. - public string VsanDatastoreName { get; set; } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPlacementPolicyAffinityType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPlacementPolicyAffinityType.cs deleted file mode 100644 index be6f8f514f8d..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPlacementPolicyAffinityType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Affinity type. - public readonly partial struct AvsPlacementPolicyAffinityType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsPlacementPolicyAffinityType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AffinityValue = "Affinity"; - private const string AntiAffinityValue = "AntiAffinity"; - - /// is affinity. - public static AvsPlacementPolicyAffinityType Affinity { get; } = new AvsPlacementPolicyAffinityType(AffinityValue); - /// is anti-affinity. - public static AvsPlacementPolicyAffinityType AntiAffinity { get; } = new AvsPlacementPolicyAffinityType(AntiAffinityValue); - /// Determines if two values are the same. - public static bool operator ==(AvsPlacementPolicyAffinityType left, AvsPlacementPolicyAffinityType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsPlacementPolicyAffinityType left, AvsPlacementPolicyAffinityType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsPlacementPolicyAffinityType(string value) => new AvsPlacementPolicyAffinityType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsPlacementPolicyAffinityType other && Equals(other); - /// - public bool Equals(AvsPlacementPolicyAffinityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterProvisioningState.cs deleted file mode 100644 index bf506478fb1a..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterProvisioningState.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Cluster provisioning state. - public readonly partial struct AvsPrivateCloudClusterProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsPrivateCloudClusterProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CanceledValue = "Canceled"; - private const string CancelledValue = "Cancelled"; - private const string DeletingValue = "Deleting"; - private const string UpdatingValue = "Updating"; - - /// Resource has been created. - public static AvsPrivateCloudClusterProvisioningState Succeeded { get; } = new AvsPrivateCloudClusterProvisioningState(SucceededValue); - /// Resource creation failed. - public static AvsPrivateCloudClusterProvisioningState Failed { get; } = new AvsPrivateCloudClusterProvisioningState(FailedValue); - /// Resource creation was canceled. - public static AvsPrivateCloudClusterProvisioningState Canceled { get; } = new AvsPrivateCloudClusterProvisioningState(CanceledValue); - /// is cancelled. - public static AvsPrivateCloudClusterProvisioningState Cancelled { get; } = new AvsPrivateCloudClusterProvisioningState(CancelledValue); - /// is deleting. - public static AvsPrivateCloudClusterProvisioningState Deleting { get; } = new AvsPrivateCloudClusterProvisioningState(DeletingValue); - /// is updating. - public static AvsPrivateCloudClusterProvisioningState Updating { get; } = new AvsPrivateCloudClusterProvisioningState(UpdatingValue); - /// Determines if two values are the same. - public static bool operator ==(AvsPrivateCloudClusterProvisioningState left, AvsPrivateCloudClusterProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsPrivateCloudClusterProvisioningState left, AvsPrivateCloudClusterProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsPrivateCloudClusterProvisioningState(string value) => new AvsPrivateCloudClusterProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsPrivateCloudClusterProvisioningState other && Equals(other); - /// - public bool Equals(AvsPrivateCloudClusterProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudDatastoreProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudDatastoreProvisioningState.cs deleted file mode 100644 index 43f57d0331b7..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudDatastoreProvisioningState.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// datastore provisioning state. - public readonly partial struct AvsPrivateCloudDatastoreProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsPrivateCloudDatastoreProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CanceledValue = "Canceled"; - private const string CancelledValue = "Cancelled"; - private const string PendingValue = "Pending"; - private const string CreatingValue = "Creating"; - private const string UpdatingValue = "Updating"; - private const string DeletingValue = "Deleting"; - - /// Resource has been created. - public static AvsPrivateCloudDatastoreProvisioningState Succeeded { get; } = new AvsPrivateCloudDatastoreProvisioningState(SucceededValue); - /// Resource creation failed. - public static AvsPrivateCloudDatastoreProvisioningState Failed { get; } = new AvsPrivateCloudDatastoreProvisioningState(FailedValue); - /// Resource creation was canceled. - public static AvsPrivateCloudDatastoreProvisioningState Canceled { get; } = new AvsPrivateCloudDatastoreProvisioningState(CanceledValue); - /// is cancelled. - public static AvsPrivateCloudDatastoreProvisioningState Cancelled { get; } = new AvsPrivateCloudDatastoreProvisioningState(CancelledValue); - /// is pending. - public static AvsPrivateCloudDatastoreProvisioningState Pending { get; } = new AvsPrivateCloudDatastoreProvisioningState(PendingValue); - /// is creating. - public static AvsPrivateCloudDatastoreProvisioningState Creating { get; } = new AvsPrivateCloudDatastoreProvisioningState(CreatingValue); - /// is updating. - public static AvsPrivateCloudDatastoreProvisioningState Updating { get; } = new AvsPrivateCloudDatastoreProvisioningState(UpdatingValue); - /// is deleting. - public static AvsPrivateCloudDatastoreProvisioningState Deleting { get; } = new AvsPrivateCloudDatastoreProvisioningState(DeletingValue); - /// Determines if two values are the same. - public static bool operator ==(AvsPrivateCloudDatastoreProvisioningState left, AvsPrivateCloudDatastoreProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsPrivateCloudDatastoreProvisioningState left, AvsPrivateCloudDatastoreProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsPrivateCloudDatastoreProvisioningState(string value) => new AvsPrivateCloudDatastoreProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsPrivateCloudDatastoreProvisioningState other && Equals(other); - /// - public bool Equals(AvsPrivateCloudDatastoreProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudProvisioningState.cs deleted file mode 100644 index 8cad252df3ba..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudProvisioningState.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// private cloud provisioning state. - public readonly partial struct AvsPrivateCloudProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsPrivateCloudProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CanceledValue = "Canceled"; - private const string CancelledValue = "Cancelled"; - private const string PendingValue = "Pending"; - private const string BuildingValue = "Building"; - private const string DeletingValue = "Deleting"; - private const string UpdatingValue = "Updating"; - - /// Resource has been created. - public static AvsPrivateCloudProvisioningState Succeeded { get; } = new AvsPrivateCloudProvisioningState(SucceededValue); - /// Resource creation failed. - public static AvsPrivateCloudProvisioningState Failed { get; } = new AvsPrivateCloudProvisioningState(FailedValue); - /// Resource creation was canceled. - public static AvsPrivateCloudProvisioningState Canceled { get; } = new AvsPrivateCloudProvisioningState(CanceledValue); - /// is cancelled. - public static AvsPrivateCloudProvisioningState Cancelled { get; } = new AvsPrivateCloudProvisioningState(CancelledValue); - /// is pending. - public static AvsPrivateCloudProvisioningState Pending { get; } = new AvsPrivateCloudProvisioningState(PendingValue); - /// is building. - public static AvsPrivateCloudProvisioningState Building { get; } = new AvsPrivateCloudProvisioningState(BuildingValue); - /// is deleting. - public static AvsPrivateCloudProvisioningState Deleting { get; } = new AvsPrivateCloudProvisioningState(DeletingValue); - /// is updating. - public static AvsPrivateCloudProvisioningState Updating { get; } = new AvsPrivateCloudProvisioningState(UpdatingValue); - /// Determines if two values are the same. - public static bool operator ==(AvsPrivateCloudProvisioningState left, AvsPrivateCloudProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsPrivateCloudProvisioningState left, AvsPrivateCloudProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsPrivateCloudProvisioningState(string value) => new AvsPrivateCloudProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsPrivateCloudProvisioningState other && Equals(other); - /// - public bool Equals(AvsPrivateCloudProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.cs index c7ded958b9e0..1a6243a7be65 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSku.cs @@ -46,7 +46,7 @@ public partial class AvsSku private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// The name of the SKU. E.g. P3. It is typically a letter+number code. + /// The name of the SKU. Ex - P3. It is typically a letter+number code. /// is null. public AvsSku(string name) { @@ -56,7 +56,7 @@ public AvsSku(string name) } /// Initializes a new instance of . - /// The name of the SKU. E.g. P3. It is typically a letter+number code. + /// The name of the SKU. Ex - P3. It is typically a letter+number code. /// This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. /// The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. /// If the service has different generations of hardware, for the same SKU, then that can be captured here. @@ -77,7 +77,7 @@ internal AvsSku() { } - /// The name of the SKU. E.g. P3. It is typically a letter+number code. + /// The name of the SKU. Ex - P3. It is typically a letter+number code. public string Name { get; set; } /// This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. public AvsSkuTier? Tier { get; set; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSkuTier.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSkuTier.cs index 84d77f07403f..5032f6c60dac 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSkuTier.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSkuTier.cs @@ -10,13 +10,13 @@ namespace Azure.ResourceManager.Avs.Models /// This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. public enum AvsSkuTier { - /// Free. + /// The Free service tier. Free, - /// Basic. + /// The Basic service tier. Basic, - /// Standard. + /// The Standard service tier. Standard, - /// Premium. + /// The Premium service tier. Premium } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaEnabled.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaEnabled.cs deleted file mode 100644 index aa2a070e0efe..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaEnabled.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// quota enabled. - public readonly partial struct AvsSubscriptionQuotaEnabled : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsSubscriptionQuotaEnabled(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// is enabled. - public static AvsSubscriptionQuotaEnabled Enabled { get; } = new AvsSubscriptionQuotaEnabled(EnabledValue); - /// is disabled. - public static AvsSubscriptionQuotaEnabled Disabled { get; } = new AvsSubscriptionQuotaEnabled(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(AvsSubscriptionQuotaEnabled left, AvsSubscriptionQuotaEnabled right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsSubscriptionQuotaEnabled left, AvsSubscriptionQuotaEnabled right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsSubscriptionQuotaEnabled(string value) => new AvsSubscriptionQuotaEnabled(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsSubscriptionQuotaEnabled other && Equals(other); - /// - public bool Equals(AvsSubscriptionQuotaEnabled other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialStatus.cs deleted file mode 100644 index a87e7e188ccf..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialStatus.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// trial status. - public readonly partial struct AvsSubscriptionTrialStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsSubscriptionTrialStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TrialAvailableValue = "TrialAvailable"; - private const string TrialUsedValue = "TrialUsed"; - private const string TrialDisabledValue = "TrialDisabled"; - - /// is available. - public static AvsSubscriptionTrialStatus TrialAvailable { get; } = new AvsSubscriptionTrialStatus(TrialAvailableValue); - /// is used. - public static AvsSubscriptionTrialStatus TrialUsed { get; } = new AvsSubscriptionTrialStatus(TrialUsedValue); - /// is disabled. - public static AvsSubscriptionTrialStatus TrialDisabled { get; } = new AvsSubscriptionTrialStatus(TrialDisabledValue); - /// Determines if two values are the same. - public static bool operator ==(AvsSubscriptionTrialStatus left, AvsSubscriptionTrialStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsSubscriptionTrialStatus left, AvsSubscriptionTrialStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsSubscriptionTrialStatus(string value) => new AvsSubscriptionTrialStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsSubscriptionTrialStatus other && Equals(other); - /// - public bool Equals(AvsSubscriptionTrialStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsVirtualMachineProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsVirtualMachineProvisioningState.cs deleted file mode 100644 index 6ed5c5bb7a9f..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsVirtualMachineProvisioningState.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Virtual Machine provisioning state. - public readonly partial struct AvsVirtualMachineProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AvsVirtualMachineProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CanceledValue = "Canceled"; - - /// Resource has been created. - public static AvsVirtualMachineProvisioningState Succeeded { get; } = new AvsVirtualMachineProvisioningState(SucceededValue); - /// Resource creation failed. - public static AvsVirtualMachineProvisioningState Failed { get; } = new AvsVirtualMachineProvisioningState(FailedValue); - /// Resource creation was canceled. - public static AvsVirtualMachineProvisioningState Canceled { get; } = new AvsVirtualMachineProvisioningState(CanceledValue); - /// Determines if two values are the same. - public static bool operator ==(AvsVirtualMachineProvisioningState left, AvsVirtualMachineProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsVirtualMachineProvisioningState left, AvsVirtualMachineProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsVirtualMachineProvisioningState(string value) => new AvsVirtualMachineProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsVirtualMachineProvisioningState other && Equals(other); - /// - public bool Equals(AvsVirtualMachineProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.Serialization.cs similarity index 65% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.Serialization.cs index 032f144f1367..afd57e957e74 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class ExpressRouteCircuit : IUtf8JsonSerializable, IJsonModel + public partial class Circuit : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ExpressRouteCircuit)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Circuit)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(PrimarySubnet)) @@ -71,19 +71,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ExpressRouteCircuit IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Circuit IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ExpressRouteCircuit)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Circuit)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeExpressRouteCircuit(document.RootElement, options); + return DeserializeCircuit(document.RootElement, options); } - internal static ExpressRouteCircuit DeserializeExpressRouteCircuit(JsonElement element, ModelReaderWriterOptions options = null) + internal static Circuit DeserializeCircuit(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -93,8 +93,8 @@ internal static ExpressRouteCircuit DeserializeExpressRouteCircuit(JsonElement e } string primarySubnet = default; string secondarySubnet = default; - ResourceIdentifier expressRouteId = default; - ResourceIdentifier expressRoutePrivatePeeringId = default; + string expressRouteId = default; + string expressRoutePrivatePeeringId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -111,20 +111,12 @@ internal static ExpressRouteCircuit DeserializeExpressRouteCircuit(JsonElement e } if (property.NameEquals("expressRouteID"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - expressRouteId = new ResourceIdentifier(property.Value.GetString()); + expressRouteId = property.Value.GetString(); continue; } if (property.NameEquals("expressRoutePrivatePeeringID"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - expressRoutePrivatePeeringId = new ResourceIdentifier(property.Value.GetString()); + expressRoutePrivatePeeringId = property.Value.GetString(); continue; } if (options.Format != "W") @@ -133,38 +125,38 @@ internal static ExpressRouteCircuit DeserializeExpressRouteCircuit(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new ExpressRouteCircuit(primarySubnet, secondarySubnet, expressRouteId, expressRoutePrivatePeeringId, serializedAdditionalRawData); + return new Circuit(primarySubnet, secondarySubnet, expressRouteId, expressRoutePrivatePeeringId, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ExpressRouteCircuit)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Circuit)} does not support writing '{options.Format}' format."); } } - ExpressRouteCircuit IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Circuit IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeExpressRouteCircuit(document.RootElement, options); + return DeserializeCircuit(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ExpressRouteCircuit)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Circuit)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.cs similarity index 81% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.cs index 0a37b0b26e92..a660d566239a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteCircuit.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.Avs.Models { /// An ExpressRoute Circuit. - public partial class ExpressRouteCircuit + public partial class Circuit { /// /// Keeps track of any properties unknown to the library. @@ -46,18 +45,18 @@ public partial class ExpressRouteCircuit /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ExpressRouteCircuit() + /// Initializes a new instance of . + public Circuit() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// CIDR of primary subnet. /// CIDR of secondary subnet. /// Identifier of the ExpressRoute Circuit (Microsoft Colo only). /// ExpressRoute Circuit private peering identifier. /// Keeps track of any properties unknown to the library. - internal ExpressRouteCircuit(string primarySubnet, string secondarySubnet, ResourceIdentifier expressRouteId, ResourceIdentifier expressRoutePrivatePeeringId, IDictionary serializedAdditionalRawData) + internal Circuit(string primarySubnet, string secondarySubnet, string expressRouteId, string expressRoutePrivatePeeringId, IDictionary serializedAdditionalRawData) { PrimarySubnet = primarySubnet; SecondarySubnet = secondarySubnet; @@ -71,8 +70,8 @@ internal ExpressRouteCircuit(string primarySubnet, string secondarySubnet, Resou /// CIDR of secondary subnet. public string SecondarySubnet { get; } /// Identifier of the ExpressRoute Circuit (Microsoft Colo only). - public ResourceIdentifier ExpressRouteId { get; } + public string ExpressRouteId { get; } /// ExpressRoute Circuit private peering identifier. - public ResourceIdentifier ExpressRoutePrivatePeeringId { get; } + public string ExpressRoutePrivatePeeringId { get; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs index 0262890feab3..0baf84b6caf0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs @@ -83,7 +83,7 @@ internal static CloudLinkList DeserializeCloudLinkList(JsonElement element, Mode { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static CloudLinkList DeserializeCloudLinkList(JsonElement element, Mode { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(AvsCloudLinkData.DeserializeAvsCloudLinkData(item, options)); + array.Add(CloudLinkData.DeserializeCloudLinkData(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs index c9c5918de86d..92d04b6f949b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs @@ -49,7 +49,7 @@ internal partial class CloudLinkList /// Initializes a new instance of . /// The CloudLink items on this page. /// is null. - internal CloudLinkList(IEnumerable value) + internal CloudLinkList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal CloudLinkList(IEnumerable value) /// The CloudLink items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal CloudLinkList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal CloudLinkList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal CloudLinkList() } /// The CloudLink items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkProperties.Serialization.cs new file mode 100644 index 000000000000..cec9f9f5a207 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkProperties.Serialization.cs @@ -0,0 +1,159 @@ +// 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.Avs.Models +{ + public partial class CloudLinkProperties : 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(CloudLinkProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(LinkedCloud)) + { + writer.WritePropertyName("linkedCloud"u8); + writer.WriteStringValue(LinkedCloud); + } + 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 + } + } + } + + CloudLinkProperties 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(CloudLinkProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCloudLinkProperties(document.RootElement, options); + } + + internal static CloudLinkProperties DeserializeCloudLinkProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CloudLinkProvisioningState? provisioningState = default; + CloudLinkStatus? status = default; + string linkedCloud = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new CloudLinkProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new CloudLinkStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("linkedCloud"u8)) + { + linkedCloud = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CloudLinkProperties(provisioningState, status, linkedCloud, 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); + default: + throw new FormatException($"The model {nameof(CloudLinkProperties)} does not support writing '{options.Format}' format."); + } + } + + CloudLinkProperties 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 DeserializeCloudLinkProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CloudLinkProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkProperties.cs similarity index 65% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkProperties.cs index 40557248ca47..a555b527f063 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkProperties.cs @@ -7,17 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the AvsCloudLink data model. - /// A cloud link resource - /// - public partial class AvsCloudLinkData : ResourceData + /// The properties of a cloud link. + public partial class CloudLinkProperties { /// /// Keeps track of any properties unknown to the library. @@ -51,21 +45,17 @@ public partial class AvsCloudLinkData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public AvsCloudLinkData() + /// Initializes a new instance of . + public CloudLinkProperties() { } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// The provisioning state of the resource. /// The state of the cloud link. /// Identifier of the other private cloud participating in the link. /// Keeps track of any properties unknown to the library. - internal AvsCloudLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsCloudLinkProvisioningState? provisioningState, AvsCloudLinkStatus? status, ResourceIdentifier linkedCloud, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal CloudLinkProperties(CloudLinkProvisioningState? provisioningState, CloudLinkStatus? status, string linkedCloud, IDictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Status = status; @@ -74,10 +64,10 @@ internal AvsCloudLinkData(ResourceIdentifier id, string name, ResourceType resou } /// The provisioning state of the resource. - public AvsCloudLinkProvisioningState? ProvisioningState { get; } + public CloudLinkProvisioningState? ProvisioningState { get; } /// The state of the cloud link. - public AvsCloudLinkStatus? Status { get; } + public CloudLinkStatus? Status { get; } /// Identifier of the other private cloud participating in the link. - public ResourceIdentifier LinkedCloud { get; set; } + public string LinkedCloud { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkProvisioningState.cs new file mode 100644 index 000000000000..c66989507374 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// cloud link provisioning state. + public readonly partial struct CloudLinkProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CloudLinkProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static CloudLinkProvisioningState Succeeded { get; } = new CloudLinkProvisioningState(SucceededValue); + /// Resource creation failed. + public static CloudLinkProvisioningState Failed { get; } = new CloudLinkProvisioningState(FailedValue); + /// Resource creation was canceled. + public static CloudLinkProvisioningState Canceled { get; } = new CloudLinkProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(CloudLinkProvisioningState left, CloudLinkProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CloudLinkProvisioningState left, CloudLinkProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CloudLinkProvisioningState(string value) => new CloudLinkProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CloudLinkProvisioningState other && Equals(other); + /// + public bool Equals(CloudLinkProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkStatus.cs new file mode 100644 index 000000000000..bb64a2510135 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkStatus.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Cloud Link status. + public readonly partial struct CloudLinkStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CloudLinkStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string FailedValue = "Failed"; + private const string DisconnectedValue = "Disconnected"; + + /// is active. + public static CloudLinkStatus Active { get; } = new CloudLinkStatus(ActiveValue); + /// is building. + public static CloudLinkStatus Building { get; } = new CloudLinkStatus(BuildingValue); + /// is deleting. + public static CloudLinkStatus Deleting { get; } = new CloudLinkStatus(DeletingValue); + /// is failed. + public static CloudLinkStatus Failed { get; } = new CloudLinkStatus(FailedValue); + /// is disconnected. + public static CloudLinkStatus Disconnected { get; } = new CloudLinkStatus(DisconnectedValue); + /// Determines if two values are the same. + public static bool operator ==(CloudLinkStatus left, CloudLinkStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CloudLinkStatus left, CloudLinkStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CloudLinkStatus(string value) => new CloudLinkStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CloudLinkStatus other && Equals(other); + /// + public bool Equals(CloudLinkStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs index e38b6dd74fdf..bea982ed78d8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs @@ -83,7 +83,7 @@ internal static ClusterList DeserializeClusterList(JsonElement element, ModelRea { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static ClusterList DeserializeClusterList(JsonElement element, ModelRea { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(AvsPrivateCloudClusterData.DeserializeAvsPrivateCloudClusterData(item, options)); + array.Add(ClusterData.DeserializeClusterData(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs index ff288019954e..783ba4dbd693 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs @@ -49,7 +49,7 @@ internal partial class ClusterList /// Initializes a new instance of . /// The Cluster items on this page. /// is null. - internal ClusterList(IEnumerable value) + internal ClusterList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal ClusterList(IEnumerable value) /// The Cluster items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ClusterList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal ClusterList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal ClusterList() } /// The Cluster items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterPatch.Serialization.cs similarity index 73% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterPatch.Serialization.cs index d993ca5a35eb..145262a5cb53 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterPatch.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class AvsPrivateCloudClusterPatch : IUtf8JsonSerializable, IJsonModel + public partial class ClusterPatch : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterPatch)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ClusterPatch)} does not support writing '{format}' format."); } if (Optional.IsDefined(Sku)) @@ -74,19 +74,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AvsPrivateCloudClusterPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ClusterPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterPatch)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ClusterPatch)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudClusterPatch(document.RootElement, options); + return DeserializeClusterPatch(document.RootElement, options); } - internal static AvsPrivateCloudClusterPatch DeserializeAvsPrivateCloudClusterPatch(JsonElement element, ModelReaderWriterOptions options = null) + internal static ClusterPatch DeserializeClusterPatch(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -151,38 +151,38 @@ internal static AvsPrivateCloudClusterPatch DeserializeAvsPrivateCloudClusterPat } } serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudClusterPatch(sku, clusterSize, hosts ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ClusterPatch(sku, clusterSize, hosts ?? new ChangeTrackingList(), serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterPatch)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ClusterPatch)} does not support writing '{options.Format}' format."); } } - AvsPrivateCloudClusterPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ClusterPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsPrivateCloudClusterPatch(document.RootElement, options); + return DeserializeClusterPatch(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterPatch)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ClusterPatch)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterPatch.cs similarity index 84% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterPatch.cs index 7e0c78500168..dd09ac47db36 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterPatch.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterPatch.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// An update of a cluster resource. - public partial class AvsPrivateCloudClusterPatch + public partial class ClusterPatch { /// /// Keeps track of any properties unknown to the library. @@ -45,18 +45,18 @@ public partial class AvsPrivateCloudClusterPatch /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public AvsPrivateCloudClusterPatch() + /// Initializes a new instance of . + public ClusterPatch() { Hosts = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The SKU (Stock Keeping Unit) assigned to this resource. /// The cluster size. /// The hosts. /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudClusterPatch(AvsSku sku, int? clusterSize, IList hosts, IDictionary serializedAdditionalRawData) + internal ClusterPatch(AvsSku sku, int? clusterSize, IList hosts, IDictionary serializedAdditionalRawData) { Sku = sku; ClusterSize = clusterSize; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.Serialization.cs similarity index 50% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.Serialization.cs index 900fa3f90597..c780c4776101 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsManagementCluster.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.Serialization.cs @@ -13,30 +13,87 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class AvsManagementCluster : IUtf8JsonSerializable, IJsonModel + public partial class ClusterProperties : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); writer.WriteEndObject(); } - AvsManagementCluster IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsManagementCluster)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ClusterProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ClusterSize)) + { + writer.WritePropertyName("clusterSize"u8); + writer.WriteNumberValue(ClusterSize.Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ClusterId)) + { + writer.WritePropertyName("clusterId"u8); + writer.WriteNumberValue(ClusterId.Value); + } + if (Optional.IsCollectionDefined(Hosts)) + { + writer.WritePropertyName("hosts"u8); + writer.WriteStartArray(); + foreach (var item in Hosts) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(VsanDatastoreName)) + { + writer.WritePropertyName("vsanDatastoreName"u8); + writer.WriteStringValue(VsanDatastoreName); + } + 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 + } + } + } + + ClusterProperties 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(ClusterProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsManagementCluster(document.RootElement, options); + return DeserializeClusterProperties(document.RootElement, options); } - internal static AvsManagementCluster DeserializeAvsManagementCluster(JsonElement element, ModelReaderWriterOptions options = null) + internal static ClusterProperties DeserializeClusterProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -45,7 +102,7 @@ internal static AvsManagementCluster DeserializeAvsManagementCluster(JsonElement return null; } int? clusterSize = default; - AvsPrivateCloudClusterProvisioningState? provisioningState = default; + ClusterProvisioningState? provisioningState = default; int? clusterId = default; IList hosts = default; string vsanDatastoreName = default; @@ -68,7 +125,7 @@ internal static AvsManagementCluster DeserializeAvsManagementCluster(JsonElement { continue; } - provisioningState = new AvsPrivateCloudClusterProvisioningState(property.Value.GetString()); + provisioningState = new ClusterProvisioningState(property.Value.GetString()); continue; } if (property.NameEquals("clusterId"u8)) @@ -105,7 +162,7 @@ internal static AvsManagementCluster DeserializeAvsManagementCluster(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new AvsManagementCluster( + return new ClusterProperties( clusterSize, provisioningState, clusterId, @@ -114,35 +171,35 @@ internal static AvsManagementCluster DeserializeAvsManagementCluster(JsonElement serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsManagementCluster)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ClusterProperties)} does not support writing '{options.Format}' format."); } } - AvsManagementCluster IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ClusterProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsManagementCluster(document.RootElement, options); + return DeserializeClusterProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsManagementCluster)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ClusterProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.cs similarity index 59% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.cs index 11659771d1c0..5bfdc3fc1985 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.cs @@ -7,17 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the AvsPrivateCloudCluster data model. - /// A cluster resource - /// - public partial class AvsPrivateCloudClusterData : ResourceData + /// The properties of a cluster. + public partial class ClusterProperties { /// /// Keeps track of any properties unknown to the library. @@ -51,32 +45,21 @@ public partial class AvsPrivateCloudClusterData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// The SKU (Stock Keeping Unit) assigned to this resource. - /// is null. - public AvsPrivateCloudClusterData(AvsSku sku) + /// Initializes a new instance of . + public ClusterProperties() { - Argument.AssertNotNull(sku, nameof(sku)); - - Sku = sku; Hosts = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Initializes a new instance of . /// The cluster size. /// The state of the cluster provisioning. /// The identity. /// The hosts. /// Name of the vsan datastore associated with the cluster. /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsSku sku, int? clusterSize, AvsPrivateCloudClusterProvisioningState? provisioningState, int? clusterId, IList hosts, string vsanDatastoreName, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ClusterProperties(int? clusterSize, ClusterProvisioningState? provisioningState, int? clusterId, IList hosts, string vsanDatastoreName, IDictionary serializedAdditionalRawData) { - Sku = sku; ClusterSize = clusterSize; ProvisioningState = provisioningState; ClusterId = clusterId; @@ -85,17 +68,10 @@ internal AvsPrivateCloudClusterData(ResourceIdentifier id, string name, Resource _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal AvsPrivateCloudClusterData() - { - } - - /// The SKU (Stock Keeping Unit) assigned to this resource. - public AvsSku Sku { get; set; } /// The cluster size. public int? ClusterSize { get; set; } /// The state of the cluster provisioning. - public AvsPrivateCloudClusterProvisioningState? ProvisioningState { get; } + public ClusterProvisioningState? ProvisioningState { get; } /// The identity. public int? ClusterId { get; } /// The hosts. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProvisioningState.cs new file mode 100644 index 000000000000..c61c0e788dd0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProvisioningState.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Cluster provisioning state. + public readonly partial struct ClusterProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ClusterProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string CancelledValue = "Cancelled"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Resource has been created. + public static ClusterProvisioningState Succeeded { get; } = new ClusterProvisioningState(SucceededValue); + /// Resource creation failed. + public static ClusterProvisioningState Failed { get; } = new ClusterProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ClusterProvisioningState Canceled { get; } = new ClusterProvisioningState(CanceledValue); + /// is cancelled. + public static ClusterProvisioningState Cancelled { get; } = new ClusterProvisioningState(CancelledValue); + /// is deleting. + public static ClusterProvisioningState Deleting { get; } = new ClusterProvisioningState(DeletingValue); + /// is updating. + public static ClusterProvisioningState Updating { get; } = new ClusterProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(ClusterProvisioningState left, ClusterProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ClusterProvisioningState left, ClusterProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ClusterProvisioningState(string value) => new ClusterProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ClusterProvisioningState other && Equals(other); + /// + public bool Equals(ClusterProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZone.Serialization.cs similarity index 71% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZone.Serialization.cs index 714221c58a18..0e13630e1cb2 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZone.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class AvsClusterZone : IUtf8JsonSerializable, IJsonModel + public partial class ClusterZone : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsClusterZone)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ClusterZone)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsCollectionDefined(Hosts)) @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AvsClusterZone IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ClusterZone IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsClusterZone)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ClusterZone)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsClusterZone(document.RootElement, options); + return DeserializeClusterZone(document.RootElement, options); } - internal static AvsClusterZone DeserializeAvsClusterZone(JsonElement element, ModelReaderWriterOptions options = null) + internal static ClusterZone DeserializeClusterZone(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -117,38 +117,38 @@ internal static AvsClusterZone DeserializeAvsClusterZone(JsonElement element, Mo } } serializedAdditionalRawData = rawDataDictionary; - return new AvsClusterZone(hosts ?? new ChangeTrackingList(), zone, serializedAdditionalRawData); + return new ClusterZone(hosts ?? new ChangeTrackingList(), zone, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsClusterZone)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ClusterZone)} does not support writing '{options.Format}' format."); } } - AvsClusterZone IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ClusterZone IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsClusterZone(document.RootElement, options); + return DeserializeClusterZone(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsClusterZone)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ClusterZone)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZone.cs similarity index 86% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZone.cs index 699a673149d0..2860f16bbbcf 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsClusterZone.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZone.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// Zone and associated hosts info. - public partial class AvsClusterZone + public partial class ClusterZone { /// /// Keeps track of any properties unknown to the library. @@ -45,17 +45,17 @@ public partial class AvsClusterZone /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal AvsClusterZone() + /// Initializes a new instance of . + internal ClusterZone() { Hosts = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// List of hosts belonging to the availability zone in a cluster. /// Availability zone identifier. /// Keeps track of any properties unknown to the library. - internal AvsClusterZone(IReadOnlyList hosts, string zone, IDictionary serializedAdditionalRawData) + internal ClusterZone(IReadOnlyList hosts, string zone, IDictionary serializedAdditionalRawData) { Hosts = hosts; Zone = zone; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.Serialization.cs index cf9a03b46699..92cc9969c411 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.Serialization.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Avs.Models { - internal partial class ClusterZoneList : IUtf8JsonSerializable, IJsonModel + public partial class ClusterZoneList : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -81,7 +81,7 @@ internal static ClusterZoneList DeserializeClusterZoneList(JsonElement element, { return null; } - IReadOnlyList zones = default; + IReadOnlyList zones = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -92,10 +92,10 @@ internal static ClusterZoneList DeserializeClusterZoneList(JsonElement element, { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(AvsClusterZone.DeserializeAvsClusterZone(item, options)); + array.Add(ClusterZone.DeserializeClusterZone(item, options)); } zones = array; continue; @@ -106,7 +106,7 @@ internal static ClusterZoneList DeserializeClusterZoneList(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new ClusterZoneList(zones ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ClusterZoneList(zones ?? new ChangeTrackingList(), serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.cs index c8cacf160fb2..f28d4f692032 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterZoneList.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// List of all zones and associated hosts for a cluster. - internal partial class ClusterZoneList + public partial class ClusterZoneList { /// /// Keeps track of any properties unknown to the library. @@ -48,19 +48,19 @@ internal partial class ClusterZoneList /// Initializes a new instance of . internal ClusterZoneList() { - Zones = new ChangeTrackingList(); + Zones = new ChangeTrackingList(); } /// Initializes a new instance of . /// Zone and associated hosts info. /// Keeps track of any properties unknown to the library. - internal ClusterZoneList(IReadOnlyList zones, IDictionary serializedAdditionalRawData) + internal ClusterZoneList(IReadOnlyList zones, IDictionary serializedAdditionalRawData) { Zones = zones; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Zone and associated hosts info. - public IReadOnlyList Zones { get; } + public IReadOnlyList Zones { get; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs index 02856edcf02f..28eb26a9b621 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs @@ -83,7 +83,7 @@ internal static DatastoreList DeserializeDatastoreList(JsonElement element, Mode { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static DatastoreList DeserializeDatastoreList(JsonElement element, Mode { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(AvsPrivateCloudDatastoreData.DeserializeAvsPrivateCloudDatastoreData(item, options)); + array.Add(DatastoreData.DeserializeDatastoreData(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs index 85af1315a8b7..9897928c5c2b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs @@ -49,7 +49,7 @@ internal partial class DatastoreList /// Initializes a new instance of . /// The Datastore items on this page. /// is null. - internal DatastoreList(IEnumerable value) + internal DatastoreList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal DatastoreList(IEnumerable value) /// The Datastore items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal DatastoreList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal DatastoreList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal DatastoreList() } /// The Datastore items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProperties.Serialization.cs new file mode 100644 index 000000000000..4b6911d9d219 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProperties.Serialization.cs @@ -0,0 +1,216 @@ +// 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; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class DatastoreProperties : 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(DatastoreProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(NetAppVolume)) + { + writer.WritePropertyName("netAppVolume"u8); + JsonSerializer.Serialize(writer, NetAppVolume); + } + if (Optional.IsDefined(DiskPoolVolume)) + { + writer.WritePropertyName("diskPoolVolume"u8); + writer.WriteObjectValue(DiskPoolVolume, options); + } + if (Optional.IsDefined(ElasticSanVolume)) + { + writer.WritePropertyName("elasticSanVolume"u8); + writer.WriteObjectValue(ElasticSanVolume, options); + } + if (Optional.IsDefined(PureStorageVolume)) + { + writer.WritePropertyName("pureStorageVolume"u8); + writer.WriteObjectValue(PureStorageVolume, options); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + 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 + } + } + } + + DatastoreProperties 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(DatastoreProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatastoreProperties(document.RootElement, options); + } + + internal static DatastoreProperties DeserializeDatastoreProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DatastoreProvisioningState? provisioningState = default; + WritableSubResource netAppVolume = default; + DiskPoolVolume diskPoolVolume = default; + ElasticSanVolume elasticSanVolume = default; + PureStorageVolume pureStorageVolume = default; + DatastoreStatus? status = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DatastoreProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("netAppVolume"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + netAppVolume = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("diskPoolVolume"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskPoolVolume = DiskPoolVolume.DeserializeDiskPoolVolume(property.Value, options); + continue; + } + if (property.NameEquals("elasticSanVolume"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + elasticSanVolume = ElasticSanVolume.DeserializeElasticSanVolume(property.Value, options); + continue; + } + if (property.NameEquals("pureStorageVolume"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pureStorageVolume = PureStorageVolume.DeserializePureStorageVolume(property.Value, options); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new DatastoreStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatastoreProperties( + provisioningState, + netAppVolume, + diskPoolVolume, + elasticSanVolume, + pureStorageVolume, + status, + 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); + default: + throw new FormatException($"The model {nameof(DatastoreProperties)} does not support writing '{options.Format}' format."); + } + } + + DatastoreProperties 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 DeserializeDatastoreProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatastoreProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProperties.cs similarity index 73% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProperties.cs index 9adf75d2e24d..4ce8f6241c9b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProperties.cs @@ -8,17 +8,12 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the AvsPrivateCloudDatastore data model. - /// A datastore resource - /// - public partial class AvsPrivateCloudDatastoreData : ResourceData + /// The properties of a datastore. + public partial class DatastoreProperties { /// /// Keeps track of any properties unknown to the library. @@ -52,34 +47,32 @@ public partial class AvsPrivateCloudDatastoreData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public AvsPrivateCloudDatastoreData() + /// Initializes a new instance of . + public DatastoreProperties() { } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// The state of the datastore provisioning. /// An Azure NetApp Files volume. /// An iSCSI volume. /// An Elastic SAN volume. + /// A Pure Storage volume. /// The operational status of the datastore. /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudDatastoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsPrivateCloudDatastoreProvisioningState? provisioningState, WritableSubResource netAppVolume, DiskPoolVolume diskPoolVolume, ElasticSanVolume elasticSanVolume, DatastoreStatus? status, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal DatastoreProperties(DatastoreProvisioningState? provisioningState, WritableSubResource netAppVolume, DiskPoolVolume diskPoolVolume, ElasticSanVolume elasticSanVolume, PureStorageVolume pureStorageVolume, DatastoreStatus? status, IDictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; NetAppVolume = netAppVolume; DiskPoolVolume = diskPoolVolume; ElasticSanVolume = elasticSanVolume; + PureStorageVolume = pureStorageVolume; Status = status; _serializedAdditionalRawData = serializedAdditionalRawData; } /// The state of the datastore provisioning. - public AvsPrivateCloudDatastoreProvisioningState? ProvisioningState { get; } + public DatastoreProvisioningState? ProvisioningState { get; } /// An Azure NetApp Files volume. internal WritableSubResource NetAppVolume { get; set; } /// Gets or sets Id. @@ -105,6 +98,8 @@ public ResourceIdentifier ElasticSanVolumeTargetId set => ElasticSanVolume = new ElasticSanVolume(value); } + /// A Pure Storage volume. + public PureStorageVolume PureStorageVolume { get; set; } /// The operational status of the datastore. public DatastoreStatus? Status { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProvisioningState.cs new file mode 100644 index 000000000000..dc18a8f612f8 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProvisioningState.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// datastore provisioning state. + public readonly partial struct DatastoreProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DatastoreProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string CancelledValue = "Cancelled"; + private const string PendingValue = "Pending"; + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + + /// Resource has been created. + public static DatastoreProvisioningState Succeeded { get; } = new DatastoreProvisioningState(SucceededValue); + /// Resource creation failed. + public static DatastoreProvisioningState Failed { get; } = new DatastoreProvisioningState(FailedValue); + /// Resource creation was canceled. + public static DatastoreProvisioningState Canceled { get; } = new DatastoreProvisioningState(CanceledValue); + /// is cancelled. + public static DatastoreProvisioningState Cancelled { get; } = new DatastoreProvisioningState(CancelledValue); + /// is pending. + public static DatastoreProvisioningState Pending { get; } = new DatastoreProvisioningState(PendingValue); + /// is creating. + public static DatastoreProvisioningState Creating { get; } = new DatastoreProvisioningState(CreatingValue); + /// is updating. + public static DatastoreProvisioningState Updating { get; } = new DatastoreProvisioningState(UpdatingValue); + /// is deleting. + public static DatastoreProvisioningState Deleting { get; } = new DatastoreProvisioningState(DeletingValue); + /// Determines if two values are the same. + public static bool operator ==(DatastoreProvisioningState left, DatastoreProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatastoreProvisioningState left, DatastoreProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DatastoreProvisioningState(string value) => new DatastoreProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatastoreProvisioningState other && Equals(other); + /// + public bool Equals(DatastoreProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DhcpTypeEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DhcpTypeEnum.cs index 06a89a6f51cf..58c42c70b60a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DhcpTypeEnum.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DhcpTypeEnum.cs @@ -22,13 +22,13 @@ public DhcpTypeEnum(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string ServerValue = "SERVER"; - private const string RelayValue = "RELAY"; + private const string SERVERValue = "SERVER"; + private const string RELAYValue = "RELAY"; /// SERVER. - public static DhcpTypeEnum Server { get; } = new DhcpTypeEnum(ServerValue); + public static DhcpTypeEnum SERVER { get; } = new DhcpTypeEnum(SERVERValue); /// RELAY. - public static DhcpTypeEnum Relay { get; } = new DhcpTypeEnum(RelayValue); + public static DhcpTypeEnum RELAY { get; } = new DhcpTypeEnum(RELAYValue); /// Determines if two values are the same. public static bool operator ==(DhcpTypeEnum left, DhcpTypeEnum right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs index f6d501341424..132cdebdd530 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs @@ -85,9 +85,9 @@ internal static DiskPoolVolume DeserializeDiskPoolVolume(JsonElement element, Mo { return null; } - ResourceIdentifier targetId = default; + string targetId = default; string lunName = default; - LunMountMode? mountOption = default; + MountOptionEnum? mountOption = default; string path = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -95,7 +95,7 @@ internal static DiskPoolVolume DeserializeDiskPoolVolume(JsonElement element, Mo { if (property.NameEquals("targetId"u8)) { - targetId = new ResourceIdentifier(property.Value.GetString()); + targetId = property.Value.GetString(); continue; } if (property.NameEquals("lunName"u8)) @@ -109,7 +109,7 @@ internal static DiskPoolVolume DeserializeDiskPoolVolume(JsonElement element, Mo { continue; } - mountOption = new LunMountMode(property.Value.GetString()); + mountOption = new MountOptionEnum(property.Value.GetString()); continue; } if (property.NameEquals("path"u8)) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs index d93545d3da59..2f48b1f6fbaa 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.Avs.Models { @@ -50,7 +49,7 @@ public partial class DiskPoolVolume /// Azure resource ID of the iSCSI target. /// Name of the LUN to be used for datastore. /// or is null. - public DiskPoolVolume(ResourceIdentifier targetId, string lunName) + public DiskPoolVolume(string targetId, string lunName) { Argument.AssertNotNull(targetId, nameof(targetId)); Argument.AssertNotNull(lunName, nameof(lunName)); @@ -68,7 +67,7 @@ public DiskPoolVolume(ResourceIdentifier targetId, string lunName) /// /// Device path. /// Keeps track of any properties unknown to the library. - internal DiskPoolVolume(ResourceIdentifier targetId, string lunName, LunMountMode? mountOption, string path, IDictionary serializedAdditionalRawData) + internal DiskPoolVolume(string targetId, string lunName, MountOptionEnum? mountOption, string path, IDictionary serializedAdditionalRawData) { TargetId = targetId; LunName = lunName; @@ -83,14 +82,14 @@ internal DiskPoolVolume() } /// Azure resource ID of the iSCSI target. - public ResourceIdentifier TargetId { get; set; } + public string TargetId { get; set; } /// Name of the LUN to be used for datastore. public string LunName { get; set; } /// /// Mode that describes whether the LUN has to be mounted as a datastore or /// attached as a LUN /// - public LunMountMode? MountOption { get; set; } + public MountOptionEnum? MountOption { get; set; } /// Device path. public string Path { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceLogLevel.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceLogLevel.cs deleted file mode 100644 index 1ef989d2d19f..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceLogLevel.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// DNS service log level. - public readonly partial struct DnsServiceLogLevel : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public DnsServiceLogLevel(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DebugValue = "DEBUG"; - private const string InfoValue = "INFO"; - private const string WarningValue = "WARNING"; - private const string ErrorValue = "ERROR"; - private const string FatalValue = "FATAL"; - - /// is debug. - public static DnsServiceLogLevel Debug { get; } = new DnsServiceLogLevel(DebugValue); - /// is info. - public static DnsServiceLogLevel Info { get; } = new DnsServiceLogLevel(InfoValue); - /// is warning. - public static DnsServiceLogLevel Warning { get; } = new DnsServiceLogLevel(WarningValue); - /// is error. - public static DnsServiceLogLevel Error { get; } = new DnsServiceLogLevel(ErrorValue); - /// is fatal. - public static DnsServiceLogLevel Fatal { get; } = new DnsServiceLogLevel(FatalValue); - /// Determines if two values are the same. - public static bool operator ==(DnsServiceLogLevel left, DnsServiceLogLevel right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DnsServiceLogLevel left, DnsServiceLogLevel right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator DnsServiceLogLevel(string value) => new DnsServiceLogLevel(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DnsServiceLogLevel other && Equals(other); - /// - public bool Equals(DnsServiceLogLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceLogLevelEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceLogLevelEnum.cs new file mode 100644 index 000000000000..d073ef03365d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceLogLevelEnum.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// DNS service log level. + public readonly partial struct DnsServiceLogLevelEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DnsServiceLogLevelEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DEBUGValue = "DEBUG"; + private const string INFOValue = "INFO"; + private const string WARNINGValue = "WARNING"; + private const string ERRORValue = "ERROR"; + private const string FATALValue = "FATAL"; + + /// is debug. + public static DnsServiceLogLevelEnum DEBUG { get; } = new DnsServiceLogLevelEnum(DEBUGValue); + /// is info. + public static DnsServiceLogLevelEnum INFO { get; } = new DnsServiceLogLevelEnum(INFOValue); + /// is warning. + public static DnsServiceLogLevelEnum WARNING { get; } = new DnsServiceLogLevelEnum(WARNINGValue); + /// is error. + public static DnsServiceLogLevelEnum ERROR { get; } = new DnsServiceLogLevelEnum(ERRORValue); + /// is fatal. + public static DnsServiceLogLevelEnum FATAL { get; } = new DnsServiceLogLevelEnum(FATALValue); + /// Determines if two values are the same. + public static bool operator ==(DnsServiceLogLevelEnum left, DnsServiceLogLevelEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DnsServiceLogLevelEnum left, DnsServiceLogLevelEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DnsServiceLogLevelEnum(string value) => new DnsServiceLogLevelEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DnsServiceLogLevelEnum other && Equals(other); + /// + public bool Equals(DnsServiceLogLevelEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceStatusEnum.cs similarity index 53% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceStatus.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceStatusEnum.cs index 21fa2bbba645..b934412eec9f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceStatus.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceStatusEnum.cs @@ -11,36 +11,36 @@ namespace Azure.ResourceManager.Avs.Models { /// DNS service status. - public readonly partial struct DnsServiceStatus : IEquatable + public readonly partial struct DnsServiceStatusEnum : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public DnsServiceStatus(string value) + public DnsServiceStatusEnum(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string SuccessValue = "SUCCESS"; - private const string FailureValue = "FAILURE"; + private const string SUCCESSValue = "SUCCESS"; + private const string FAILUREValue = "FAILURE"; /// is success. - public static DnsServiceStatus Success { get; } = new DnsServiceStatus(SuccessValue); + public static DnsServiceStatusEnum SUCCESS { get; } = new DnsServiceStatusEnum(SUCCESSValue); /// is failure. - public static DnsServiceStatus Failure { get; } = new DnsServiceStatus(FailureValue); - /// Determines if two values are the same. - public static bool operator ==(DnsServiceStatus left, DnsServiceStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DnsServiceStatus left, DnsServiceStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator DnsServiceStatus(string value) => new DnsServiceStatus(value); + public static DnsServiceStatusEnum FAILURE { get; } = new DnsServiceStatusEnum(FAILUREValue); + /// Determines if two values are the same. + public static bool operator ==(DnsServiceStatusEnum left, DnsServiceStatusEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DnsServiceStatusEnum left, DnsServiceStatusEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DnsServiceStatusEnum(string value) => new DnsServiceStatusEnum(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DnsServiceStatus other && Equals(other); + public override bool Equals(object obj) => obj is DnsServiceStatusEnum other && Equals(other); /// - public bool Equals(DnsServiceStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(DnsServiceStatusEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsDnsZoneType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsZoneType.cs similarity index 50% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsDnsZoneType.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsZoneType.cs index c9083ae684b5..81ac561f2078 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsDnsZoneType.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsZoneType.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.Avs.Models { /// The type of DNS zone. - public readonly partial struct AvsDnsZoneType : IEquatable + public readonly partial struct DnsZoneType : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public AvsDnsZoneType(string value) + public DnsZoneType(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -26,21 +26,21 @@ public AvsDnsZoneType(string value) private const string PrivateValue = "Private"; /// Primary DNS zone. - public static AvsDnsZoneType Public { get; } = new AvsDnsZoneType(PublicValue); + public static DnsZoneType Public { get; } = new DnsZoneType(PublicValue); /// Private DNS zone. - public static AvsDnsZoneType Private { get; } = new AvsDnsZoneType(PrivateValue); - /// Determines if two values are the same. - public static bool operator ==(AvsDnsZoneType left, AvsDnsZoneType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsDnsZoneType left, AvsDnsZoneType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsDnsZoneType(string value) => new AvsDnsZoneType(value); + public static DnsZoneType Private { get; } = new DnsZoneType(PrivateValue); + /// Determines if two values are the same. + public static bool operator ==(DnsZoneType left, DnsZoneType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DnsZoneType left, DnsZoneType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DnsZoneType(string value) => new DnsZoneType(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsDnsZoneType other && Equals(other); + public override bool Equals(object obj) => obj is DnsZoneType other && Equals(other); /// - public bool Equals(AvsDnsZoneType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(DnsZoneType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.Serialization.cs similarity index 63% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.Serialization.cs index 505278c8dde0..0875cf3bb315 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class CustomerManagedEncryption : IUtf8JsonSerializable, IJsonModel + public partial class Encryption : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CustomerManagedEncryption)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Encryption)} does not support writing '{format}' format."); } if (Optional.IsDefined(Status)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CustomerManagedEncryption IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Encryption IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CustomerManagedEncryption)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Encryption)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCustomerManagedEncryption(document.RootElement, options); + return DeserializeEncryption(document.RootElement, options); } - internal static CustomerManagedEncryption DeserializeCustomerManagedEncryption(JsonElement element, ModelReaderWriterOptions options = null) + internal static Encryption DeserializeEncryption(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,8 +81,8 @@ internal static CustomerManagedEncryption DeserializeCustomerManagedEncryption(J { return null; } - AvsEncryptionState? status = default; - AvsEncryptionKeyVaultProperties keyVaultProperties = default; + EncryptionState? status = default; + EncryptionKeyVaultProperties keyVaultProperties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -93,7 +93,7 @@ internal static CustomerManagedEncryption DeserializeCustomerManagedEncryption(J { continue; } - status = new AvsEncryptionState(property.Value.GetString()); + status = new EncryptionState(property.Value.GetString()); continue; } if (property.NameEquals("keyVaultProperties"u8)) @@ -102,7 +102,7 @@ internal static CustomerManagedEncryption DeserializeCustomerManagedEncryption(J { continue; } - keyVaultProperties = AvsEncryptionKeyVaultProperties.DeserializeAvsEncryptionKeyVaultProperties(property.Value, options); + keyVaultProperties = EncryptionKeyVaultProperties.DeserializeEncryptionKeyVaultProperties(property.Value, options); continue; } if (options.Format != "W") @@ -111,38 +111,38 @@ internal static CustomerManagedEncryption DeserializeCustomerManagedEncryption(J } } serializedAdditionalRawData = rawDataDictionary; - return new CustomerManagedEncryption(status, keyVaultProperties, serializedAdditionalRawData); + return new Encryption(status, keyVaultProperties, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(CustomerManagedEncryption)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Encryption)} does not support writing '{options.Format}' format."); } } - CustomerManagedEncryption IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Encryption IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCustomerManagedEncryption(document.RootElement, options); + return DeserializeEncryption(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CustomerManagedEncryption)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Encryption)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.cs similarity index 79% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.cs index 89860cf37606..b1dfa577649b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CustomerManagedEncryption.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// The properties of customer managed encryption key. - public partial class CustomerManagedEncryption + public partial class Encryption { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class CustomerManagedEncryption /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public CustomerManagedEncryption() + /// Initializes a new instance of . + public Encryption() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Status of customer managed encryption key. /// The key vault where the encryption key is stored. /// Keeps track of any properties unknown to the library. - internal CustomerManagedEncryption(AvsEncryptionState? status, AvsEncryptionKeyVaultProperties keyVaultProperties, IDictionary serializedAdditionalRawData) + internal Encryption(EncryptionState? status, EncryptionKeyVaultProperties keyVaultProperties, IDictionary serializedAdditionalRawData) { Status = status; KeyVaultProperties = keyVaultProperties; @@ -62,8 +62,8 @@ internal CustomerManagedEncryption(AvsEncryptionState? status, AvsEncryptionKeyV } /// Status of customer managed encryption key. - public AvsEncryptionState? Status { get; set; } + public EncryptionState? Status { get; set; } /// The key vault where the encryption key is stored. - public AvsEncryptionKeyVaultProperties KeyVaultProperties { get; set; } + public EncryptionKeyVaultProperties KeyVaultProperties { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyStatus.cs similarity index 50% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyStatus.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyStatus.cs index 65d683b8f346..ffc8a7767838 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyStatus.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyStatus.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.Avs.Models { /// Whether the the encryption key is connected or access denied. - public readonly partial struct AvsEncryptionKeyStatus : IEquatable + public readonly partial struct EncryptionKeyStatus : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public AvsEncryptionKeyStatus(string value) + public EncryptionKeyStatus(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -26,21 +26,21 @@ public AvsEncryptionKeyStatus(string value) private const string AccessDeniedValue = "AccessDenied"; /// is connected. - public static AvsEncryptionKeyStatus Connected { get; } = new AvsEncryptionKeyStatus(ConnectedValue); + public static EncryptionKeyStatus Connected { get; } = new EncryptionKeyStatus(ConnectedValue); /// is access denied. - public static AvsEncryptionKeyStatus AccessDenied { get; } = new AvsEncryptionKeyStatus(AccessDeniedValue); - /// Determines if two values are the same. - public static bool operator ==(AvsEncryptionKeyStatus left, AvsEncryptionKeyStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AvsEncryptionKeyStatus left, AvsEncryptionKeyStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AvsEncryptionKeyStatus(string value) => new AvsEncryptionKeyStatus(value); + public static EncryptionKeyStatus AccessDenied { get; } = new EncryptionKeyStatus(AccessDeniedValue); + /// Determines if two values are the same. + public static bool operator ==(EncryptionKeyStatus left, EncryptionKeyStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EncryptionKeyStatus left, EncryptionKeyStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EncryptionKeyStatus(string value) => new EncryptionKeyStatus(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AvsEncryptionKeyStatus other && Equals(other); + public override bool Equals(object obj) => obj is EncryptionKeyStatus other && Equals(other); /// - public bool Equals(AvsEncryptionKeyStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(EncryptionKeyStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.Serialization.cs similarity index 68% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.Serialization.cs index 1f3e5f96f336..8aad18e04fff 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class AvsEncryptionKeyVaultProperties : IUtf8JsonSerializable, IJsonModel + public partial class EncryptionKeyVaultProperties : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsEncryptionKeyVaultProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(EncryptionKeyVaultProperties)} does not support writing '{format}' format."); } if (Optional.IsDefined(KeyName)) @@ -52,7 +52,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(KeyVaultUri)) { writer.WritePropertyName("keyVaultUrl"u8); - writer.WriteStringValue(KeyVaultUri.AbsoluteUri); + writer.WriteStringValue(KeyVaultUri); } if (options.Format != "W" && Optional.IsDefined(KeyState)) { @@ -81,19 +81,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AvsEncryptionKeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + EncryptionKeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsEncryptionKeyVaultProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(EncryptionKeyVaultProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsEncryptionKeyVaultProperties(document.RootElement, options); + return DeserializeEncryptionKeyVaultProperties(document.RootElement, options); } - internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static EncryptionKeyVaultProperties DeserializeEncryptionKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -104,9 +104,9 @@ internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVault string keyName = default; string keyVersion = default; string autoDetectedKeyVersion = default; - Uri keyVaultUrl = default; - AvsEncryptionKeyStatus? keyState = default; - AvsEncryptionVersionType? versionType = default; + string keyVaultUrl = default; + EncryptionKeyStatus? keyState = default; + EncryptionVersionType? versionType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -128,11 +128,7 @@ internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVault } if (property.NameEquals("keyVaultUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultUrl = new Uri(property.Value.GetString()); + keyVaultUrl = property.Value.GetString(); continue; } if (property.NameEquals("keyState"u8)) @@ -141,7 +137,7 @@ internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVault { continue; } - keyState = new AvsEncryptionKeyStatus(property.Value.GetString()); + keyState = new EncryptionKeyStatus(property.Value.GetString()); continue; } if (property.NameEquals("versionType"u8)) @@ -150,7 +146,7 @@ internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVault { continue; } - versionType = new AvsEncryptionVersionType(property.Value.GetString()); + versionType = new EncryptionVersionType(property.Value.GetString()); continue; } if (options.Format != "W") @@ -159,7 +155,7 @@ internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVault } } serializedAdditionalRawData = rawDataDictionary; - return new AvsEncryptionKeyVaultProperties( + return new EncryptionKeyVaultProperties( keyName, keyVersion, autoDetectedKeyVersion, @@ -169,35 +165,35 @@ internal static AvsEncryptionKeyVaultProperties DeserializeAvsEncryptionKeyVault serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsEncryptionKeyVaultProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(EncryptionKeyVaultProperties)} does not support writing '{options.Format}' format."); } } - AvsEncryptionKeyVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + EncryptionKeyVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsEncryptionKeyVaultProperties(document.RootElement, options); + return DeserializeEncryptionKeyVaultProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsEncryptionKeyVaultProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(EncryptionKeyVaultProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.cs similarity index 80% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.cs index 229442015f22..4c88e0aaafbd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsEncryptionKeyVaultProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// An Encryption Key. - public partial class AvsEncryptionKeyVaultProperties + public partial class EncryptionKeyVaultProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,12 +45,12 @@ public partial class AvsEncryptionKeyVaultProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public AvsEncryptionKeyVaultProperties() + /// Initializes a new instance of . + public EncryptionKeyVaultProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the key. /// The version of the key. /// The auto-detected version of the key if versionType is auto-detected. @@ -58,7 +58,7 @@ public AvsEncryptionKeyVaultProperties() /// The state of key provided. /// Property of the key if user provided or auto detected. /// Keeps track of any properties unknown to the library. - internal AvsEncryptionKeyVaultProperties(string keyName, string keyVersion, string autoDetectedKeyVersion, Uri keyVaultUri, AvsEncryptionKeyStatus? keyState, AvsEncryptionVersionType? versionType, IDictionary serializedAdditionalRawData) + internal EncryptionKeyVaultProperties(string keyName, string keyVersion, string autoDetectedKeyVersion, string keyVaultUri, EncryptionKeyStatus? keyState, EncryptionVersionType? versionType, IDictionary serializedAdditionalRawData) { KeyName = keyName; KeyVersion = keyVersion; @@ -76,10 +76,10 @@ internal AvsEncryptionKeyVaultProperties(string keyName, string keyVersion, stri /// The auto-detected version of the key if versionType is auto-detected. public string AutoDetectedKeyVersion { get; } /// The URL of the vault. - public Uri KeyVaultUri { get; set; } + public string KeyVaultUri { get; set; } /// The state of key provided. - public AvsEncryptionKeyStatus? KeyState { get; } + public EncryptionKeyStatus? KeyState { get; } /// Property of the key if user provided or auto detected. - public AvsEncryptionVersionType? VersionType { get; } + public EncryptionVersionType? VersionType { get; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionState.cs new file mode 100644 index 000000000000..a8910d5e3566 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Whether encryption is enabled or disabled. + public readonly partial struct EncryptionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EncryptionState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// is enabled. + public static EncryptionState Enabled { get; } = new EncryptionState(EnabledValue); + /// is disabled. + public static EncryptionState Disabled { get; } = new EncryptionState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(EncryptionState left, EncryptionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EncryptionState left, EncryptionState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EncryptionState(string value) => new EncryptionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EncryptionState other && Equals(other); + /// + public bool Equals(EncryptionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionVersionType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionVersionType.cs new file mode 100644 index 000000000000..f391f062ff18 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionVersionType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Whether the encryption version is fixed or auto-detected. + public readonly partial struct EncryptionVersionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EncryptionVersionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FixedValue = "Fixed"; + private const string AutoDetectedValue = "AutoDetected"; + + /// is fixed. + public static EncryptionVersionType Fixed { get; } = new EncryptionVersionType(FixedValue); + /// is auto-detected. + public static EncryptionVersionType AutoDetected { get; } = new EncryptionVersionType(AutoDetectedValue); + /// Determines if two values are the same. + public static bool operator ==(EncryptionVersionType left, EncryptionVersionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EncryptionVersionType left, EncryptionVersionType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EncryptionVersionType(string value) => new EncryptionVersionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EncryptionVersionType other && Equals(other); + /// + public bool Equals(EncryptionVersionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.Serialization.cs similarity index 75% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.Serialization.cs index b094a1fad4bd..befd5ffda144 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class AvsPrivateCloudEndpoints : IUtf8JsonSerializable, IJsonModel + public partial class Endpoints : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudEndpoints)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Endpoints)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(NsxtManager)) @@ -81,19 +81,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AvsPrivateCloudEndpoints IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Endpoints IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudEndpoints)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Endpoints)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudEndpoints(document.RootElement, options); + return DeserializeEndpoints(document.RootElement, options); } - internal static AvsPrivateCloudEndpoints DeserializeAvsPrivateCloudEndpoints(JsonElement element, ModelReaderWriterOptions options = null) + internal static Endpoints DeserializeEndpoints(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -147,7 +147,7 @@ internal static AvsPrivateCloudEndpoints DeserializeAvsPrivateCloudEndpoints(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudEndpoints( + return new Endpoints( nsxtManager, vcsa, hcxCloudManager, @@ -157,35 +157,35 @@ internal static AvsPrivateCloudEndpoints DeserializeAvsPrivateCloudEndpoints(Jso serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsPrivateCloudEndpoints)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Endpoints)} does not support writing '{options.Format}' format."); } } - AvsPrivateCloudEndpoints IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Endpoints IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsPrivateCloudEndpoints(document.RootElement, options); + return DeserializeEndpoints(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsPrivateCloudEndpoints)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Endpoints)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.cs similarity index 86% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.cs index de4bc26b07f3..46ded31325c5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudEndpoints.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// Endpoint addresses. - public partial class AvsPrivateCloudEndpoints + public partial class Endpoints { /// /// Keeps track of any properties unknown to the library. @@ -45,12 +45,12 @@ public partial class AvsPrivateCloudEndpoints /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal AvsPrivateCloudEndpoints() + /// Initializes a new instance of . + internal Endpoints() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Endpoint FQDN for the NSX-T Data Center manager. /// Endpoint FQDN for Virtual Center Server Appliance. /// Endpoint FQDN for the HCX Cloud Manager. @@ -58,7 +58,7 @@ internal AvsPrivateCloudEndpoints() /// Endpoint IP for Virtual Center Server Appliance. /// Endpoint IP for the HCX Cloud Manager. /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudEndpoints(string nsxtManager, string vcsa, string hcxCloudManager, string nsxtManagerIP, string vcenterIP, string hcxCloudManagerIP, IDictionary serializedAdditionalRawData) + internal Endpoints(string nsxtManager, string vcsa, string hcxCloudManager, string nsxtManagerIP, string vcenterIP, string hcxCloudManagerIP, IDictionary serializedAdditionalRawData) { NsxtManager = nsxtManager; Vcsa = vcsa; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationProperties.Serialization.cs new file mode 100644 index 000000000000..823fb009cc69 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationProperties.Serialization.cs @@ -0,0 +1,166 @@ +// 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.Avs.Models +{ + public partial class ExpressRouteAuthorizationProperties : 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(ExpressRouteAuthorizationProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ExpressRouteAuthorizationId)) + { + writer.WritePropertyName("expressRouteAuthorizationId"u8); + writer.WriteStringValue(ExpressRouteAuthorizationId); + } + if (options.Format != "W" && Optional.IsDefined(ExpressRouteAuthorizationKey)) + { + writer.WritePropertyName("expressRouteAuthorizationKey"u8); + writer.WriteStringValue(ExpressRouteAuthorizationKey); + } + if (Optional.IsDefined(ExpressRouteId)) + { + writer.WritePropertyName("expressRouteId"u8); + writer.WriteStringValue(ExpressRouteId); + } + 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 + } + } + } + + ExpressRouteAuthorizationProperties 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(ExpressRouteAuthorizationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExpressRouteAuthorizationProperties(document.RootElement, options); + } + + internal static ExpressRouteAuthorizationProperties DeserializeExpressRouteAuthorizationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ExpressRouteAuthorizationProvisioningState? provisioningState = default; + string expressRouteAuthorizationId = default; + string expressRouteAuthorizationKey = default; + string expressRouteId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ExpressRouteAuthorizationProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("expressRouteAuthorizationId"u8)) + { + expressRouteAuthorizationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("expressRouteAuthorizationKey"u8)) + { + expressRouteAuthorizationKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("expressRouteId"u8)) + { + expressRouteId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExpressRouteAuthorizationProperties(provisioningState, expressRouteAuthorizationId, expressRouteAuthorizationKey, expressRouteId, 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); + default: + throw new FormatException($"The model {nameof(ExpressRouteAuthorizationProperties)} does not support writing '{options.Format}' format."); + } + } + + ExpressRouteAuthorizationProperties 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 DeserializeExpressRouteAuthorizationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExpressRouteAuthorizationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationProperties.cs new file mode 100644 index 000000000000..290d90b195ae --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of an ExpressRoute Circuit Authorization resource. + public partial class ExpressRouteAuthorizationProperties + { + /// + /// 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 . + public ExpressRouteAuthorizationProperties() + { + } + + /// Initializes a new instance of . + /// The state of the ExpressRoute Circuit Authorization provisioning. + /// The ID of the ExpressRoute Circuit Authorization. + /// The key of the ExpressRoute Circuit Authorization. + /// The ID of the ExpressRoute Circuit. + /// Keeps track of any properties unknown to the library. + internal ExpressRouteAuthorizationProperties(ExpressRouteAuthorizationProvisioningState? provisioningState, string expressRouteAuthorizationId, string expressRouteAuthorizationKey, string expressRouteId, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + ExpressRouteAuthorizationId = expressRouteAuthorizationId; + ExpressRouteAuthorizationKey = expressRouteAuthorizationKey; + ExpressRouteId = expressRouteId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The state of the ExpressRoute Circuit Authorization provisioning. + public ExpressRouteAuthorizationProvisioningState? ProvisioningState { get; } + /// The ID of the ExpressRoute Circuit Authorization. + public string ExpressRouteAuthorizationId { get; } + /// The key of the ExpressRoute Circuit Authorization. + public string ExpressRouteAuthorizationKey { get; } + /// The ID of the ExpressRoute Circuit. + public string ExpressRouteId { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GeneralHostProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GeneralHostProperties.Serialization.cs new file mode 100644 index 000000000000..7ab2b98f6a30 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GeneralHostProperties.Serialization.cs @@ -0,0 +1,162 @@ +// 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.Avs.Models +{ + public partial class GeneralHostProperties : 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 override 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(GeneralHostProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + GeneralHostProperties 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(GeneralHostProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGeneralHostProperties(document.RootElement, options); + } + + internal static GeneralHostProperties DeserializeGeneralHostProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HostKind kind = default; + HostProvisioningState? provisioningState = default; + string displayName = default; + string moRefId = default; + string fqdn = default; + HostMaintenance? maintenance = default; + string faultDomain = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new HostKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new HostProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("moRefId"u8)) + { + moRefId = property.Value.GetString(); + continue; + } + if (property.NameEquals("fqdn"u8)) + { + fqdn = property.Value.GetString(); + continue; + } + if (property.NameEquals("maintenance"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maintenance = new HostMaintenance(property.Value.GetString()); + continue; + } + if (property.NameEquals("faultDomain"u8)) + { + faultDomain = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GeneralHostProperties( + kind, + provisioningState, + displayName, + moRefId, + fqdn, + maintenance, + faultDomain, + 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); + default: + throw new FormatException($"The model {nameof(GeneralHostProperties)} does not support writing '{options.Format}' format."); + } + } + + GeneralHostProperties 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 DeserializeGeneralHostProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GeneralHostProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GeneralHostProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GeneralHostProperties.cs new file mode 100644 index 000000000000..cabbd9c576f2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GeneralHostProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a general host. + public partial class GeneralHostProperties : HostProperties + { + /// Initializes a new instance of . + internal GeneralHostProperties() + { + Kind = HostKind.General; + } + + /// Initializes a new instance of . + /// The kind of host. + /// The state of the host provisioning. + /// Display name of the host in VMware vCenter. + /// vCenter managed object reference ID of the host. + /// Fully qualified domain name of the host. + /// If provided, the host is in maintenance. The value is the reason for maintenance. + /// + /// Keeps track of any properties unknown to the library. + internal GeneralHostProperties(HostKind kind, HostProvisioningState? provisioningState, string displayName, string moRefId, string fqdn, HostMaintenance? maintenance, string faultDomain, IDictionary serializedAdditionalRawData) : base(kind, provisioningState, displayName, moRefId, fqdn, maintenance, faultDomain, serializedAdditionalRawData) + { + Kind = kind; + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionProperties.Serialization.cs new file mode 100644 index 000000000000..d98b6a54622e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionProperties.Serialization.cs @@ -0,0 +1,199 @@ +// 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.Avs.Models +{ + public partial class GlobalReachConnectionProperties : 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(GlobalReachConnectionProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(AddressPrefix)) + { + writer.WritePropertyName("addressPrefix"u8); + writer.WriteStringValue(AddressPrefix); + } + if (Optional.IsDefined(AuthorizationKey)) + { + writer.WritePropertyName("authorizationKey"u8); + writer.WriteStringValue(AuthorizationKey); + } + if (options.Format != "W" && Optional.IsDefined(CircuitConnectionStatus)) + { + writer.WritePropertyName("circuitConnectionStatus"u8); + writer.WriteStringValue(CircuitConnectionStatus.Value.ToString()); + } + if (Optional.IsDefined(PeerExpressRouteCircuit)) + { + writer.WritePropertyName("peerExpressRouteCircuit"u8); + writer.WriteStringValue(PeerExpressRouteCircuit); + } + if (Optional.IsDefined(ExpressRouteId)) + { + writer.WritePropertyName("expressRouteId"u8); + writer.WriteStringValue(ExpressRouteId); + } + 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 + } + } + } + + GlobalReachConnectionProperties 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(GlobalReachConnectionProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGlobalReachConnectionProperties(document.RootElement, options); + } + + internal static GlobalReachConnectionProperties DeserializeGlobalReachConnectionProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GlobalReachConnectionProvisioningState? provisioningState = default; + string addressPrefix = default; + string authorizationKey = default; + GlobalReachConnectionStatus? circuitConnectionStatus = default; + string peerExpressRouteCircuit = default; + string expressRouteId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new GlobalReachConnectionProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("addressPrefix"u8)) + { + addressPrefix = property.Value.GetString(); + continue; + } + if (property.NameEquals("authorizationKey"u8)) + { + authorizationKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("circuitConnectionStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + circuitConnectionStatus = new GlobalReachConnectionStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("peerExpressRouteCircuit"u8)) + { + peerExpressRouteCircuit = property.Value.GetString(); + continue; + } + if (property.NameEquals("expressRouteId"u8)) + { + expressRouteId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GlobalReachConnectionProperties( + provisioningState, + addressPrefix, + authorizationKey, + circuitConnectionStatus, + peerExpressRouteCircuit, + expressRouteId, + 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); + default: + throw new FormatException($"The model {nameof(GlobalReachConnectionProperties)} does not support writing '{options.Format}' format."); + } + } + + GlobalReachConnectionProperties 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 DeserializeGlobalReachConnectionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GlobalReachConnectionProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionProperties.cs new file mode 100644 index 000000000000..5421ba5fc0c9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionProperties.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a global reach connection. + public partial class GlobalReachConnectionProperties + { + /// + /// 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 . + public GlobalReachConnectionProperties() + { + } + + /// Initializes a new instance of . + /// The state of the ExpressRoute Circuit Authorization provisioning. + /// + /// The network used for global reach carved out from the original network block + /// provided for the private cloud + /// + /// + /// Authorization key from the peer express route used for the global reach + /// connection + /// + /// The connection status of the global reach connection. + /// + /// Identifier of the ExpressRoute Circuit to peer with in the global reach + /// connection + /// + /// + /// The ID of the Private Cloud's ExpressRoute Circuit that is participating in the + /// global reach connection + /// + /// Keeps track of any properties unknown to the library. + internal GlobalReachConnectionProperties(GlobalReachConnectionProvisioningState? provisioningState, string addressPrefix, string authorizationKey, GlobalReachConnectionStatus? circuitConnectionStatus, string peerExpressRouteCircuit, string expressRouteId, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + AddressPrefix = addressPrefix; + AuthorizationKey = authorizationKey; + CircuitConnectionStatus = circuitConnectionStatus; + PeerExpressRouteCircuit = peerExpressRouteCircuit; + ExpressRouteId = expressRouteId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The state of the ExpressRoute Circuit Authorization provisioning. + public GlobalReachConnectionProvisioningState? ProvisioningState { get; } + /// + /// The network used for global reach carved out from the original network block + /// provided for the private cloud + /// + public string AddressPrefix { get; } + /// + /// Authorization key from the peer express route used for the global reach + /// connection + /// + public string AuthorizationKey { get; set; } + /// The connection status of the global reach connection. + public GlobalReachConnectionStatus? CircuitConnectionStatus { get; } + /// + /// Identifier of the ExpressRoute Circuit to peer with in the global reach + /// connection + /// + public string PeerExpressRouteCircuit { get; set; } + /// + /// The ID of the Private Cloud's ExpressRoute Circuit that is participating in the + /// global reach connection + /// + public string ExpressRouteId { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteProperties.Serialization.cs new file mode 100644 index 000000000000..81d768956609 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteProperties.Serialization.cs @@ -0,0 +1,159 @@ +// 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.Avs.Models +{ + public partial class HcxEnterpriseSiteProperties : 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(HcxEnterpriseSiteProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ActivationKey)) + { + writer.WritePropertyName("activationKey"u8); + writer.WriteStringValue(ActivationKey); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + 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 + } + } + } + + HcxEnterpriseSiteProperties 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(HcxEnterpriseSiteProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHcxEnterpriseSiteProperties(document.RootElement, options); + } + + internal static HcxEnterpriseSiteProperties DeserializeHcxEnterpriseSiteProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HcxEnterpriseSiteProvisioningState? provisioningState = default; + string activationKey = default; + HcxEnterpriseSiteStatus? status = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new HcxEnterpriseSiteProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("activationKey"u8)) + { + activationKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new HcxEnterpriseSiteStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HcxEnterpriseSiteProperties(provisioningState, activationKey, status, 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); + default: + throw new FormatException($"The model {nameof(HcxEnterpriseSiteProperties)} does not support writing '{options.Format}' format."); + } + } + + HcxEnterpriseSiteProperties 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 DeserializeHcxEnterpriseSiteProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HcxEnterpriseSiteProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteProperties.cs new file mode 100644 index 000000000000..a3b9652e1cd0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of an HCX Enterprise Site. + public partial class HcxEnterpriseSiteProperties + { + /// + /// 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 . + public HcxEnterpriseSiteProperties() + { + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// The activation key. + /// The status of the HCX Enterprise Site. + /// Keeps track of any properties unknown to the library. + internal HcxEnterpriseSiteProperties(HcxEnterpriseSiteProvisioningState? provisioningState, string activationKey, HcxEnterpriseSiteStatus? status, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + ActivationKey = activationKey; + Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The provisioning state of the resource. + public HcxEnterpriseSiteProvisioningState? ProvisioningState { get; } + /// The activation key. + public string ActivationKey { get; } + /// The status of the HCX Enterprise Site. + public HcxEnterpriseSiteStatus? Status { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostKind.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostKind.cs new file mode 100644 index 000000000000..57e23d7aac23 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostKind.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The kind of host. + internal readonly partial struct HostKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HostKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GeneralValue = "General"; + private const string SpecializedValue = "Specialized"; + + /// General. + public static HostKind General { get; } = new HostKind(GeneralValue); + /// Specialized. + public static HostKind Specialized { get; } = new HostKind(SpecializedValue); + /// Determines if two values are the same. + public static bool operator ==(HostKind left, HostKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HostKind left, HostKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HostKind(string value) => new HostKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HostKind other && Equals(other); + /// + public bool Equals(HostKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostListResult.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostListResult.Serialization.cs new file mode 100644 index 000000000000..cad67585bd22 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostListResult.Serialization.cs @@ -0,0 +1,151 @@ +// 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.Avs.Models +{ + internal partial class HostListResult : 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(HostListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + 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 + } + } + } + + HostListResult 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(HostListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHostListResult(document.RootElement, options); + } + + internal static HostListResult DeserializeHostListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HostData.DeserializeHostData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HostListResult(value, nextLink, 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); + default: + throw new FormatException($"The model {nameof(HostListResult)} does not support writing '{options.Format}' format."); + } + } + + HostListResult 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 DeserializeHostListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HostListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostListResult.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostListResult.cs new file mode 100644 index 000000000000..9d4ec905b04b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The response of a Host list operation. + internal partial class HostListResult + { + /// + /// 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 Host items on this page. + /// is null. + internal HostListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Host items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal HostListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HostListResult() + { + } + + /// The Host items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostMaintenance.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostMaintenance.cs new file mode 100644 index 000000000000..4ab21126e622 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostMaintenance.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The reason for host maintenance. + public readonly partial struct HostMaintenance : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HostMaintenance(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ReplacementValue = "Replacement"; + private const string UpgradeValue = "Upgrade"; + + /// The host is a replacement host. + public static HostMaintenance Replacement { get; } = new HostMaintenance(ReplacementValue); + /// The host is for an upgrade, such as an upgrade to ESXi, NSX-T, or other component. + public static HostMaintenance Upgrade { get; } = new HostMaintenance(UpgradeValue); + /// Determines if two values are the same. + public static bool operator ==(HostMaintenance left, HostMaintenance right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HostMaintenance left, HostMaintenance right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HostMaintenance(string value) => new HostMaintenance(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HostMaintenance other && Equals(other); + /// + public bool Equals(HostMaintenance other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostProperties.Serialization.cs new file mode 100644 index 000000000000..290e5d050439 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostProperties.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + [PersistableModelProxy(typeof(UnknownHostProperties))] + public partial class HostProperties : 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(HostProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (options.Format != "W" && Optional.IsDefined(MoRefId)) + { + writer.WritePropertyName("moRefId"u8); + writer.WriteStringValue(MoRefId); + } + if (options.Format != "W" && Optional.IsDefined(Fqdn)) + { + writer.WritePropertyName("fqdn"u8); + writer.WriteStringValue(Fqdn); + } + if (Optional.IsDefined(Maintenance)) + { + writer.WritePropertyName("maintenance"u8); + writer.WriteStringValue(Maintenance.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(FaultDomain)) + { + writer.WritePropertyName("faultDomain"u8); + writer.WriteStringValue(FaultDomain); + } + 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 + } + } + } + + HostProperties 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(HostProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHostProperties(document.RootElement, options); + } + + internal static HostProperties DeserializeHostProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "General": return GeneralHostProperties.DeserializeGeneralHostProperties(element, options); + case "Specialized": return SpecializedHostProperties.DeserializeSpecializedHostProperties(element, options); + } + } + return UnknownHostProperties.DeserializeUnknownHostProperties(element, options); + } + + 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); + default: + throw new FormatException($"The model {nameof(HostProperties)} does not support writing '{options.Format}' format."); + } + } + + HostProperties 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 DeserializeHostProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HostProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostProperties.cs new file mode 100644 index 000000000000..ab080113428c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostProperties.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// + /// The properties of a host. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class HostProperties + { + /// + /// 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 protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected HostProperties() + { + } + + /// Initializes a new instance of . + /// The kind of host. + /// The state of the host provisioning. + /// Display name of the host in VMware vCenter. + /// vCenter managed object reference ID of the host. + /// Fully qualified domain name of the host. + /// If provided, the host is in maintenance. The value is the reason for maintenance. + /// + /// Keeps track of any properties unknown to the library. + internal HostProperties(HostKind kind, HostProvisioningState? provisioningState, string displayName, string moRefId, string fqdn, HostMaintenance? maintenance, string faultDomain, IDictionary serializedAdditionalRawData) + { + Kind = kind; + ProvisioningState = provisioningState; + DisplayName = displayName; + MoRefId = moRefId; + Fqdn = fqdn; + Maintenance = maintenance; + FaultDomain = faultDomain; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The kind of host. + internal HostKind Kind { get; set; } + /// The state of the host provisioning. + public HostProvisioningState? ProvisioningState { get; } + /// Display name of the host in VMware vCenter. + public string DisplayName { get; } + /// vCenter managed object reference ID of the host. + public string MoRefId { get; } + /// Fully qualified domain name of the host. + public string Fqdn { get; } + /// If provided, the host is in maintenance. The value is the reason for maintenance. + public HostMaintenance? Maintenance { get; } + /// Gets the fault domain. + public string FaultDomain { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostProvisioningState.cs new file mode 100644 index 000000000000..829e04450606 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HostProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// provisioning state of the host. + public readonly partial struct HostProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HostProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static HostProvisioningState Succeeded { get; } = new HostProvisioningState(SucceededValue); + /// Resource creation failed. + public static HostProvisioningState Failed { get; } = new HostProvisioningState(FailedValue); + /// Resource creation was canceled. + public static HostProvisioningState Canceled { get; } = new HostProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(HostProvisioningState left, HostProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HostProvisioningState left, HostProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HostProvisioningState(string value) => new HostProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HostProvisioningState other && Equals(other); + /// + public bool Equals(HostProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.Serialization.cs similarity index 72% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.Serialization.cs index a5a92ba6d7dc..bb21f2538f1e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class SingleSignOnIdentitySource : IUtf8JsonSerializable, IJsonModel + public partial class IdentitySource : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(SingleSignOnIdentitySource)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(IdentitySource)} does not support writing '{format}' format."); } if (Optional.IsDefined(Name)) @@ -62,12 +62,12 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(PrimaryServer)) { writer.WritePropertyName("primaryServer"u8); - writer.WriteStringValue(PrimaryServer.AbsoluteUri); + writer.WriteStringValue(PrimaryServer); } if (Optional.IsDefined(SecondaryServer)) { writer.WritePropertyName("secondaryServer"u8); - writer.WriteStringValue(SecondaryServer.AbsoluteUri); + writer.WriteStringValue(SecondaryServer); } if (Optional.IsDefined(Ssl)) { @@ -101,19 +101,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SingleSignOnIdentitySource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + IdentitySource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(SingleSignOnIdentitySource)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(IdentitySource)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSingleSignOnIdentitySource(document.RootElement, options); + return DeserializeIdentitySource(document.RootElement, options); } - internal static SingleSignOnIdentitySource DeserializeSingleSignOnIdentitySource(JsonElement element, ModelReaderWriterOptions options = null) + internal static IdentitySource DeserializeIdentitySource(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -126,9 +126,9 @@ internal static SingleSignOnIdentitySource DeserializeSingleSignOnIdentitySource string domain = default; string baseUserDN = default; string baseGroupDN = default; - Uri primaryServer = default; - Uri secondaryServer = default; - SslCertificateStatus? ssl = default; + string primaryServer = default; + string secondaryServer = default; + SslEnum? ssl = default; string username = default; string password = default; IDictionary serializedAdditionalRawData = default; @@ -162,20 +162,12 @@ internal static SingleSignOnIdentitySource DeserializeSingleSignOnIdentitySource } if (property.NameEquals("primaryServer"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - primaryServer = new Uri(property.Value.GetString()); + primaryServer = property.Value.GetString(); continue; } if (property.NameEquals("secondaryServer"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - secondaryServer = new Uri(property.Value.GetString()); + secondaryServer = property.Value.GetString(); continue; } if (property.NameEquals("ssl"u8)) @@ -184,7 +176,7 @@ internal static SingleSignOnIdentitySource DeserializeSingleSignOnIdentitySource { continue; } - ssl = new SslCertificateStatus(property.Value.GetString()); + ssl = new SslEnum(property.Value.GetString()); continue; } if (property.NameEquals("username"u8)) @@ -203,7 +195,7 @@ internal static SingleSignOnIdentitySource DeserializeSingleSignOnIdentitySource } } serializedAdditionalRawData = rawDataDictionary; - return new SingleSignOnIdentitySource( + return new IdentitySource( name, @alias, domain, @@ -217,35 +209,35 @@ internal static SingleSignOnIdentitySource DeserializeSingleSignOnIdentitySource serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(SingleSignOnIdentitySource)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(IdentitySource)} does not support writing '{options.Format}' format."); } } - SingleSignOnIdentitySource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + IdentitySource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSingleSignOnIdentitySource(document.RootElement, options); + return DeserializeIdentitySource(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(SingleSignOnIdentitySource)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(IdentitySource)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.cs similarity index 83% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.cs index 1faa6cc6ab41..b0f9ee8a0f89 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SingleSignOnIdentitySource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// vCenter Single Sign On Identity Source. - public partial class SingleSignOnIdentitySource + public partial class IdentitySource { /// /// Keeps track of any properties unknown to the library. @@ -45,15 +45,15 @@ public partial class SingleSignOnIdentitySource /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public SingleSignOnIdentitySource() + /// Initializes a new instance of . + public IdentitySource() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the identity source. /// The domain's NetBIOS name. - /// The domain's dns name. + /// The domain's DNS name. /// The base distinguished name for users. /// The base distinguished name for groups. /// Primary server URL. @@ -68,7 +68,7 @@ public SingleSignOnIdentitySource() /// Base DN for users and groups. /// /// Keeps track of any properties unknown to the library. - internal SingleSignOnIdentitySource(string name, string @alias, string domain, string baseUserDN, string baseGroupDN, Uri primaryServer, Uri secondaryServer, SslCertificateStatus? ssl, string username, string password, IDictionary serializedAdditionalRawData) + internal IdentitySource(string name, string @alias, string domain, string baseUserDN, string baseGroupDN, string primaryServer, string secondaryServer, SslEnum? ssl, string username, string password, IDictionary serializedAdditionalRawData) { Name = name; Alias = @alias; @@ -87,18 +87,18 @@ internal SingleSignOnIdentitySource(string name, string @alias, string domain, s public string Name { get; set; } /// The domain's NetBIOS name. public string Alias { get; set; } - /// The domain's dns name. + /// The domain's DNS name. public string Domain { get; set; } /// The base distinguished name for users. public string BaseUserDN { get; set; } /// The base distinguished name for groups. public string BaseGroupDN { get; set; } /// Primary server URL. - public Uri PrimaryServer { get; set; } + public string PrimaryServer { get; set; } /// Secondary server URL. - public Uri SecondaryServer { get; set; } + public string SecondaryServer { get; set; } /// Protect LDAP communication using SSL certificate (LDAPS). - public SslCertificateStatus? Ssl { get; set; } + public SslEnum? Ssl { get; set; } /// /// The ID of an Active Directory user with a minimum of read-only access to Base /// DN for users and group diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/InternetConnectivityState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/InternetEnum.cs similarity index 51% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/InternetConnectivityState.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/InternetEnum.cs index 82a7b97cf5bc..ab9bac249a0b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/InternetConnectivityState.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/InternetEnum.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.Avs.Models { /// Whether internet is enabled or disabled. - public readonly partial struct InternetConnectivityState : IEquatable + public readonly partial struct InternetEnum : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public InternetConnectivityState(string value) + public InternetEnum(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -26,21 +26,21 @@ public InternetConnectivityState(string value) private const string DisabledValue = "Disabled"; /// is enabled. - public static InternetConnectivityState Enabled { get; } = new InternetConnectivityState(EnabledValue); + public static InternetEnum Enabled { get; } = new InternetEnum(EnabledValue); /// is disabled. - public static InternetConnectivityState Disabled { get; } = new InternetConnectivityState(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(InternetConnectivityState left, InternetConnectivityState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(InternetConnectivityState left, InternetConnectivityState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator InternetConnectivityState(string value) => new InternetConnectivityState(value); + public static InternetEnum Disabled { get; } = new InternetEnum(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(InternetEnum left, InternetEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InternetEnum left, InternetEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator InternetEnum(string value) => new InternetEnum(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is InternetConnectivityState other && Equals(other); + public override bool Equals(object obj) => obj is InternetEnum other && Equals(other); /// - public bool Equals(InternetConnectivityState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(InternetEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IscsiPathProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IscsiPathProperties.Serialization.cs new file mode 100644 index 000000000000..6dbbdff57e49 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IscsiPathProperties.Serialization.cs @@ -0,0 +1,141 @@ +// 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.Avs.Models +{ + public partial class IscsiPathProperties : 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(IscsiPathProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("networkBlock"u8); + writer.WriteStringValue(NetworkBlock); + 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 + } + } + } + + IscsiPathProperties 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(IscsiPathProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIscsiPathProperties(document.RootElement, options); + } + + internal static IscsiPathProperties DeserializeIscsiPathProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IscsiPathProvisioningState? provisioningState = default; + string networkBlock = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new IscsiPathProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkBlock"u8)) + { + networkBlock = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new IscsiPathProperties(provisioningState, networkBlock, 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); + default: + throw new FormatException($"The model {nameof(IscsiPathProperties)} does not support writing '{options.Format}' format."); + } + } + + IscsiPathProperties 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 DeserializeIscsiPathProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IscsiPathProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IscsiPathProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IscsiPathProperties.cs new file mode 100644 index 000000000000..768f59c6512e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IscsiPathProperties.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of an iSCSI path resource. + public partial class IscsiPathProperties + { + /// + /// 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 . + /// CIDR Block for iSCSI path. + /// is null. + public IscsiPathProperties(string networkBlock) + { + Argument.AssertNotNull(networkBlock, nameof(networkBlock)); + + NetworkBlock = networkBlock; + } + + /// Initializes a new instance of . + /// The state of the iSCSI path provisioning. + /// CIDR Block for iSCSI path. + /// Keeps track of any properties unknown to the library. + internal IscsiPathProperties(IscsiPathProvisioningState? provisioningState, string networkBlock, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + NetworkBlock = networkBlock; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal IscsiPathProperties() + { + } + + /// The state of the iSCSI path provisioning. + public IscsiPathProvisioningState? ProvisioningState { get; } + /// CIDR Block for iSCSI path. + public string NetworkBlock { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/LunMountMode.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/LunMountMode.cs deleted file mode 100644 index 53b4dd351648..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/LunMountMode.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// - /// Mode that describes whether the LUN has to be mounted as a datastore or - /// attached as a LUN - /// - public readonly partial struct LunMountMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public LunMountMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MountValue = "MOUNT"; - private const string AttachValue = "ATTACH"; - - /// is mount. - public static LunMountMode Mount { get; } = new LunMountMode(MountValue); - /// is attach. - public static LunMountMode Attach { get; } = new LunMountMode(AttachValue); - /// Determines if two values are the same. - public static bool operator ==(LunMountMode left, LunMountMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(LunMountMode left, LunMountMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator LunMountMode(string value) => new LunMountMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is LunMountMode other && Equals(other); - /// - public bool Equals(LunMountMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.Serialization.cs new file mode 100644 index 000000000000..20fffd14cc01 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.Serialization.cs @@ -0,0 +1,205 @@ +// 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.Avs.Models +{ + public partial class ManagementCluster : 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(ManagementCluster)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ClusterSize)) + { + writer.WritePropertyName("clusterSize"u8); + writer.WriteNumberValue(ClusterSize.Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ClusterId)) + { + writer.WritePropertyName("clusterId"u8); + writer.WriteNumberValue(ClusterId.Value); + } + if (Optional.IsCollectionDefined(Hosts)) + { + writer.WritePropertyName("hosts"u8); + writer.WriteStartArray(); + foreach (var item in Hosts) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(VsanDatastoreName)) + { + writer.WritePropertyName("vsanDatastoreName"u8); + writer.WriteStringValue(VsanDatastoreName); + } + 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 + } + } + } + + ManagementCluster 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(ManagementCluster)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagementCluster(document.RootElement, options); + } + + internal static ManagementCluster DeserializeManagementCluster(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? clusterSize = default; + ClusterProvisioningState? provisioningState = default; + int? clusterId = default; + IList hosts = default; + string vsanDatastoreName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clusterSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clusterSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ClusterProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("clusterId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clusterId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("hosts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + hosts = array; + continue; + } + if (property.NameEquals("vsanDatastoreName"u8)) + { + vsanDatastoreName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagementCluster( + clusterSize, + provisioningState, + clusterId, + hosts ?? new ChangeTrackingList(), + vsanDatastoreName, + 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); + default: + throw new FormatException($"The model {nameof(ManagementCluster)} does not support writing '{options.Format}' format."); + } + } + + ManagementCluster 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 DeserializeManagementCluster(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagementCluster)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.cs new file mode 100644 index 000000000000..734ab11f2f63 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a management cluster. + public partial class ManagementCluster + { + /// + /// 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 . + public ManagementCluster() + { + Hosts = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The cluster size. + /// The state of the cluster provisioning. + /// The identity. + /// The hosts. + /// Name of the vsan datastore associated with the cluster. + /// Keeps track of any properties unknown to the library. + internal ManagementCluster(int? clusterSize, ClusterProvisioningState? provisioningState, int? clusterId, IList hosts, string vsanDatastoreName, IDictionary serializedAdditionalRawData) + { + ClusterSize = clusterSize; + ProvisioningState = provisioningState; + ClusterId = clusterId; + Hosts = hosts; + VsanDatastoreName = vsanDatastoreName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The cluster size. + public int? ClusterSize { get; set; } + /// The state of the cluster provisioning. + public ClusterProvisioningState? ProvisioningState { get; } + /// The identity. + public int? ClusterId { get; } + /// The hosts. + public IList Hosts { get; } + /// Name of the vsan datastore associated with the cluster. + public string VsanDatastoreName { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/MountOptionEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/MountOptionEnum.cs new file mode 100644 index 000000000000..898b1895ec18 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/MountOptionEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// mount option. + public readonly partial struct MountOptionEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MountOptionEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MOUNTValue = "MOUNT"; + private const string ATTACHValue = "ATTACH"; + + /// is mount. + public static MountOptionEnum MOUNT { get; } = new MountOptionEnum(MOUNTValue); + /// is attach. + public static MountOptionEnum ATTACH { get; } = new MountOptionEnum(ATTACHValue); + /// Determines if two values are the same. + public static bool operator ==(MountOptionEnum left, MountOptionEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MountOptionEnum left, MountOptionEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MountOptionEnum(string value) => new MountOptionEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MountOptionEnum other && Equals(other); + /// + public bool Equals(MountOptionEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/OptionalParamEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/OptionalParamEnum.cs new file mode 100644 index 000000000000..5967c3e8d153 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/OptionalParamEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Optional Param. + public readonly partial struct OptionalParamEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OptionalParamEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OptionalValue = "Optional"; + private const string RequiredValue = "Required"; + + /// is optional. + public static OptionalParamEnum Optional { get; } = new OptionalParamEnum(OptionalValue); + /// is required. + public static OptionalParamEnum Required { get; } = new OptionalParamEnum(RequiredValue); + /// Determines if two values are the same. + public static bool operator ==(OptionalParamEnum left, OptionalParamEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OptionalParamEnum left, OptionalParamEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OptionalParamEnum(string value) => new OptionalParamEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OptionalParamEnum other && Equals(other); + /// + public bool Equals(OptionalParamEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.Serialization.cs similarity index 66% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.Serialization.cs index 7eea22b3052b..d41ad811179f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class PSCredentialExecutionParameterDetails : IUtf8JsonSerializable, IJsonModel + public partial class PSCredentialExecutionParameter : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writ /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(PSCredentialExecutionParameterDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(PSCredentialExecutionParameter)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -47,19 +47,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - PSCredentialExecutionParameterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PSCredentialExecutionParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(PSCredentialExecutionParameterDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(PSCredentialExecutionParameter)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePSCredentialExecutionParameterDetails(document.RootElement, options); + return DeserializePSCredentialExecutionParameter(document.RootElement, options); } - internal static PSCredentialExecutionParameterDetails DeserializePSCredentialExecutionParameterDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static PSCredentialExecutionParameter DeserializePSCredentialExecutionParameter(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -101,38 +101,38 @@ internal static PSCredentialExecutionParameterDetails DeserializePSCredentialExe } } serializedAdditionalRawData = rawDataDictionary; - return new PSCredentialExecutionParameterDetails(type, name, serializedAdditionalRawData, username, password); + return new PSCredentialExecutionParameter(type, name, serializedAdditionalRawData, username, password); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(PSCredentialExecutionParameterDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(PSCredentialExecutionParameter)} does not support writing '{options.Format}' format."); } } - PSCredentialExecutionParameterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PSCredentialExecutionParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePSCredentialExecutionParameterDetails(document.RootElement, options); + return DeserializePSCredentialExecutionParameter(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(PSCredentialExecutionParameterDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(PSCredentialExecutionParameter)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.cs similarity index 60% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.cs index d1faa6ccc178..a6eb02f0668f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameterDetails.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.cs @@ -11,33 +11,33 @@ namespace Azure.ResourceManager.Avs.Models { /// a powershell credential object. - public partial class PSCredentialExecutionParameterDetails : ScriptExecutionParameterDetails + public partial class PSCredentialExecutionParameter : ScriptExecutionParameter { - /// Initializes a new instance of . + /// Initializes a new instance of . /// The parameter name. /// is null. - public PSCredentialExecutionParameterDetails(string name) : base(name) + public PSCredentialExecutionParameter(string name) : base(name) { Argument.AssertNotNull(name, nameof(name)); - ParameterType = ScriptExecutionParameterType.Credential; + Type = ScriptExecutionParameterType.Credential; } - /// Initializes a new instance of . - /// script execution parameter type. + /// Initializes a new instance of . + /// script execution parameter type. /// The parameter name. /// Keeps track of any properties unknown to the library. /// username for login. /// password for login. - internal PSCredentialExecutionParameterDetails(ScriptExecutionParameterType parameterType, string name, IDictionary serializedAdditionalRawData, string username, string password) : base(parameterType, name, serializedAdditionalRawData) + internal PSCredentialExecutionParameter(ScriptExecutionParameterType type, string name, IDictionary serializedAdditionalRawData, string username, string password) : base(type, name, serializedAdditionalRawData) { Username = username; Password = password; - ParameterType = parameterType; + Type = type; } - /// Initializes a new instance of for deserialization. - internal PSCredentialExecutionParameterDetails() + /// Initializes a new instance of for deserialization. + internal PSCredentialExecutionParameter() { } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PagedResourceSku.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PagedResourceSku.Serialization.cs new file mode 100644 index 000000000000..5a74178fa213 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PagedResourceSku.Serialization.cs @@ -0,0 +1,151 @@ +// 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.Avs.Models +{ + internal partial class PagedResourceSku : 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(PagedResourceSku)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + 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 + } + } + } + + PagedResourceSku 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(PagedResourceSku)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePagedResourceSku(document.RootElement, options); + } + + internal static PagedResourceSku DeserializePagedResourceSku(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceSku.DeserializeResourceSku(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PagedResourceSku(value, nextLink, 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); + default: + throw new FormatException($"The model {nameof(PagedResourceSku)} does not support writing '{options.Format}' format."); + } + } + + PagedResourceSku 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 DeserializePagedResourceSku(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PagedResourceSku)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PagedResourceSku.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PagedResourceSku.cs new file mode 100644 index 000000000000..3aa3609a191f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PagedResourceSku.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Paged collection of ResourceSku items. + internal partial class PagedResourceSku + { + /// + /// 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 ResourceSku items on this page. + /// is null. + internal PagedResourceSku(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ResourceSku items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal PagedResourceSku(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PagedResourceSku() + { + } + + /// The ResourceSku items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ParameterOptionalityStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ParameterOptionalityStatus.cs deleted file mode 100644 index 5810e19eae79..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ParameterOptionalityStatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Optional Param. - public readonly partial struct ParameterOptionalityStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ParameterOptionalityStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string OptionalValue = "Optional"; - private const string RequiredValue = "Required"; - - /// is optional. - public static ParameterOptionalityStatus Optional { get; } = new ParameterOptionalityStatus(OptionalValue); - /// is required. - public static ParameterOptionalityStatus Required { get; } = new ParameterOptionalityStatus(RequiredValue); - /// Determines if two values are the same. - public static bool operator ==(ParameterOptionalityStatus left, ParameterOptionalityStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ParameterOptionalityStatus left, ParameterOptionalityStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ParameterOptionalityStatus(string value) => new ParameterOptionalityStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ParameterOptionalityStatus other && Equals(other); - /// - public bool Equals(ParameterOptionalityStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ParameterVisibilityStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ParameterVisibilityStatus.cs deleted file mode 100644 index 32b3d09856a6..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ParameterVisibilityStatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Visibility Parameter. - public readonly partial struct ParameterVisibilityStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ParameterVisibilityStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string VisibleValue = "Visible"; - private const string HiddenValue = "Hidden"; - - /// is visible. - public static ParameterVisibilityStatus Visible { get; } = new ParameterVisibilityStatus(VisibleValue); - /// is hidden. - public static ParameterVisibilityStatus Hidden { get; } = new ParameterVisibilityStatus(HiddenValue); - /// Determines if two values are the same. - public static bool operator ==(ParameterVisibilityStatus left, ParameterVisibilityStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ParameterVisibilityStatus left, ParameterVisibilityStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ParameterVisibilityStatus(string value) => new ParameterVisibilityStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ParameterVisibilityStatus other && Equals(other); - /// - public bool Equals(ParameterVisibilityStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.Serialization.cs index 4c7cf09dd0ad..996584b16337 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.Serialization.cs @@ -47,11 +47,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteStartArray(); foreach (var item in VmMembers) { - if (item == null) - { - writer.WriteNullValue(); - continue; - } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -115,9 +110,9 @@ internal static PlacementPolicyPatch DeserializePlacementPolicyPatch(JsonElement return null; } PlacementPolicyState? state = default; - IList vmMembers = default; + IList vmMembers = default; IList hostMembers = default; - VmHostPlacementPolicyAffinityStrength? affinityStrength = default; + AffinityStrength? affinityStrength = default; AzureHybridBenefitType? azureHybridBenefitType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -147,17 +142,10 @@ internal static PlacementPolicyPatch DeserializePlacementPolicyPatch(JsonElement { continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(new ResourceIdentifier(item.GetString())); - } + array.Add(item.GetString()); } vmMembers = array; continue; @@ -182,7 +170,7 @@ internal static PlacementPolicyPatch DeserializePlacementPolicyPatch(JsonElement { continue; } - affinityStrength = new VmHostPlacementPolicyAffinityStrength(property0.Value.GetString()); + affinityStrength = new AffinityStrength(property0.Value.GetString()); continue; } if (property0.NameEquals("azureHybridBenefitType"u8)) @@ -205,7 +193,7 @@ internal static PlacementPolicyPatch DeserializePlacementPolicyPatch(JsonElement serializedAdditionalRawData = rawDataDictionary; return new PlacementPolicyPatch( state, - vmMembers ?? new ChangeTrackingList(), + vmMembers ?? new ChangeTrackingList(), hostMembers ?? new ChangeTrackingList(), affinityStrength, azureHybridBenefitType, diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.cs index 9845898b43d3..6b3ac9967bba 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyPatch.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.Avs.Models { @@ -49,7 +48,7 @@ public partial class PlacementPolicyPatch /// Initializes a new instance of . public PlacementPolicyPatch() { - VmMembers = new ChangeTrackingList(); + VmMembers = new ChangeTrackingList(); HostMembers = new ChangeTrackingList(); } @@ -60,7 +59,7 @@ public PlacementPolicyPatch() /// vm-host placement policy affinity strength (should/must). /// placement policy azure hybrid benefit opt-in type. /// Keeps track of any properties unknown to the library. - internal PlacementPolicyPatch(PlacementPolicyState? state, IList vmMembers, IList hostMembers, VmHostPlacementPolicyAffinityStrength? affinityStrength, AzureHybridBenefitType? azureHybridBenefitType, IDictionary serializedAdditionalRawData) + internal PlacementPolicyPatch(PlacementPolicyState? state, IList vmMembers, IList hostMembers, AffinityStrength? affinityStrength, AzureHybridBenefitType? azureHybridBenefitType, IDictionary serializedAdditionalRawData) { State = state; VmMembers = vmMembers; @@ -73,11 +72,11 @@ internal PlacementPolicyPatch(PlacementPolicyState? state, IList Whether the placement policy is enabled or disabled. public PlacementPolicyState? State { get; set; } /// Virtual machine members list. - public IList VmMembers { get; } + public IList VmMembers { get; } /// Host members list. public IList HostMembers { get; } /// vm-host placement policy affinity strength (should/must). - public VmHostPlacementPolicyAffinityStrength? AffinityStrength { get; set; } + public AffinityStrength? AffinityStrength { get; set; } /// placement policy azure hybrid benefit opt-in type. public AzureHybridBenefitType? AzureHybridBenefitType { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs index c1f2e494f548..7a705958bba6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs @@ -35,7 +35,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("type"u8); - writer.WriteStringValue(PolicyType.ToString()); + writer.WriteStringValue(Type.ToString()); if (Optional.IsDefined(State)) { writer.WritePropertyName("state"u8); @@ -93,7 +93,7 @@ internal static PlacementPolicyProperties DeserializePlacementPolicyProperties(J switch (discriminator.GetString()) { case "VmHost": return VmHostPlacementPolicyProperties.DeserializeVmHostPlacementPolicyProperties(element, options); - case "VmVm": return VmPlacementPolicyProperties.DeserializeVmPlacementPolicyProperties(element, options); + case "VmVm": return VmVmPlacementPolicyProperties.DeserializeVmVmPlacementPolicyProperties(element, options); } } return UnknownPlacementPolicyProperties.DeserializeUnknownPlacementPolicyProperties(element, options); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs index be1d25693e24..c32e6db19f6b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Avs.Models /// /// Abstract placement policy properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include and . /// public abstract partial class PlacementPolicyProperties { @@ -55,14 +55,14 @@ protected PlacementPolicyProperties() } /// Initializes a new instance of . - /// Placement Policy type. + /// Placement Policy type. /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. /// The provisioning state. /// Keeps track of any properties unknown to the library. - internal PlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + internal PlacementPolicyProperties(PlacementPolicyType type, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) { - PolicyType = policyType; + Type = type; State = state; DisplayName = displayName; ProvisioningState = provisioningState; @@ -70,7 +70,7 @@ internal PlacementPolicyProperties(PlacementPolicyType policyType, PlacementPoli } /// Placement Policy type. - internal PlacementPolicyType PolicyType { get; set; } + internal PlacementPolicyType Type { get; set; } /// Whether the placement policy is enabled or disabled. public PlacementPolicyState? State { get; set; } /// Display name of the placement policy. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs new file mode 100644 index 000000000000..36a85415402a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Port Mirroring Direction. + public readonly partial struct PortMirroringDirectionEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PortMirroringDirectionEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string INGRESSValue = "INGRESS"; + private const string EGRESSValue = "EGRESS"; + private const string BIDIRECTIONALValue = "BIDIRECTIONAL"; + + /// is ingress. + public static PortMirroringDirectionEnum INGRESS { get; } = new PortMirroringDirectionEnum(INGRESSValue); + /// is egress. + public static PortMirroringDirectionEnum EGRESS { get; } = new PortMirroringDirectionEnum(EGRESSValue); + /// is bidirectional. + public static PortMirroringDirectionEnum BIDIRECTIONAL { get; } = new PortMirroringDirectionEnum(BIDIRECTIONALValue); + /// Determines if two values are the same. + public static bool operator ==(PortMirroringDirectionEnum left, PortMirroringDirectionEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PortMirroringDirectionEnum left, PortMirroringDirectionEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PortMirroringDirectionEnum(string value) => new PortMirroringDirectionEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PortMirroringDirectionEnum other && Equals(other); + /// + public bool Equals(PortMirroringDirectionEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringProfileDirection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringProfileDirection.cs deleted file mode 100644 index 0826bcf69630..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringProfileDirection.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Port Mirroring Direction. - public readonly partial struct PortMirroringProfileDirection : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public PortMirroringProfileDirection(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string IngressValue = "INGRESS"; - private const string EgressValue = "EGRESS"; - private const string BidirectionalValue = "BIDIRECTIONAL"; - - /// is ingress. - public static PortMirroringProfileDirection Ingress { get; } = new PortMirroringProfileDirection(IngressValue); - /// is egress. - public static PortMirroringProfileDirection Egress { get; } = new PortMirroringProfileDirection(EgressValue); - /// is bidirectional. - public static PortMirroringProfileDirection Bidirectional { get; } = new PortMirroringProfileDirection(BidirectionalValue); - /// Determines if two values are the same. - public static bool operator ==(PortMirroringProfileDirection left, PortMirroringProfileDirection right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PortMirroringProfileDirection left, PortMirroringProfileDirection right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator PortMirroringProfileDirection(string value) => new PortMirroringProfileDirection(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PortMirroringProfileDirection other && Equals(other); - /// - public bool Equals(PortMirroringProfileDirection other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringProfileStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringStatusEnum.cs similarity index 51% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringProfileStatus.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringStatusEnum.cs index 9eaadcc38658..07628ed6f55a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringProfileStatus.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringStatusEnum.cs @@ -11,36 +11,36 @@ namespace Azure.ResourceManager.Avs.Models { /// Port Mirroring status. - public readonly partial struct PortMirroringProfileStatus : IEquatable + public readonly partial struct PortMirroringStatusEnum : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public PortMirroringProfileStatus(string value) + public PortMirroringStatusEnum(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string SuccessValue = "SUCCESS"; - private const string FailureValue = "FAILURE"; + private const string SUCCESSValue = "SUCCESS"; + private const string FAILUREValue = "FAILURE"; /// is success. - public static PortMirroringProfileStatus Success { get; } = new PortMirroringProfileStatus(SuccessValue); + public static PortMirroringStatusEnum SUCCESS { get; } = new PortMirroringStatusEnum(SUCCESSValue); /// is failure. - public static PortMirroringProfileStatus Failure { get; } = new PortMirroringProfileStatus(FailureValue); - /// Determines if two values are the same. - public static bool operator ==(PortMirroringProfileStatus left, PortMirroringProfileStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PortMirroringProfileStatus left, PortMirroringProfileStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator PortMirroringProfileStatus(string value) => new PortMirroringProfileStatus(value); + public static PortMirroringStatusEnum FAILURE { get; } = new PortMirroringStatusEnum(FAILUREValue); + /// Determines if two values are the same. + public static bool operator ==(PortMirroringStatusEnum left, PortMirroringStatusEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PortMirroringStatusEnum left, PortMirroringStatusEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PortMirroringStatusEnum(string value) => new PortMirroringStatusEnum(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PortMirroringProfileStatus other && Equals(other); + public override bool Equals(object obj) => obj is PortMirroringStatusEnum other && Equals(other); /// - public bool Equals(PortMirroringProfileStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(PortMirroringStatusEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs index 50b2e31f67aa..fe85ce47bde8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs @@ -83,7 +83,7 @@ internal static PrivateCloudList DeserializePrivateCloudList(JsonElement element { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static PrivateCloudList DeserializePrivateCloudList(JsonElement element { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(AvsPrivateCloudData.DeserializeAvsPrivateCloudData(item, options)); + array.Add(PrivateCloudData.DeserializePrivateCloudData(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs index c57e5ef3f522..362b7db1ef82 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs @@ -49,7 +49,7 @@ internal partial class PrivateCloudList /// Initializes a new instance of . /// The PrivateCloud items on this page. /// is null. - internal PrivateCloudList(IEnumerable value) + internal PrivateCloudList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal PrivateCloudList(IEnumerable value) /// The PrivateCloud items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal PrivateCloudList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal PrivateCloudList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal PrivateCloudList() } /// The PrivateCloud items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudPatch.Serialization.cs similarity index 77% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudPatch.Serialization.cs index af1a94eac7f1..cfbb206fe75e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudPatch.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class AvsPrivateCloudPatch : IUtf8JsonSerializable, IJsonModel + public partial class PrivateCloudPatch : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -29,10 +29,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudPatch)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(PrivateCloudPatch)} does not support writing '{format}' format."); } if (Optional.IsCollectionDefined(Tags)) @@ -121,19 +121,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AvsPrivateCloudPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PrivateCloudPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudPatch)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(PrivateCloudPatch)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudPatch(document.RootElement, options); + return DeserializePrivateCloudPatch(document.RootElement, options); } - internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement element, ModelReaderWriterOptions options = null) + internal static PrivateCloudPatch DeserializePrivateCloudPatch(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -144,13 +144,13 @@ internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement IDictionary tags = default; AvsSku sku = default; ManagedServiceIdentity identity = default; - AvsManagementCluster managementCluster = default; - InternetConnectivityState? internet = default; - IList identitySources = default; - PrivateCloudAvailabilityProperties availability = default; - CustomerManagedEncryption encryption = default; + ManagementCluster managementCluster = default; + InternetEnum? internet = default; + IList identitySources = default; + AvailabilityProperties availability = default; + Encryption encryption = default; IList extendedNetworkBlocks = default; - AvsDnsZoneType? dnsZoneType = default; + DnsZoneType? dnsZoneType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -202,7 +202,7 @@ internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement { continue; } - managementCluster = AvsManagementCluster.DeserializeAvsManagementCluster(property0.Value, options); + managementCluster = ManagementCluster.DeserializeManagementCluster(property0.Value, options); continue; } if (property0.NameEquals("internet"u8)) @@ -211,7 +211,7 @@ internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement { continue; } - internet = new InternetConnectivityState(property0.Value.GetString()); + internet = new InternetEnum(property0.Value.GetString()); continue; } if (property0.NameEquals("identitySources"u8)) @@ -220,10 +220,10 @@ internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement { continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SingleSignOnIdentitySource.DeserializeSingleSignOnIdentitySource(item, options)); + array.Add(IdentitySource.DeserializeIdentitySource(item, options)); } identitySources = array; continue; @@ -234,7 +234,7 @@ internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement { continue; } - availability = PrivateCloudAvailabilityProperties.DeserializePrivateCloudAvailabilityProperties(property0.Value, options); + availability = AvailabilityProperties.DeserializeAvailabilityProperties(property0.Value, options); continue; } if (property0.NameEquals("encryption"u8)) @@ -243,7 +243,7 @@ internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement { continue; } - encryption = CustomerManagedEncryption.DeserializeCustomerManagedEncryption(property0.Value, options); + encryption = Encryption.DeserializeEncryption(property0.Value, options); continue; } if (property0.NameEquals("extendedNetworkBlocks"u8)) @@ -266,7 +266,7 @@ internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement { continue; } - dnsZoneType = new AvsDnsZoneType(property0.Value.GetString()); + dnsZoneType = new DnsZoneType(property0.Value.GetString()); continue; } } @@ -278,13 +278,13 @@ internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudPatch( + return new PrivateCloudPatch( tags ?? new ChangeTrackingDictionary(), sku, identity, managementCluster, internet, - identitySources ?? new ChangeTrackingList(), + identitySources ?? new ChangeTrackingList(), availability, encryption, extendedNetworkBlocks ?? new ChangeTrackingList(), @@ -292,35 +292,35 @@ internal static AvsPrivateCloudPatch DeserializeAvsPrivateCloudPatch(JsonElement serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsPrivateCloudPatch)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(PrivateCloudPatch)} does not support writing '{options.Format}' format."); } } - AvsPrivateCloudPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PrivateCloudPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsPrivateCloudPatch(document.RootElement, options); + return DeserializePrivateCloudPatch(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsPrivateCloudPatch)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(PrivateCloudPatch)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudPatch.cs similarity index 80% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudPatch.cs index 8dedef6365bd..2088a97c0ad2 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudPatch.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudPatch.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Avs.Models { /// An update to a private cloud resource. - public partial class AvsPrivateCloudPatch + public partial class PrivateCloudPatch { /// /// Keeps track of any properties unknown to the library. @@ -46,15 +46,15 @@ public partial class AvsPrivateCloudPatch /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public AvsPrivateCloudPatch() + /// Initializes a new instance of . + public PrivateCloudPatch() { Tags = new ChangeTrackingDictionary(); - IdentitySources = new ChangeTrackingList(); + IdentitySources = new ChangeTrackingList(); ExtendedNetworkBlocks = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Resource tags. /// The SKU (Stock Keeping Unit) assigned to this resource. /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. @@ -71,7 +71,7 @@ public AvsPrivateCloudPatch() /// /// The type of DNS zone to use. /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudPatch(IDictionary tags, AvsSku sku, ManagedServiceIdentity identity, AvsManagementCluster managementCluster, InternetConnectivityState? internet, IList identitySources, PrivateCloudAvailabilityProperties availability, CustomerManagedEncryption encryption, IList extendedNetworkBlocks, AvsDnsZoneType? dnsZoneType, IDictionary serializedAdditionalRawData) + internal PrivateCloudPatch(IDictionary tags, AvsSku sku, ManagedServiceIdentity identity, ManagementCluster managementCluster, InternetEnum? internet, IList identitySources, AvailabilityProperties availability, Encryption encryption, IList extendedNetworkBlocks, DnsZoneType? dnsZoneType, IDictionary serializedAdditionalRawData) { Tags = tags; Sku = sku; @@ -93,15 +93,15 @@ internal AvsPrivateCloudPatch(IDictionary tags, AvsSku sku, Mana /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. public ManagedServiceIdentity Identity { get; set; } /// The default cluster used for management. - public AvsManagementCluster ManagementCluster { get; set; } + public ManagementCluster ManagementCluster { get; set; } /// Connectivity to internet is enabled or disabled. - public InternetConnectivityState? Internet { get; set; } + public InternetEnum? Internet { get; set; } /// vCenter Single Sign On Identity Sources. - public IList IdentitySources { get; } + public IList IdentitySources { get; } /// Properties describing how the cloud is distributed across availability zones. - public PrivateCloudAvailabilityProperties Availability { get; set; } + public AvailabilityProperties Availability { get; set; } /// Customer managed key encryption, can be enabled or disabled. - public CustomerManagedEncryption Encryption { get; set; } + public Encryption Encryption { get; set; } /// /// Array of additional networks noncontiguous with networkBlock. Networks must be /// unique and non-overlapping across VNet in your subscription, on-premise, and @@ -110,6 +110,6 @@ internal AvsPrivateCloudPatch(IDictionary tags, AvsSku sku, Mana /// public IList ExtendedNetworkBlocks { get; } /// The type of DNS zone to use. - public AvsDnsZoneType? DnsZoneType { get; set; } + public DnsZoneType? DnsZoneType { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.Serialization.cs new file mode 100644 index 000000000000..47c9db553328 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.Serialization.cs @@ -0,0 +1,459 @@ +// 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.Avs.Models +{ + public partial class PrivateCloudProperties : 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(PrivateCloudProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("managementCluster"u8); + writer.WriteObjectValue(ManagementCluster, options); + if (Optional.IsDefined(Internet)) + { + writer.WritePropertyName("internet"u8); + writer.WriteStringValue(Internet.Value.ToString()); + } + if (Optional.IsCollectionDefined(IdentitySources)) + { + writer.WritePropertyName("identitySources"u8); + writer.WriteStartArray(); + foreach (var item in IdentitySources) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Availability)) + { + writer.WritePropertyName("availability"u8); + writer.WriteObjectValue(Availability, options); + } + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"u8); + writer.WriteObjectValue(Encryption, options); + } + if (Optional.IsCollectionDefined(ExtendedNetworkBlocks)) + { + writer.WritePropertyName("extendedNetworkBlocks"u8); + writer.WriteStartArray(); + foreach (var item in ExtendedNetworkBlocks) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Circuit)) + { + writer.WritePropertyName("circuit"u8); + writer.WriteObjectValue(Circuit, options); + } + if (options.Format != "W" && Optional.IsDefined(Endpoints)) + { + writer.WritePropertyName("endpoints"u8); + writer.WriteObjectValue(Endpoints, options); + } + writer.WritePropertyName("networkBlock"u8); + writer.WriteStringValue(NetworkBlock); + if (options.Format != "W" && Optional.IsDefined(ManagementNetwork)) + { + writer.WritePropertyName("managementNetwork"u8); + writer.WriteStringValue(ManagementNetwork); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningNetwork)) + { + writer.WritePropertyName("provisioningNetwork"u8); + writer.WriteStringValue(ProvisioningNetwork); + } + if (options.Format != "W" && Optional.IsDefined(VmotionNetwork)) + { + writer.WritePropertyName("vmotionNetwork"u8); + writer.WriteStringValue(VmotionNetwork); + } + if (Optional.IsDefined(VcenterPassword)) + { + writer.WritePropertyName("vcenterPassword"u8); + writer.WriteStringValue(VcenterPassword); + } + if (Optional.IsDefined(NsxtPassword)) + { + writer.WritePropertyName("nsxtPassword"u8); + writer.WriteStringValue(NsxtPassword); + } + if (options.Format != "W" && Optional.IsDefined(VcenterCertificateThumbprint)) + { + writer.WritePropertyName("vcenterCertificateThumbprint"u8); + writer.WriteStringValue(VcenterCertificateThumbprint); + } + if (options.Format != "W" && Optional.IsDefined(NsxtCertificateThumbprint)) + { + writer.WritePropertyName("nsxtCertificateThumbprint"u8); + writer.WriteStringValue(NsxtCertificateThumbprint); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ExternalCloudLinks)) + { + writer.WritePropertyName("externalCloudLinks"u8); + writer.WriteStartArray(); + foreach (var item in ExternalCloudLinks) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SecondaryCircuit)) + { + writer.WritePropertyName("secondaryCircuit"u8); + writer.WriteObjectValue(SecondaryCircuit, options); + } + if (options.Format != "W" && Optional.IsDefined(NsxPublicIPQuotaRaised)) + { + writer.WritePropertyName("nsxPublicIpQuotaRaised"u8); + writer.WriteStringValue(NsxPublicIPQuotaRaised.Value.ToString()); + } + if (Optional.IsDefined(VirtualNetworkId)) + { + writer.WritePropertyName("virtualNetworkId"u8); + writer.WriteStringValue(VirtualNetworkId); + } + if (Optional.IsDefined(DnsZoneType)) + { + writer.WritePropertyName("dnsZoneType"u8); + writer.WriteStringValue(DnsZoneType.Value.ToString()); + } + 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 + } + } + } + + PrivateCloudProperties 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(PrivateCloudProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrivateCloudProperties(document.RootElement, options); + } + + internal static PrivateCloudProperties DeserializePrivateCloudProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagementCluster managementCluster = default; + InternetEnum? internet = default; + IList identitySources = default; + AvailabilityProperties availability = default; + Encryption encryption = default; + IList extendedNetworkBlocks = default; + PrivateCloudProvisioningState? provisioningState = default; + Circuit circuit = default; + Endpoints endpoints = default; + string networkBlock = default; + string managementNetwork = default; + string provisioningNetwork = default; + string vmotionNetwork = default; + string vcenterPassword = default; + string nsxtPassword = default; + string vcenterCertificateThumbprint = default; + string nsxtCertificateThumbprint = default; + IReadOnlyList externalCloudLinks = default; + Circuit secondaryCircuit = default; + NsxPublicIPQuotaRaisedEnum? nsxPublicIPQuotaRaised = default; + ResourceIdentifier virtualNetworkId = default; + DnsZoneType? dnsZoneType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("managementCluster"u8)) + { + managementCluster = ManagementCluster.DeserializeManagementCluster(property.Value, options); + continue; + } + if (property.NameEquals("internet"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + internet = new InternetEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("identitySources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IdentitySource.DeserializeIdentitySource(item, options)); + } + identitySources = array; + continue; + } + if (property.NameEquals("availability"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availability = AvailabilityProperties.DeserializeAvailabilityProperties(property.Value, options); + continue; + } + if (property.NameEquals("encryption"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = Encryption.DeserializeEncryption(property.Value, options); + continue; + } + if (property.NameEquals("extendedNetworkBlocks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + extendedNetworkBlocks = array; + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new PrivateCloudProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("circuit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + circuit = Circuit.DeserializeCircuit(property.Value, options); + continue; + } + if (property.NameEquals("endpoints"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endpoints = Endpoints.DeserializeEndpoints(property.Value, options); + continue; + } + if (property.NameEquals("networkBlock"u8)) + { + networkBlock = property.Value.GetString(); + continue; + } + if (property.NameEquals("managementNetwork"u8)) + { + managementNetwork = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningNetwork"u8)) + { + provisioningNetwork = property.Value.GetString(); + continue; + } + if (property.NameEquals("vmotionNetwork"u8)) + { + vmotionNetwork = property.Value.GetString(); + continue; + } + if (property.NameEquals("vcenterPassword"u8)) + { + vcenterPassword = property.Value.GetString(); + continue; + } + if (property.NameEquals("nsxtPassword"u8)) + { + nsxtPassword = property.Value.GetString(); + continue; + } + if (property.NameEquals("vcenterCertificateThumbprint"u8)) + { + vcenterCertificateThumbprint = property.Value.GetString(); + continue; + } + if (property.NameEquals("nsxtCertificateThumbprint"u8)) + { + nsxtCertificateThumbprint = property.Value.GetString(); + continue; + } + if (property.NameEquals("externalCloudLinks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + externalCloudLinks = array; + continue; + } + if (property.NameEquals("secondaryCircuit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + secondaryCircuit = Circuit.DeserializeCircuit(property.Value, options); + continue; + } + if (property.NameEquals("nsxPublicIpQuotaRaised"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nsxPublicIPQuotaRaised = new NsxPublicIPQuotaRaisedEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("virtualNetworkId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualNetworkId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("dnsZoneType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsZoneType = new DnsZoneType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PrivateCloudProperties( + managementCluster, + internet, + identitySources ?? new ChangeTrackingList(), + availability, + encryption, + extendedNetworkBlocks ?? new ChangeTrackingList(), + provisioningState, + circuit, + endpoints, + networkBlock, + managementNetwork, + provisioningNetwork, + vmotionNetwork, + vcenterPassword, + nsxtPassword, + vcenterCertificateThumbprint, + nsxtCertificateThumbprint, + externalCloudLinks ?? new ChangeTrackingList(), + secondaryCircuit, + nsxPublicIPQuotaRaised, + virtualNetworkId, + dnsZoneType, + 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); + default: + throw new FormatException($"The model {nameof(PrivateCloudProperties)} does not support writing '{options.Format}' format."); + } + } + + PrivateCloudProperties 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 DeserializePrivateCloudProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrivateCloudProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.cs similarity index 65% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.cs index 5c2167c33be7..c2e6a446a9f7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.cs @@ -8,16 +8,11 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the AvsPrivateCloud data model. - /// A private cloud resource - /// - public partial class AvsPrivateCloudData : TrackedResourceData + /// The properties of a private cloud resource. + public partial class PrivateCloudProperties { /// /// Keeps track of any properties unknown to the library. @@ -51,29 +46,27 @@ public partial class AvsPrivateCloudData : TrackedResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// The location. - /// The SKU (Stock Keeping Unit) assigned to this resource. - /// is null. - public AvsPrivateCloudData(AzureLocation location, AvsSku sku) : base(location) + /// Initializes a new instance of . + /// The default cluster used for management. + /// + /// The block of addresses should be unique across VNet in your subscription as + /// well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where + /// A,B,C,D are between 0 and 255, and X is between 0 and 22 + /// + /// or is null. + public PrivateCloudProperties(ManagementCluster managementCluster, string networkBlock) { - Argument.AssertNotNull(sku, nameof(sku)); + Argument.AssertNotNull(managementCluster, nameof(managementCluster)); + Argument.AssertNotNull(networkBlock, nameof(networkBlock)); - Sku = sku; - IdentitySources = new ChangeTrackingList(); + ManagementCluster = managementCluster; + IdentitySources = new ChangeTrackingList(); ExtendedNetworkBlocks = new ChangeTrackingList(); - ExternalCloudLinks = new ChangeTrackingList(); + NetworkBlock = networkBlock; + ExternalCloudLinks = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The SKU (Stock Keeping Unit) assigned to this resource. - /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. + /// Initializes a new instance of . /// The default cluster used for management. /// Connectivity to internet is enabled or disabled. /// vCenter Single Sign On Identity Sources. @@ -95,10 +88,10 @@ public AvsPrivateCloudData(AzureLocation location, AvsSku sku) : base(location) /// /// Network used to access vCenter Server and NSX-T Manager. /// Used for virtual machine cold migration, cloning, and snapshot migration. - /// Used for live migration of virtual machines. - /// Optionally, set the vCenter admin password when the private cloud is created. + /// Used for live migration of virtual machines. + /// Optionally, set the vCenter admin password when the private cloud is created. /// Optionally, set the NSX-T Manager password when the private cloud is created. - /// Thumbprint of the vCenter Server SSL certificate. + /// Thumbprint of the vCenter Server SSL certificate. /// Thumbprint of the NSX-T Manager SSL certificate. /// Array of cloud link IDs from other clouds that connect to this one. /// @@ -112,10 +105,8 @@ public AvsPrivateCloudData(AzureLocation location, AvsSku sku) : base(location) /// Azure resource ID of the virtual network. /// The type of DNS zone to use. /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AvsSku sku, ManagedServiceIdentity identity, AvsManagementCluster managementCluster, InternetConnectivityState? internet, IList identitySources, PrivateCloudAvailabilityProperties availability, CustomerManagedEncryption encryption, IList extendedNetworkBlocks, AvsPrivateCloudProvisioningState? provisioningState, ExpressRouteCircuit circuit, AvsPrivateCloudEndpoints endpoints, string networkBlock, string managementNetwork, string provisioningNetwork, string vMotionNetwork, string vCenterPassword, string nsxtPassword, string vCenterCertificateThumbprint, string nsxtCertificateThumbprint, IReadOnlyList externalCloudLinks, ExpressRouteCircuit secondaryCircuit, NsxPublicIPQuotaRaisedEnum? nsxPublicIPQuotaRaised, ResourceIdentifier virtualNetworkId, AvsDnsZoneType? dnsZoneType, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal PrivateCloudProperties(ManagementCluster managementCluster, InternetEnum? internet, IList identitySources, AvailabilityProperties availability, Encryption encryption, IList extendedNetworkBlocks, PrivateCloudProvisioningState? provisioningState, Circuit circuit, Endpoints endpoints, string networkBlock, string managementNetwork, string provisioningNetwork, string vmotionNetwork, string vcenterPassword, string nsxtPassword, string vcenterCertificateThumbprint, string nsxtCertificateThumbprint, IReadOnlyList externalCloudLinks, Circuit secondaryCircuit, NsxPublicIPQuotaRaisedEnum? nsxPublicIPQuotaRaised, ResourceIdentifier virtualNetworkId, DnsZoneType? dnsZoneType, IDictionary serializedAdditionalRawData) { - Sku = sku; - Identity = identity; ManagementCluster = managementCluster; Internet = internet; IdentitySources = identitySources; @@ -128,10 +119,10 @@ internal AvsPrivateCloudData(ResourceIdentifier id, string name, ResourceType re NetworkBlock = networkBlock; ManagementNetwork = managementNetwork; ProvisioningNetwork = provisioningNetwork; - VMotionNetwork = vMotionNetwork; - VCenterPassword = vCenterPassword; + VmotionNetwork = vmotionNetwork; + VcenterPassword = vcenterPassword; NsxtPassword = nsxtPassword; - VCenterCertificateThumbprint = vCenterCertificateThumbprint; + VcenterCertificateThumbprint = vcenterCertificateThumbprint; NsxtCertificateThumbprint = nsxtCertificateThumbprint; ExternalCloudLinks = externalCloudLinks; SecondaryCircuit = secondaryCircuit; @@ -141,25 +132,21 @@ internal AvsPrivateCloudData(ResourceIdentifier id, string name, ResourceType re _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal AvsPrivateCloudData() + /// Initializes a new instance of for deserialization. + internal PrivateCloudProperties() { } - /// The SKU (Stock Keeping Unit) assigned to this resource. - public AvsSku Sku { get; set; } - /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. - public ManagedServiceIdentity Identity { get; set; } /// The default cluster used for management. - public AvsManagementCluster ManagementCluster { get; set; } + public ManagementCluster ManagementCluster { get; set; } /// Connectivity to internet is enabled or disabled. - public InternetConnectivityState? Internet { get; set; } + public InternetEnum? Internet { get; set; } /// vCenter Single Sign On Identity Sources. - public IList IdentitySources { get; } + public IList IdentitySources { get; } /// Properties describing how the cloud is distributed across availability zones. - public PrivateCloudAvailabilityProperties Availability { get; set; } + public AvailabilityProperties Availability { get; set; } /// Customer managed key encryption, can be enabled or disabled. - public CustomerManagedEncryption Encryption { get; set; } + public Encryption Encryption { get; set; } /// /// Array of additional networks noncontiguous with networkBlock. Networks must be /// unique and non-overlapping across VNet in your subscription, on-premise, and @@ -168,11 +155,11 @@ internal AvsPrivateCloudData() /// public IList ExtendedNetworkBlocks { get; } /// The provisioning state. - public AvsPrivateCloudProvisioningState? ProvisioningState { get; } + public PrivateCloudProvisioningState? ProvisioningState { get; } /// An ExpressRoute Circuit. - public ExpressRouteCircuit Circuit { get; set; } + public Circuit Circuit { get; set; } /// The endpoints. - public AvsPrivateCloudEndpoints Endpoints { get; } + public Endpoints Endpoints { get; } /// /// The block of addresses should be unique across VNet in your subscription as /// well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where @@ -184,22 +171,22 @@ internal AvsPrivateCloudData() /// Used for virtual machine cold migration, cloning, and snapshot migration. public string ProvisioningNetwork { get; } /// Used for live migration of virtual machines. - public string VMotionNetwork { get; } + public string VmotionNetwork { get; } /// Optionally, set the vCenter admin password when the private cloud is created. - public string VCenterPassword { get; set; } + public string VcenterPassword { get; set; } /// Optionally, set the NSX-T Manager password when the private cloud is created. public string NsxtPassword { get; set; } /// Thumbprint of the vCenter Server SSL certificate. - public string VCenterCertificateThumbprint { get; } + public string VcenterCertificateThumbprint { get; } /// Thumbprint of the NSX-T Manager SSL certificate. public string NsxtCertificateThumbprint { get; } /// Array of cloud link IDs from other clouds that connect to this one. - public IReadOnlyList ExternalCloudLinks { get; } + public IReadOnlyList ExternalCloudLinks { get; } /// /// A secondary expressRoute circuit from a separate AZ. Only present in a /// stretched private cloud /// - public ExpressRouteCircuit SecondaryCircuit { get; set; } + public Circuit SecondaryCircuit { get; set; } /// /// Flag to indicate whether the private cloud has the quota for provisioned NSX /// Public IP count raised from 64 to 1024 @@ -208,6 +195,6 @@ internal AvsPrivateCloudData() /// Azure resource ID of the virtual network. public ResourceIdentifier VirtualNetworkId { get; set; } /// The type of DNS zone to use. - public AvsDnsZoneType? DnsZoneType { get; set; } + public DnsZoneType? DnsZoneType { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProvisioningState.cs new file mode 100644 index 000000000000..36f36cd9bbff --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProvisioningState.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// private cloud provisioning state. + public readonly partial struct PrivateCloudProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PrivateCloudProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string CancelledValue = "Cancelled"; + private const string PendingValue = "Pending"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Resource has been created. + public static PrivateCloudProvisioningState Succeeded { get; } = new PrivateCloudProvisioningState(SucceededValue); + /// Resource creation failed. + public static PrivateCloudProvisioningState Failed { get; } = new PrivateCloudProvisioningState(FailedValue); + /// Resource creation was canceled. + public static PrivateCloudProvisioningState Canceled { get; } = new PrivateCloudProvisioningState(CanceledValue); + /// is cancelled. + public static PrivateCloudProvisioningState Cancelled { get; } = new PrivateCloudProvisioningState(CancelledValue); + /// is pending. + public static PrivateCloudProvisioningState Pending { get; } = new PrivateCloudProvisioningState(PendingValue); + /// is building. + public static PrivateCloudProvisioningState Building { get; } = new PrivateCloudProvisioningState(BuildingValue); + /// is deleting. + public static PrivateCloudProvisioningState Deleting { get; } = new PrivateCloudProvisioningState(DeletingValue); + /// is updating. + public static PrivateCloudProvisioningState Updating { get; } = new PrivateCloudProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(PrivateCloudProvisioningState left, PrivateCloudProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PrivateCloudProvisioningState left, PrivateCloudProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PrivateCloudProvisioningState(string value) => new PrivateCloudProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PrivateCloudProvisioningState other && Equals(other); + /// + public bool Equals(PrivateCloudProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkListResult.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkListResult.Serialization.cs new file mode 100644 index 000000000000..31af8f5a2602 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkListResult.Serialization.cs @@ -0,0 +1,151 @@ +// 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.Avs.Models +{ + internal partial class ProvisionedNetworkListResult : 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(ProvisionedNetworkListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + 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 + } + } + } + + ProvisionedNetworkListResult 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(ProvisionedNetworkListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProvisionedNetworkListResult(document.RootElement, options); + } + + internal static ProvisionedNetworkListResult DeserializeProvisionedNetworkListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProvisionedNetworkData.DeserializeProvisionedNetworkData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProvisionedNetworkListResult(value, nextLink, 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); + default: + throw new FormatException($"The model {nameof(ProvisionedNetworkListResult)} does not support writing '{options.Format}' format."); + } + } + + ProvisionedNetworkListResult 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 DeserializeProvisionedNetworkListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProvisionedNetworkListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkListResult.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkListResult.cs new file mode 100644 index 000000000000..9c7d1a5df875 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The response of a ProvisionedNetwork list operation. + internal partial class ProvisionedNetworkListResult + { + /// + /// 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 ProvisionedNetwork items on this page. + /// is null. + internal ProvisionedNetworkListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ProvisionedNetwork items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ProvisionedNetworkListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ProvisionedNetworkListResult() + { + } + + /// The ProvisionedNetwork items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkProperties.Serialization.cs new file mode 100644 index 000000000000..bd86316b53de --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkProperties.Serialization.cs @@ -0,0 +1,159 @@ +// 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.Avs.Models +{ + public partial class ProvisionedNetworkProperties : 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(ProvisionedNetworkProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(AddressPrefix)) + { + writer.WritePropertyName("addressPrefix"u8); + writer.WriteStringValue(AddressPrefix); + } + if (options.Format != "W" && Optional.IsDefined(NetworkType)) + { + writer.WritePropertyName("networkType"u8); + writer.WriteStringValue(NetworkType.Value.ToString()); + } + 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 + } + } + } + + ProvisionedNetworkProperties 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(ProvisionedNetworkProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProvisionedNetworkProperties(document.RootElement, options); + } + + internal static ProvisionedNetworkProperties DeserializeProvisionedNetworkProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisionedNetworkProvisioningState? provisioningState = default; + string addressPrefix = default; + ProvisionedNetworkType? networkType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisionedNetworkProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("addressPrefix"u8)) + { + addressPrefix = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkType = new ProvisionedNetworkType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProvisionedNetworkProperties(provisioningState, addressPrefix, networkType, 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); + default: + throw new FormatException($"The model {nameof(ProvisionedNetworkProperties)} does not support writing '{options.Format}' format."); + } + } + + ProvisionedNetworkProperties 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 DeserializeProvisionedNetworkProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProvisionedNetworkProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkProperties.cs new file mode 100644 index 000000000000..d27d4de955fd --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a provisioned network. + public partial class ProvisionedNetworkProperties + { + /// + /// 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 . + internal ProvisionedNetworkProperties() + { + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// The address prefixes of the provisioned network in CIDR notation. + /// The type of network provisioned. + /// Keeps track of any properties unknown to the library. + internal ProvisionedNetworkProperties(ProvisionedNetworkProvisioningState? provisioningState, string addressPrefix, ProvisionedNetworkType? networkType, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + AddressPrefix = addressPrefix; + NetworkType = networkType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The provisioning state of the resource. + public ProvisionedNetworkProvisioningState? ProvisioningState { get; } + /// The address prefixes of the provisioned network in CIDR notation. + public string AddressPrefix { get; } + /// The type of network provisioned. + public ProvisionedNetworkType? NetworkType { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkProvisioningState.cs new file mode 100644 index 000000000000..94b6cc45f62e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// provisioned network provisioning state. + public readonly partial struct ProvisionedNetworkProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisionedNetworkProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static ProvisionedNetworkProvisioningState Succeeded { get; } = new ProvisionedNetworkProvisioningState(SucceededValue); + /// Resource creation failed. + public static ProvisionedNetworkProvisioningState Failed { get; } = new ProvisionedNetworkProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ProvisionedNetworkProvisioningState Canceled { get; } = new ProvisionedNetworkProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisionedNetworkProvisioningState left, ProvisionedNetworkProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisionedNetworkProvisioningState left, ProvisionedNetworkProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisionedNetworkProvisioningState(string value) => new ProvisionedNetworkProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisionedNetworkProvisioningState other && Equals(other); + /// + public bool Equals(ProvisionedNetworkProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkType.cs new file mode 100644 index 000000000000..f5cf0dcba2b6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ProvisionedNetworkType.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The type of network provisioned. + public readonly partial struct ProvisionedNetworkType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisionedNetworkType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EsxManagementValue = "esxManagement"; + private const string EsxReplicationValue = "esxReplication"; + private const string HcxManagementValue = "hcxManagement"; + private const string HcxUplinkValue = "hcxUplink"; + private const string VcenterManagementValue = "vcenterManagement"; + private const string VmotionValue = "vmotion"; + private const string VsanValue = "vsan"; + + /// network for ESX management. + public static ProvisionedNetworkType EsxManagement { get; } = new ProvisionedNetworkType(EsxManagementValue); + /// network for ESX replication. + public static ProvisionedNetworkType EsxReplication { get; } = new ProvisionedNetworkType(EsxReplicationValue); + /// network for HCX management. + public static ProvisionedNetworkType HcxManagement { get; } = new ProvisionedNetworkType(HcxManagementValue); + /// network for HCX uplink. + public static ProvisionedNetworkType HcxUplink { get; } = new ProvisionedNetworkType(HcxUplinkValue); + /// network for vCenter management. + public static ProvisionedNetworkType VcenterManagement { get; } = new ProvisionedNetworkType(VcenterManagementValue); + /// network for vmotion. + public static ProvisionedNetworkType Vmotion { get; } = new ProvisionedNetworkType(VmotionValue); + /// network for vsan. + public static ProvisionedNetworkType Vsan { get; } = new ProvisionedNetworkType(VsanValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisionedNetworkType left, ProvisionedNetworkType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisionedNetworkType left, ProvisionedNetworkType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisionedNetworkType(string value) => new ProvisionedNetworkType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisionedNetworkType other && Equals(other); + /// + public bool Equals(ProvisionedNetworkType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyListResult.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyListResult.Serialization.cs new file mode 100644 index 000000000000..678c5292b271 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyListResult.Serialization.cs @@ -0,0 +1,151 @@ +// 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.Avs.Models +{ + internal partial class PureStoragePolicyListResult : 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(PureStoragePolicyListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + 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 + } + } + } + + PureStoragePolicyListResult 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(PureStoragePolicyListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePureStoragePolicyListResult(document.RootElement, options); + } + + internal static PureStoragePolicyListResult DeserializePureStoragePolicyListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PureStoragePolicyData.DeserializePureStoragePolicyData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PureStoragePolicyListResult(value, nextLink, 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); + default: + throw new FormatException($"The model {nameof(PureStoragePolicyListResult)} does not support writing '{options.Format}' format."); + } + } + + PureStoragePolicyListResult 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 DeserializePureStoragePolicyListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PureStoragePolicyListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyListResult.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyListResult.cs new file mode 100644 index 000000000000..7ba1766f928a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The response of a PureStoragePolicy list operation. + internal partial class PureStoragePolicyListResult + { + /// + /// 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 PureStoragePolicy items on this page. + /// is null. + internal PureStoragePolicyListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The PureStoragePolicy items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal PureStoragePolicyListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PureStoragePolicyListResult() + { + } + + /// The PureStoragePolicy items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyProperties.Serialization.cs new file mode 100644 index 000000000000..f2526ba33adb --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyProperties.Serialization.cs @@ -0,0 +1,149 @@ +// 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.Avs.Models +{ + public partial class PureStoragePolicyProperties : 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(PureStoragePolicyProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("storagePolicyDefinition"u8); + writer.WriteStringValue(StoragePolicyDefinition); + writer.WritePropertyName("storagePoolId"u8); + writer.WriteStringValue(StoragePoolId); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + 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 + } + } + } + + PureStoragePolicyProperties 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(PureStoragePolicyProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePureStoragePolicyProperties(document.RootElement, options); + } + + internal static PureStoragePolicyProperties DeserializePureStoragePolicyProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string storagePolicyDefinition = default; + string storagePoolId = default; + PureStoragePolicyProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storagePolicyDefinition"u8)) + { + storagePolicyDefinition = property.Value.GetString(); + continue; + } + if (property.NameEquals("storagePoolId"u8)) + { + storagePoolId = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new PureStoragePolicyProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PureStoragePolicyProperties(storagePolicyDefinition, storagePoolId, provisioningState, 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); + default: + throw new FormatException($"The model {nameof(PureStoragePolicyProperties)} does not support writing '{options.Format}' format."); + } + } + + PureStoragePolicyProperties 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 DeserializePureStoragePolicyProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PureStoragePolicyProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyProperties.cs new file mode 100644 index 000000000000..f4016aa93070 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyProperties.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.Avs.Models +{ + /// Properties of a Pure Storage Policy Based Management policy. + public partial class PureStoragePolicyProperties + { + /// + /// 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 . + /// Definition of a Pure Storage Policy Based Management policy. + /// Azure resource ID of the Pure Storage Pool associated with the storage policy. + /// or is null. + public PureStoragePolicyProperties(string storagePolicyDefinition, string storagePoolId) + { + Argument.AssertNotNull(storagePolicyDefinition, nameof(storagePolicyDefinition)); + Argument.AssertNotNull(storagePoolId, nameof(storagePoolId)); + + StoragePolicyDefinition = storagePolicyDefinition; + StoragePoolId = storagePoolId; + } + + /// Initializes a new instance of . + /// Definition of a Pure Storage Policy Based Management policy. + /// Azure resource ID of the Pure Storage Pool associated with the storage policy. + /// The state of the Pure Storage Policy Based Management policy provisioning. + /// Keeps track of any properties unknown to the library. + internal PureStoragePolicyProperties(string storagePolicyDefinition, string storagePoolId, PureStoragePolicyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + StoragePolicyDefinition = storagePolicyDefinition; + StoragePoolId = storagePoolId; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PureStoragePolicyProperties() + { + } + + /// Definition of a Pure Storage Policy Based Management policy. + public string StoragePolicyDefinition { get; set; } + /// Azure resource ID of the Pure Storage Pool associated with the storage policy. + public string StoragePoolId { get; set; } + /// The state of the Pure Storage Policy Based Management policy provisioning. + public PureStoragePolicyProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyProvisioningState.cs new file mode 100644 index 000000000000..4117a0647d44 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStoragePolicyProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Pure Storage Policy Based Management policy provisioning state. + public readonly partial struct PureStoragePolicyProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PureStoragePolicyProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Resource has been created. + public static PureStoragePolicyProvisioningState Succeeded { get; } = new PureStoragePolicyProvisioningState(SucceededValue); + /// Resource creation failed. + public static PureStoragePolicyProvisioningState Failed { get; } = new PureStoragePolicyProvisioningState(FailedValue); + /// Resource creation was canceled. + public static PureStoragePolicyProvisioningState Canceled { get; } = new PureStoragePolicyProvisioningState(CanceledValue); + /// is deleting. + public static PureStoragePolicyProvisioningState Deleting { get; } = new PureStoragePolicyProvisioningState(DeletingValue); + /// is updating. + public static PureStoragePolicyProvisioningState Updating { get; } = new PureStoragePolicyProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(PureStoragePolicyProvisioningState left, PureStoragePolicyProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PureStoragePolicyProvisioningState left, PureStoragePolicyProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PureStoragePolicyProvisioningState(string value) => new PureStoragePolicyProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PureStoragePolicyProvisioningState other && Equals(other); + /// + public bool Equals(PureStoragePolicyProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStorageVolume.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStorageVolume.Serialization.cs new file mode 100644 index 000000000000..9e07609aef3e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStorageVolume.Serialization.cs @@ -0,0 +1,134 @@ +// 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.Avs.Models +{ + public partial class PureStorageVolume : 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(PureStorageVolume)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("storagePoolId"u8); + writer.WriteStringValue(StoragePoolId); + writer.WritePropertyName("sizeGb"u8); + writer.WriteNumberValue(SizeGb); + 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 + } + } + } + + PureStorageVolume 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(PureStorageVolume)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePureStorageVolume(document.RootElement, options); + } + + internal static PureStorageVolume DeserializePureStorageVolume(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier storagePoolId = default; + int sizeGb = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storagePoolId"u8)) + { + storagePoolId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("sizeGb"u8)) + { + sizeGb = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PureStorageVolume(storagePoolId, sizeGb, 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); + default: + throw new FormatException($"The model {nameof(PureStorageVolume)} does not support writing '{options.Format}' format."); + } + } + + PureStorageVolume 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 DeserializePureStorageVolume(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PureStorageVolume)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStorageVolume.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStorageVolume.cs new file mode 100644 index 000000000000..901b9c92a5c3 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PureStorageVolume.cs @@ -0,0 +1,82 @@ +// 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.Avs.Models +{ + /// A Pure Storage volume from PureStorage.Block provider. + public partial class PureStorageVolume + { + /// + /// 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 . + /// Azure resource ID of the Pure Storage Pool. + /// Volume size to be used to create a Virtual Volumes (vVols) datastore. + /// is null. + public PureStorageVolume(ResourceIdentifier storagePoolId, int sizeGb) + { + Argument.AssertNotNull(storagePoolId, nameof(storagePoolId)); + + StoragePoolId = storagePoolId; + SizeGb = sizeGb; + } + + /// Initializes a new instance of . + /// Azure resource ID of the Pure Storage Pool. + /// Volume size to be used to create a Virtual Volumes (vVols) datastore. + /// Keeps track of any properties unknown to the library. + internal PureStorageVolume(ResourceIdentifier storagePoolId, int sizeGb, IDictionary serializedAdditionalRawData) + { + StoragePoolId = storagePoolId; + SizeGb = sizeGb; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PureStorageVolume() + { + } + + /// Azure resource ID of the Pure Storage Pool. + public ResourceIdentifier StoragePoolId { get; set; } + /// Volume size to be used to create a Virtual Volumes (vVols) datastore. + public int SizeGb { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.Serialization.cs similarity index 65% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.Serialization.cs index 510089fe4631..27b7f73e5a39 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class AvsSubscriptionQuotaAvailabilityResult : IUtf8JsonSerializable, IJsonModel + public partial class Quota : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter wri /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsSubscriptionQuotaAvailabilityResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Quota)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsCollectionDefined(HostsRemaining)) @@ -67,19 +67,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AvsSubscriptionQuotaAvailabilityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Quota IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsSubscriptionQuotaAvailabilityResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Quota)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsSubscriptionQuotaAvailabilityResult(document.RootElement, options); + return DeserializeQuota(document.RootElement, options); } - internal static AvsSubscriptionQuotaAvailabilityResult DeserializeAvsSubscriptionQuotaAvailabilityResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static Quota DeserializeQuota(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -88,7 +88,7 @@ internal static AvsSubscriptionQuotaAvailabilityResult DeserializeAvsSubscriptio return null; } IReadOnlyDictionary hostsRemaining = default; - AvsSubscriptionQuotaEnabled? quotaEnabled = default; + QuotaEnabled? quotaEnabled = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -113,7 +113,7 @@ internal static AvsSubscriptionQuotaAvailabilityResult DeserializeAvsSubscriptio { continue; } - quotaEnabled = new AvsSubscriptionQuotaEnabled(property.Value.GetString()); + quotaEnabled = new QuotaEnabled(property.Value.GetString()); continue; } if (options.Format != "W") @@ -122,38 +122,38 @@ internal static AvsSubscriptionQuotaAvailabilityResult DeserializeAvsSubscriptio } } serializedAdditionalRawData = rawDataDictionary; - return new AvsSubscriptionQuotaAvailabilityResult(hostsRemaining ?? new ChangeTrackingDictionary(), quotaEnabled, serializedAdditionalRawData); + return new Quota(hostsRemaining ?? new ChangeTrackingDictionary(), quotaEnabled, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsSubscriptionQuotaAvailabilityResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Quota)} does not support writing '{options.Format}' format."); } } - AvsSubscriptionQuotaAvailabilityResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Quota IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsSubscriptionQuotaAvailabilityResult(document.RootElement, options); + return DeserializeQuota(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsSubscriptionQuotaAvailabilityResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Quota)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.cs similarity index 79% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.cs index 74d65330e271..59731dd9495a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionQuotaAvailabilityResult.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// Subscription quotas. - public partial class AvsSubscriptionQuotaAvailabilityResult + public partial class Quota { /// /// Keeps track of any properties unknown to the library. @@ -45,17 +45,17 @@ public partial class AvsSubscriptionQuotaAvailabilityResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal AvsSubscriptionQuotaAvailabilityResult() + /// Initializes a new instance of . + internal Quota() { HostsRemaining = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Remaining hosts quota by sku type. /// Host quota is active for current subscription. /// Keeps track of any properties unknown to the library. - internal AvsSubscriptionQuotaAvailabilityResult(IReadOnlyDictionary hostsRemaining, AvsSubscriptionQuotaEnabled? quotaEnabled, IDictionary serializedAdditionalRawData) + internal Quota(IReadOnlyDictionary hostsRemaining, QuotaEnabled? quotaEnabled, IDictionary serializedAdditionalRawData) { HostsRemaining = hostsRemaining; QuotaEnabled = quotaEnabled; @@ -65,6 +65,6 @@ internal AvsSubscriptionQuotaAvailabilityResult(IReadOnlyDictionary /// Remaining hosts quota by sku type. public IReadOnlyDictionary HostsRemaining { get; } /// Host quota is active for current subscription. - public AvsSubscriptionQuotaEnabled? QuotaEnabled { get; } + public QuotaEnabled? QuotaEnabled { get; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/QuotaEnabled.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/QuotaEnabled.cs new file mode 100644 index 000000000000..085a52b0b750 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/QuotaEnabled.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// quota enabled. + public readonly partial struct QuotaEnabled : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public QuotaEnabled(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// is enabled. + public static QuotaEnabled Enabled { get; } = new QuotaEnabled(EnabledValue); + /// is disabled. + public static QuotaEnabled Disabled { get; } = new QuotaEnabled(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(QuotaEnabled left, QuotaEnabled right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QuotaEnabled left, QuotaEnabled right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator QuotaEnabled(string value) => new QuotaEnabled(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QuotaEnabled other && Equals(other); + /// + public bool Equals(QuotaEnabled other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSku.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSku.Serialization.cs new file mode 100644 index 000000000000..dcbbff324c87 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSku.Serialization.cs @@ -0,0 +1,256 @@ +// 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.Avs.Models +{ + public partial class ResourceSku : 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(ResourceSku)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType.ToString()); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteStringValue(Size); + } + if (Optional.IsDefined(Family)) + { + writer.WritePropertyName("family"u8); + writer.WriteStringValue(Family); + } + writer.WritePropertyName("locations"u8); + writer.WriteStartArray(); + foreach (var item in Locations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("locationInfo"u8); + writer.WriteStartArray(); + foreach (var item in LocationInfo) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsCollectionDefined(Capabilities)) + { + writer.WritePropertyName("capabilities"u8); + writer.WriteStartArray(); + foreach (var item in Capabilities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("restrictions"u8); + writer.WriteStartArray(); + foreach (var item in Restrictions) + { + 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 + } + } + } + + ResourceSku 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(ResourceSku)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSku(document.RootElement, options); + } + + internal static ResourceSku DeserializeResourceSku(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceSkuResourceType resourceType = default; + string name = default; + string tier = default; + string size = default; + string family = default; + IReadOnlyList locations = default; + IReadOnlyList locationInfo = default; + IReadOnlyList capabilities = default; + IReadOnlyList restrictions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceType"u8)) + { + resourceType = new ResourceSkuResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("tier"u8)) + { + tier = property.Value.GetString(); + continue; + } + if (property.NameEquals("size"u8)) + { + size = property.Value.GetString(); + continue; + } + if (property.NameEquals("family"u8)) + { + family = property.Value.GetString(); + continue; + } + if (property.NameEquals("locations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AzureLocation(item.GetString())); + } + locations = array; + continue; + } + if (property.NameEquals("locationInfo"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceSkuLocationInfo.DeserializeResourceSkuLocationInfo(item, options)); + } + locationInfo = array; + continue; + } + if (property.NameEquals("capabilities"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceSkuCapabilities.DeserializeResourceSkuCapabilities(item, options)); + } + capabilities = array; + continue; + } + if (property.NameEquals("restrictions"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceSkuRestrictions.DeserializeResourceSkuRestrictions(item, options)); + } + restrictions = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceSku( + resourceType, + name, + tier, + size, + family, + locations, + locationInfo, + capabilities ?? new ChangeTrackingList(), + restrictions, + 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); + default: + throw new FormatException($"The model {nameof(ResourceSku)} does not support writing '{options.Format}' format."); + } + } + + ResourceSku 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 DeserializeResourceSku(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceSku)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSku.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSku.cs new file mode 100644 index 000000000000..e345ed2939e2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSku.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A SKU for a resource. + public partial class ResourceSku + { + /// + /// 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 type of resource the SKU applies to. + /// The name of the SKU. + /// The set of locations that the SKU is available. + /// A list of locations and availability zones in those locations where the SKU is available. + /// The restrictions of the SKU. + /// , , or is null. + internal ResourceSku(ResourceSkuResourceType resourceType, string name, IEnumerable locations, IEnumerable locationInfo, IEnumerable restrictions) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(locations, nameof(locations)); + Argument.AssertNotNull(locationInfo, nameof(locationInfo)); + Argument.AssertNotNull(restrictions, nameof(restrictions)); + + ResourceType = resourceType; + Name = name; + Locations = locations.ToList(); + LocationInfo = locationInfo.ToList(); + Capabilities = new ChangeTrackingList(); + Restrictions = restrictions.ToList(); + } + + /// Initializes a new instance of . + /// The type of resource the SKU applies to. + /// The name of the SKU. + /// The tier of virtual machines in a scale set. + /// The size of the SKU. + /// The family of the SKU. + /// The set of locations that the SKU is available. + /// A list of locations and availability zones in those locations where the SKU is available. + /// Name value pairs to describe the capability. + /// The restrictions of the SKU. + /// Keeps track of any properties unknown to the library. + internal ResourceSku(ResourceSkuResourceType resourceType, string name, string tier, string size, string family, IReadOnlyList locations, IReadOnlyList locationInfo, IReadOnlyList capabilities, IReadOnlyList restrictions, IDictionary serializedAdditionalRawData) + { + ResourceType = resourceType; + Name = name; + Tier = tier; + Size = size; + Family = family; + Locations = locations; + LocationInfo = locationInfo; + Capabilities = capabilities; + Restrictions = restrictions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceSku() + { + } + + /// The type of resource the SKU applies to. + public ResourceSkuResourceType ResourceType { get; } + /// The name of the SKU. + public string Name { get; } + /// The tier of virtual machines in a scale set. + public string Tier { get; } + /// The size of the SKU. + public string Size { get; } + /// The family of the SKU. + public string Family { get; } + /// The set of locations that the SKU is available. + public IReadOnlyList Locations { get; } + /// A list of locations and availability zones in those locations where the SKU is available. + public IReadOnlyList LocationInfo { get; } + /// Name value pairs to describe the capability. + public IReadOnlyList Capabilities { get; } + /// The restrictions of the SKU. + public IReadOnlyList Restrictions { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuCapabilities.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuCapabilities.Serialization.cs new file mode 100644 index 000000000000..63ab84097891 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuCapabilities.Serialization.cs @@ -0,0 +1,134 @@ +// 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.Avs.Models +{ + public partial class ResourceSkuCapabilities : 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(ResourceSkuCapabilities)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("value"u8); + writer.WriteStringValue(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 + } + } + } + + ResourceSkuCapabilities 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(ResourceSkuCapabilities)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSkuCapabilities(document.RootElement, options); + } + + internal static ResourceSkuCapabilities DeserializeResourceSkuCapabilities(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceSkuCapabilities(name, value, 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); + default: + throw new FormatException($"The model {nameof(ResourceSkuCapabilities)} does not support writing '{options.Format}' format."); + } + } + + ResourceSkuCapabilities 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 DeserializeResourceSkuCapabilities(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceSkuCapabilities)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuCapabilities.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuCapabilities.cs new file mode 100644 index 000000000000..3d4677b5d26e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuCapabilities.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Describes The SKU capabilities object. + public partial class ResourceSkuCapabilities + { + /// + /// 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 name of the SKU capability. + /// The value of the SKU capability. + /// or is null. + internal ResourceSkuCapabilities(string name, string value) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(value, nameof(value)); + + Name = name; + Value = value; + } + + /// Initializes a new instance of . + /// The name of the SKU capability. + /// The value of the SKU capability. + /// Keeps track of any properties unknown to the library. + internal ResourceSkuCapabilities(string name, string value, IDictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceSkuCapabilities() + { + } + + /// The name of the SKU capability. + public string Name { get; } + /// The value of the SKU capability. + public string Value { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuLocationInfo.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuLocationInfo.Serialization.cs new file mode 100644 index 000000000000..a18f2555ead7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuLocationInfo.Serialization.cs @@ -0,0 +1,162 @@ +// 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.Avs.Models +{ + public partial class ResourceSkuLocationInfo : 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(ResourceSkuLocationInfo)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("zoneDetails"u8); + writer.WriteStartArray(); + foreach (var item in ZoneDetails) + { + 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 + } + } + } + + ResourceSkuLocationInfo 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(ResourceSkuLocationInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSkuLocationInfo(document.RootElement, options); + } + + internal static ResourceSkuLocationInfo DeserializeResourceSkuLocationInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation location = default; + IReadOnlyList zones = default; + IReadOnlyList zoneDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("zones"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; + continue; + } + if (property.NameEquals("zoneDetails"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceSkuZoneDetails.DeserializeResourceSkuZoneDetails(item, options)); + } + zoneDetails = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceSkuLocationInfo(location, zones, zoneDetails, 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); + default: + throw new FormatException($"The model {nameof(ResourceSkuLocationInfo)} does not support writing '{options.Format}' format."); + } + } + + ResourceSkuLocationInfo 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 DeserializeResourceSkuLocationInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceSkuLocationInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuLocationInfo.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuLocationInfo.cs new file mode 100644 index 000000000000..f5e726e1ed4a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuLocationInfo.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Describes an available Compute SKU Location Information. + public partial class ResourceSkuLocationInfo + { + /// + /// 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 . + /// Location of the SKU. + /// List of availability zones where the SKU is supported. + /// Gets details of capabilities available to a SKU in specific zones. + /// or is null. + internal ResourceSkuLocationInfo(AzureLocation location, IEnumerable zones, IEnumerable zoneDetails) + { + Argument.AssertNotNull(zones, nameof(zones)); + Argument.AssertNotNull(zoneDetails, nameof(zoneDetails)); + + Location = location; + Zones = zones.ToList(); + ZoneDetails = zoneDetails.ToList(); + } + + /// Initializes a new instance of . + /// Location of the SKU. + /// List of availability zones where the SKU is supported. + /// Gets details of capabilities available to a SKU in specific zones. + /// Keeps track of any properties unknown to the library. + internal ResourceSkuLocationInfo(AzureLocation location, IReadOnlyList zones, IReadOnlyList zoneDetails, IDictionary serializedAdditionalRawData) + { + Location = location; + Zones = zones; + ZoneDetails = zoneDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceSkuLocationInfo() + { + } + + /// Location of the SKU. + public AzureLocation Location { get; } + /// List of availability zones where the SKU is supported. + public IReadOnlyList Zones { get; } + /// Gets details of capabilities available to a SKU in specific zones. + public IReadOnlyList ZoneDetails { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuResourceType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuResourceType.cs new file mode 100644 index 000000000000..5c5a939e6201 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuResourceType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Describes the type of resource the SKU applies to. + public readonly partial struct ResourceSkuResourceType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceSkuResourceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PrivateCloudsValue = "privateClouds"; + private const string PrivateCloudsClustersValue = "privateClouds/clusters"; + + /// The SKU is for a private cloud. + public static ResourceSkuResourceType PrivateClouds { get; } = new ResourceSkuResourceType(PrivateCloudsValue); + /// The SKU is for a private cloud cluster. + public static ResourceSkuResourceType PrivateCloudsClusters { get; } = new ResourceSkuResourceType(PrivateCloudsClustersValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceSkuResourceType left, ResourceSkuResourceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceSkuResourceType left, ResourceSkuResourceType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceSkuResourceType(string value) => new ResourceSkuResourceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceSkuResourceType other && Equals(other); + /// + public bool Equals(ResourceSkuResourceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionInfo.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionInfo.Serialization.cs new file mode 100644 index 000000000000..a3eada16063a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionInfo.Serialization.cs @@ -0,0 +1,168 @@ +// 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.Avs.Models +{ + public partial class ResourceSkuRestrictionInfo : 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(ResourceSkuRestrictionInfo)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Locations)) + { + writer.WritePropertyName("locations"u8); + writer.WriteStartArray(); + foreach (var item in Locations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + writer.WriteStringValue(item); + } + 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 + } + } + } + + ResourceSkuRestrictionInfo 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(ResourceSkuRestrictionInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSkuRestrictionInfo(document.RootElement, options); + } + + internal static ResourceSkuRestrictionInfo DeserializeResourceSkuRestrictionInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList locations = default; + IReadOnlyList zones = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("locations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AzureLocation(item.GetString())); + } + locations = array; + continue; + } + if (property.NameEquals("zones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceSkuRestrictionInfo(locations ?? new ChangeTrackingList(), zones ?? 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); + default: + throw new FormatException($"The model {nameof(ResourceSkuRestrictionInfo)} does not support writing '{options.Format}' format."); + } + } + + ResourceSkuRestrictionInfo 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 DeserializeResourceSkuRestrictionInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceSkuRestrictionInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionInfo.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionInfo.cs new file mode 100644 index 000000000000..837c625298c1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionInfo.cs @@ -0,0 +1,72 @@ +// 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.Avs.Models +{ + /// Describes an available Compute SKU Restriction Information. + public partial class ResourceSkuRestrictionInfo + { + /// + /// 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 . + internal ResourceSkuRestrictionInfo() + { + Locations = new ChangeTrackingList(); + Zones = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Locations where the SKU is restricted. + /// List of availability zones where the SKU is restricted. + /// Keeps track of any properties unknown to the library. + internal ResourceSkuRestrictionInfo(IReadOnlyList locations, IReadOnlyList zones, IDictionary serializedAdditionalRawData) + { + Locations = locations; + Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Locations where the SKU is restricted. + public IReadOnlyList Locations { get; } + /// List of availability zones where the SKU is restricted. + public IReadOnlyList Zones { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictions.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictions.Serialization.cs new file mode 100644 index 000000000000..846061f9db1b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictions.Serialization.cs @@ -0,0 +1,174 @@ +// 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.Avs.Models +{ + public partial class ResourceSkuRestrictions : 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(ResourceSkuRestrictions)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.Value.ToString()); + } + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("restrictionInfo"u8); + writer.WriteObjectValue(RestrictionInfo, options); + if (Optional.IsDefined(ReasonCode)) + { + writer.WritePropertyName("reasonCode"u8); + writer.WriteStringValue(ReasonCode.Value.ToString()); + } + 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 + } + } + } + + ResourceSkuRestrictions 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(ResourceSkuRestrictions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSkuRestrictions(document.RootElement, options); + } + + internal static ResourceSkuRestrictions DeserializeResourceSkuRestrictions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceSkuRestrictionsType? type = default; + IReadOnlyList values = default; + ResourceSkuRestrictionInfo restrictionInfo = default; + ResourceSkuRestrictionsReasonCode? reasonCode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ResourceSkuRestrictionsType(property.Value.GetString()); + continue; + } + if (property.NameEquals("values"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (property.NameEquals("restrictionInfo"u8)) + { + restrictionInfo = ResourceSkuRestrictionInfo.DeserializeResourceSkuRestrictionInfo(property.Value, options); + continue; + } + if (property.NameEquals("reasonCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reasonCode = new ResourceSkuRestrictionsReasonCode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceSkuRestrictions(type, values, restrictionInfo, reasonCode, 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); + default: + throw new FormatException($"The model {nameof(ResourceSkuRestrictions)} does not support writing '{options.Format}' format."); + } + } + + ResourceSkuRestrictions 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 DeserializeResourceSkuRestrictions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceSkuRestrictions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictions.cs new file mode 100644 index 000000000000..630404d0f1fa --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictions.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The restrictions of the SKU. + public partial class ResourceSkuRestrictions + { + /// + /// 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 value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. + /// The information about the restriction where the SKU cannot be used. + /// or is null. + internal ResourceSkuRestrictions(IEnumerable values, ResourceSkuRestrictionInfo restrictionInfo) + { + Argument.AssertNotNull(values, nameof(values)); + Argument.AssertNotNull(restrictionInfo, nameof(restrictionInfo)); + + Values = values.ToList(); + RestrictionInfo = restrictionInfo; + } + + /// Initializes a new instance of . + /// the type of restrictions. + /// The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. + /// The information about the restriction where the SKU cannot be used. + /// the reason for restriction. + /// Keeps track of any properties unknown to the library. + internal ResourceSkuRestrictions(ResourceSkuRestrictionsType? type, IReadOnlyList values, ResourceSkuRestrictionInfo restrictionInfo, ResourceSkuRestrictionsReasonCode? reasonCode, IDictionary serializedAdditionalRawData) + { + Type = type; + Values = values; + RestrictionInfo = restrictionInfo; + ReasonCode = reasonCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceSkuRestrictions() + { + } + + /// the type of restrictions. + public ResourceSkuRestrictionsType? Type { get; } + /// The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. + public IReadOnlyList Values { get; } + /// The information about the restriction where the SKU cannot be used. + public ResourceSkuRestrictionInfo RestrictionInfo { get; } + /// the reason for restriction. + public ResourceSkuRestrictionsReasonCode? ReasonCode { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionsReasonCode.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionsReasonCode.cs new file mode 100644 index 000000000000..6d3fe2173ba2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionsReasonCode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Describes the reason for SKU restriction. + public readonly partial struct ResourceSkuRestrictionsReasonCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceSkuRestrictionsReasonCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string QuotaIdValue = "QuotaId"; + private const string NotAvailableForSubscriptionValue = "NotAvailableForSubscription"; + + /// The restriction is due to exceeding a quota limitation. + public static ResourceSkuRestrictionsReasonCode QuotaId { get; } = new ResourceSkuRestrictionsReasonCode(QuotaIdValue); + /// The restriction is not available for this subscription. + public static ResourceSkuRestrictionsReasonCode NotAvailableForSubscription { get; } = new ResourceSkuRestrictionsReasonCode(NotAvailableForSubscriptionValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceSkuRestrictionsReasonCode left, ResourceSkuRestrictionsReasonCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceSkuRestrictionsReasonCode left, ResourceSkuRestrictionsReasonCode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceSkuRestrictionsReasonCode(string value) => new ResourceSkuRestrictionsReasonCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceSkuRestrictionsReasonCode other && Equals(other); + /// + public bool Equals(ResourceSkuRestrictionsReasonCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionsType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionsType.cs new file mode 100644 index 000000000000..10f9d52228fe --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuRestrictionsType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Describes the kind of SKU restrictions that can exist. + public readonly partial struct ResourceSkuRestrictionsType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceSkuRestrictionsType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LocationValue = "Location"; + private const string ZoneValue = "Zone"; + + /// SKU restricted by location. + public static ResourceSkuRestrictionsType Location { get; } = new ResourceSkuRestrictionsType(LocationValue); + /// SKU restricted by availability zone. + public static ResourceSkuRestrictionsType Zone { get; } = new ResourceSkuRestrictionsType(ZoneValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceSkuRestrictionsType left, ResourceSkuRestrictionsType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceSkuRestrictionsType left, ResourceSkuRestrictionsType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceSkuRestrictionsType(string value) => new ResourceSkuRestrictionsType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceSkuRestrictionsType other && Equals(other); + /// + public bool Equals(ResourceSkuRestrictionsType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuZoneDetails.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuZoneDetails.Serialization.cs new file mode 100644 index 000000000000..da63606ef4bf --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuZoneDetails.Serialization.cs @@ -0,0 +1,154 @@ +// 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.Avs.Models +{ + public partial class ResourceSkuZoneDetails : 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(ResourceSkuZoneDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStartArray(); + foreach (var item in Name) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("capabilities"u8); + writer.WriteStartArray(); + foreach (var item in Capabilities) + { + 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 + } + } + } + + ResourceSkuZoneDetails 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(ResourceSkuZoneDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSkuZoneDetails(document.RootElement, options); + } + + internal static ResourceSkuZoneDetails DeserializeResourceSkuZoneDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList name = default; + IReadOnlyList capabilities = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + name = array; + continue; + } + if (property.NameEquals("capabilities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceSkuCapabilities.DeserializeResourceSkuCapabilities(item, options)); + } + capabilities = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceSkuZoneDetails(name, capabilities, 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); + default: + throw new FormatException($"The model {nameof(ResourceSkuZoneDetails)} does not support writing '{options.Format}' format."); + } + } + + ResourceSkuZoneDetails 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 DeserializeResourceSkuZoneDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceSkuZoneDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuZoneDetails.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuZoneDetails.cs new file mode 100644 index 000000000000..d73c523154ea --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceSkuZoneDetails.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Describes The zonal capabilities of a SKU. + public partial class ResourceSkuZoneDetails + { + /// + /// 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 . + /// Gets the set of zones that the SKU is available in with the specified capabilities. + /// A list of capabilities that are available for the SKU in the specified list of zones. + /// or is null. + internal ResourceSkuZoneDetails(IEnumerable name, IEnumerable capabilities) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(capabilities, nameof(capabilities)); + + Name = name.ToList(); + Capabilities = capabilities.ToList(); + } + + /// Initializes a new instance of . + /// Gets the set of zones that the SKU is available in with the specified capabilities. + /// A list of capabilities that are available for the SKU in the specified list of zones. + /// Keeps track of any properties unknown to the library. + internal ResourceSkuZoneDetails(IReadOnlyList name, IReadOnlyList capabilities, IDictionary serializedAdditionalRawData) + { + Name = name; + Capabilities = capabilities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceSkuZoneDetails() + { + } + + /// Gets the set of zones that the SKU is available in with the specified capabilities. + public IReadOnlyList Name { get; } + /// A list of capabilities that are available for the SKU in the specified list of zones. + public IReadOnlyList Capabilities { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletProperties.Serialization.cs new file mode 100644 index 000000000000..fcad569fe5e4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletProperties.Serialization.cs @@ -0,0 +1,201 @@ +// 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.Avs.Models +{ + public partial class ScriptCmdletProperties : 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(ScriptCmdletProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && Optional.IsDefined(Timeout)) + { + writer.WritePropertyName("timeout"u8); + writer.WriteStringValue(Timeout); + } + if (options.Format != "W" && Optional.IsDefined(Audience)) + { + writer.WritePropertyName("audience"u8); + writer.WriteStringValue(Audience.Value.ToString()); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartArray(); + foreach (var item in Parameters) + { + 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 + } + } + } + + ScriptCmdletProperties 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(ScriptCmdletProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScriptCmdletProperties(document.RootElement, options); + } + + internal static ScriptCmdletProperties DeserializeScriptCmdletProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ScriptCmdletProvisioningState? provisioningState = default; + string description = default; + string timeout = default; + ScriptCmdletAudience? audience = default; + IReadOnlyList parameters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ScriptCmdletProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeout"u8)) + { + timeout = property.Value.GetString(); + continue; + } + if (property.NameEquals("audience"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + audience = new ScriptCmdletAudience(property.Value.GetString()); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScriptParameter.DeserializeScriptParameter(item, options)); + } + parameters = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScriptCmdletProperties( + provisioningState, + description, + timeout, + audience, + parameters ?? 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); + default: + throw new FormatException($"The model {nameof(ScriptCmdletProperties)} does not support writing '{options.Format}' format."); + } + } + + ScriptCmdletProperties 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 DeserializeScriptCmdletProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScriptCmdletProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletProperties.cs new file mode 100644 index 000000000000..f358876c46c0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletProperties.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Properties of a pre-canned script. + public partial class ScriptCmdletProperties + { + /// + /// 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 . + internal ScriptCmdletProperties() + { + Parameters = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// Description of the scripts functionality. + /// Recommended time limit for execution. + /// Specifies whether a script cmdlet is intended to be invoked only through automation or visible to customers. + /// Parameters the script will accept. + /// Keeps track of any properties unknown to the library. + internal ScriptCmdletProperties(ScriptCmdletProvisioningState? provisioningState, string description, string timeout, ScriptCmdletAudience? audience, IReadOnlyList parameters, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + Description = description; + Timeout = timeout; + Audience = audience; + Parameters = parameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The provisioning state of the resource. + public ScriptCmdletProvisioningState? ProvisioningState { get; } + /// Description of the scripts functionality. + public string Description { get; } + /// Recommended time limit for execution. + public string Timeout { get; } + /// Specifies whether a script cmdlet is intended to be invoked only through automation or visible to customers. + public ScriptCmdletAudience? Audience { get; } + /// Parameters the script will accept. + public IReadOnlyList Parameters { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.Serialization.cs similarity index 61% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.Serialization.cs index 6c1ac0b5bad2..5076232c2bf2 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { [PersistableModelProxy(typeof(UnknownScriptExecutionParameter))] - public partial class ScriptExecutionParameterDetails : IUtf8JsonSerializable, IJsonModel + public partial class ScriptExecutionParameter : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,14 +28,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ScriptExecutionParameterDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ScriptExecutionParameter)} does not support writing '{format}' format."); } writer.WritePropertyName("type"u8); - writer.WriteStringValue(ParameterType.ToString()); + writer.WriteStringValue(Type.ToString()); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); if (options.Format != "W" && _serializedAdditionalRawData != null) @@ -55,19 +55,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ScriptExecutionParameterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ScriptExecutionParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ScriptExecutionParameterDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ScriptExecutionParameter)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeScriptExecutionParameterDetails(document.RootElement, options); + return DeserializeScriptExecutionParameter(document.RootElement, options); } - internal static ScriptExecutionParameterDetails DeserializeScriptExecutionParameterDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static ScriptExecutionParameter DeserializeScriptExecutionParameter(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -79,43 +79,43 @@ internal static ScriptExecutionParameterDetails DeserializeScriptExecutionParame { switch (discriminator.GetString()) { - case "Credential": return PSCredentialExecutionParameterDetails.DeserializePSCredentialExecutionParameterDetails(element, options); - case "SecureValue": return ScriptSecureStringExecutionParameterDetails.DeserializeScriptSecureStringExecutionParameterDetails(element, options); - case "Value": return ScriptStringExecutionParameterDetails.DeserializeScriptStringExecutionParameterDetails(element, options); + case "Credential": return PSCredentialExecutionParameter.DeserializePSCredentialExecutionParameter(element, options); + case "SecureValue": return ScriptSecureStringExecutionParameter.DeserializeScriptSecureStringExecutionParameter(element, options); + case "Value": return ScriptStringExecutionParameter.DeserializeScriptStringExecutionParameter(element, options); } } return UnknownScriptExecutionParameter.DeserializeUnknownScriptExecutionParameter(element, options); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ScriptExecutionParameterDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ScriptExecutionParameter)} does not support writing '{options.Format}' format."); } } - ScriptExecutionParameterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ScriptExecutionParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeScriptExecutionParameterDetails(document.RootElement, options); + return DeserializeScriptExecutionParameter(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ScriptExecutionParameterDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ScriptExecutionParameter)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.cs similarity index 70% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.cs index d9b707ec5afb..f84f8fe3e1ff 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterDetails.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.cs @@ -12,10 +12,10 @@ namespace Azure.ResourceManager.Avs.Models { /// /// The arguments passed in to the execution - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . /// - public abstract partial class ScriptExecutionParameterDetails + public abstract partial class ScriptExecutionParameter { /// /// Keeps track of any properties unknown to the library. @@ -49,34 +49,34 @@ public abstract partial class ScriptExecutionParameterDetails /// private protected IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The parameter name. /// is null. - protected ScriptExecutionParameterDetails(string name) + protected ScriptExecutionParameter(string name) { Argument.AssertNotNull(name, nameof(name)); Name = name; } - /// Initializes a new instance of . - /// script execution parameter type. + /// Initializes a new instance of . + /// script execution parameter type. /// The parameter name. /// Keeps track of any properties unknown to the library. - internal ScriptExecutionParameterDetails(ScriptExecutionParameterType parameterType, string name, IDictionary serializedAdditionalRawData) + internal ScriptExecutionParameter(ScriptExecutionParameterType type, string name, IDictionary serializedAdditionalRawData) { - ParameterType = parameterType; + Type = type; Name = name; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ScriptExecutionParameterDetails() + /// Initializes a new instance of for deserialization. + internal ScriptExecutionParameter() { } /// script execution parameter type. - internal ScriptExecutionParameterType ParameterType { get; set; } + internal ScriptExecutionParameterType Type { get; set; } /// The parameter name. public string Name { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionProperties.Serialization.cs new file mode 100644 index 000000000000..1655641ccad1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionProperties.Serialization.cs @@ -0,0 +1,411 @@ +// 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.Avs.Models +{ + public partial class ScriptExecutionProperties : 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(ScriptExecutionProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ScriptCmdletId)) + { + writer.WritePropertyName("scriptCmdletId"u8); + writer.WriteStringValue(ScriptCmdletId); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartArray(); + foreach (var item in Parameters) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(HiddenParameters)) + { + writer.WritePropertyName("hiddenParameters"u8); + writer.WriteStartArray(); + foreach (var item in HiddenParameters) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FailureReason)) + { + writer.WritePropertyName("failureReason"u8); + writer.WriteStringValue(FailureReason); + } + writer.WritePropertyName("timeout"u8); + writer.WriteStringValue(Timeout); + if (Optional.IsDefined(Retention)) + { + writer.WritePropertyName("retention"u8); + writer.WriteStringValue(Retention); + } + if (options.Format != "W" && Optional.IsDefined(SubmittedOn)) + { + writer.WritePropertyName("submittedAt"u8); + writer.WriteStringValue(SubmittedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(StartedOn)) + { + writer.WritePropertyName("startedAt"u8); + writer.WriteStringValue(StartedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(FinishedOn)) + { + writer.WritePropertyName("finishedAt"u8); + writer.WriteStringValue(FinishedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsCollectionDefined(Output)) + { + writer.WritePropertyName("output"u8); + writer.WriteStartArray(); + foreach (var item in Output) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NamedOutputs)) + { + writer.WritePropertyName("namedOutputs"u8); + writer.WriteStartObject(); + foreach (var item in NamedOutputs) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Information)) + { + writer.WritePropertyName("information"u8); + writer.WriteStartArray(); + foreach (var item in Information) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Warnings)) + { + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteStringValue(item); + } + 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 + } + } + } + + ScriptExecutionProperties 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(ScriptExecutionProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScriptExecutionProperties(document.RootElement, options); + } + + internal static ScriptExecutionProperties DeserializeScriptExecutionProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string scriptCmdletId = default; + IList parameters = default; + IList hiddenParameters = default; + string failureReason = default; + string timeout = default; + string retention = default; + DateTimeOffset? submittedAt = default; + DateTimeOffset? startedAt = default; + DateTimeOffset? finishedAt = default; + ScriptExecutionProvisioningState? provisioningState = default; + IList output = default; + IDictionary namedOutputs = default; + IReadOnlyList information = default; + IReadOnlyList warnings = default; + IReadOnlyList errors = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scriptCmdletId"u8)) + { + scriptCmdletId = property.Value.GetString(); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScriptExecutionParameter.DeserializeScriptExecutionParameter(item, options)); + } + parameters = array; + continue; + } + if (property.NameEquals("hiddenParameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScriptExecutionParameter.DeserializeScriptExecutionParameter(item, options)); + } + hiddenParameters = array; + continue; + } + if (property.NameEquals("failureReason"u8)) + { + failureReason = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeout"u8)) + { + timeout = property.Value.GetString(); + continue; + } + if (property.NameEquals("retention"u8)) + { + retention = property.Value.GetString(); + continue; + } + if (property.NameEquals("submittedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + submittedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("startedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("finishedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + finishedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ScriptExecutionProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("output"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + output = array; + continue; + } + if (property.NameEquals("namedOutputs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ScriptExecutionPropertiesNamedOutput.DeserializeScriptExecutionPropertiesNamedOutput(property0.Value, options)); + } + namedOutputs = dictionary; + continue; + } + if (property.NameEquals("information"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + information = array; + continue; + } + if (property.NameEquals("warnings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + warnings = array; + continue; + } + if (property.NameEquals("errors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + errors = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScriptExecutionProperties( + scriptCmdletId, + parameters ?? new ChangeTrackingList(), + hiddenParameters ?? new ChangeTrackingList(), + failureReason, + timeout, + retention, + submittedAt, + startedAt, + finishedAt, + provisioningState, + output ?? new ChangeTrackingList(), + namedOutputs ?? new ChangeTrackingDictionary(), + information ?? new ChangeTrackingList(), + warnings ?? new ChangeTrackingList(), + errors ?? 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); + default: + throw new FormatException($"The model {nameof(ScriptExecutionProperties)} does not support writing '{options.Format}' format."); + } + } + + ScriptExecutionProperties 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 DeserializeScriptExecutionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScriptExecutionProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionProperties.cs new file mode 100644 index 000000000000..f8ffe945e12a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionProperties.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Properties of a user-invoked script. + public partial class ScriptExecutionProperties + { + /// + /// 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 . + /// Time limit for execution. + /// is null. + public ScriptExecutionProperties(string timeout) + { + Argument.AssertNotNull(timeout, nameof(timeout)); + + Parameters = new ChangeTrackingList(); + HiddenParameters = new ChangeTrackingList(); + Timeout = timeout; + Output = new ChangeTrackingList(); + NamedOutputs = new ChangeTrackingDictionary(); + Information = new ChangeTrackingList(); + Warnings = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A reference to the script cmdlet resource if user is running a AVS script. + /// + /// Parameters the script will accept + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// + /// Parameters that will be hidden/not visible to ARM, such as passwords and + /// credentials + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// + /// Error message if the script was able to run, but if the script itself had + /// errors or powershell threw an exception + /// + /// Time limit for execution. + /// Time to live for the resource. If not provided, will be available for 60 days. + /// Time the script execution was submitted. + /// Time the script execution was started. + /// Time the script execution was finished. + /// The state of the script execution resource. + /// Standard output stream from the powershell execution. + /// User-defined dictionary. + /// Standard information out stream from the powershell execution. + /// Standard warning out stream from the powershell execution. + /// Standard error output stream from the powershell execution. + /// Keeps track of any properties unknown to the library. + internal ScriptExecutionProperties(string scriptCmdletId, IList parameters, IList hiddenParameters, string failureReason, string timeout, string retention, DateTimeOffset? submittedOn, DateTimeOffset? startedOn, DateTimeOffset? finishedOn, ScriptExecutionProvisioningState? provisioningState, IList output, IDictionary namedOutputs, IReadOnlyList information, IReadOnlyList warnings, IReadOnlyList errors, IDictionary serializedAdditionalRawData) + { + ScriptCmdletId = scriptCmdletId; + Parameters = parameters; + HiddenParameters = hiddenParameters; + FailureReason = failureReason; + Timeout = timeout; + Retention = retention; + SubmittedOn = submittedOn; + StartedOn = startedOn; + FinishedOn = finishedOn; + ProvisioningState = provisioningState; + Output = output; + NamedOutputs = namedOutputs; + Information = information; + Warnings = warnings; + Errors = errors; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ScriptExecutionProperties() + { + } + + /// A reference to the script cmdlet resource if user is running a AVS script. + public string ScriptCmdletId { get; set; } + /// + /// Parameters the script will accept + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public IList Parameters { get; } + /// + /// Parameters that will be hidden/not visible to ARM, such as passwords and + /// credentials + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public IList HiddenParameters { get; } + /// + /// Error message if the script was able to run, but if the script itself had + /// errors or powershell threw an exception + /// + public string FailureReason { get; set; } + /// Time limit for execution. + public string Timeout { get; set; } + /// Time to live for the resource. If not provided, will be available for 60 days. + public string Retention { get; set; } + /// Time the script execution was submitted. + public DateTimeOffset? SubmittedOn { get; } + /// Time the script execution was started. + public DateTimeOffset? StartedOn { get; } + /// Time the script execution was finished. + public DateTimeOffset? FinishedOn { get; } + /// The state of the script execution resource. + public ScriptExecutionProvisioningState? ProvisioningState { get; } + /// Standard output stream from the powershell execution. + public IList Output { get; } + /// User-defined dictionary. + public IDictionary NamedOutputs { get; } + /// Standard information out stream from the powershell execution. + public IReadOnlyList Information { get; } + /// Standard warning out stream from the powershell execution. + public IReadOnlyList Warnings { get; } + /// Standard error output stream from the powershell execution. + public IReadOnlyList Errors { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionPropertiesNamedOutput.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionPropertiesNamedOutput.Serialization.cs new file mode 100644 index 000000000000..8964b3135d14 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionPropertiesNamedOutput.Serialization.cs @@ -0,0 +1,118 @@ +// 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.Avs.Models +{ + public partial class ScriptExecutionPropertiesNamedOutput : 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(ScriptExecutionPropertiesNamedOutput)} does not support writing '{format}' format."); + } + + 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 + } + } + } + + ScriptExecutionPropertiesNamedOutput 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(ScriptExecutionPropertiesNamedOutput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScriptExecutionPropertiesNamedOutput(document.RootElement, options); + } + + internal static ScriptExecutionPropertiesNamedOutput DeserializeScriptExecutionPropertiesNamedOutput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScriptExecutionPropertiesNamedOutput(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); + default: + throw new FormatException($"The model {nameof(ScriptExecutionPropertiesNamedOutput)} does not support writing '{options.Format}' format."); + } + } + + ScriptExecutionPropertiesNamedOutput 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 DeserializeScriptExecutionPropertiesNamedOutput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScriptExecutionPropertiesNamedOutput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionPropertiesNamedOutput.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionPropertiesNamedOutput.cs new file mode 100644 index 000000000000..3bc050758324 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionPropertiesNamedOutput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The ScriptExecutionPropertiesNamedOutput. + public partial class ScriptExecutionPropertiesNamedOutput + { + /// + /// 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 . + public ScriptExecutionPropertiesNamedOutput() + { + } + + /// Initializes a new instance of . + /// Keeps track of any properties unknown to the library. + internal ScriptExecutionPropertiesNamedOutput(IDictionary serializedAdditionalRawData) + { + _serializedAdditionalRawData = serializedAdditionalRawData; + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageProperties.Serialization.cs new file mode 100644 index 000000000000..b7c6367079f4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageProperties.Serialization.cs @@ -0,0 +1,183 @@ +// 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.Avs.Models +{ + public partial class ScriptPackageProperties : 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(ScriptPackageProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (options.Format != "W" && Optional.IsDefined(Company)) + { + writer.WritePropertyName("company"u8); + writer.WriteStringValue(Company); + } + if (options.Format != "W" && Optional.IsDefined(Uri)) + { + writer.WritePropertyName("uri"u8); + writer.WriteStringValue(Uri); + } + 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 + } + } + } + + ScriptPackageProperties 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(ScriptPackageProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScriptPackageProperties(document.RootElement, options); + } + + internal static ScriptPackageProperties DeserializeScriptPackageProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ScriptPackageProvisioningState? provisioningState = default; + string description = default; + string version = default; + string company = default; + string uri = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ScriptPackageProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("company"u8)) + { + company = property.Value.GetString(); + continue; + } + if (property.NameEquals("uri"u8)) + { + uri = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScriptPackageProperties( + provisioningState, + description, + version, + company, + uri, + 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); + default: + throw new FormatException($"The model {nameof(ScriptPackageProperties)} does not support writing '{options.Format}' format."); + } + } + + ScriptPackageProperties 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 DeserializeScriptPackageProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScriptPackageProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageProperties.cs new file mode 100644 index 000000000000..16189b43b092 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Properties of a Script Package subresource. + public partial class ScriptPackageProperties + { + /// + /// 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 . + internal ScriptPackageProperties() + { + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// User friendly description of the package. + /// Module version. + /// Company that created and supports the package. + /// Link to support by the package vendor. + /// Keeps track of any properties unknown to the library. + internal ScriptPackageProperties(ScriptPackageProvisioningState? provisioningState, string description, string version, string company, string uri, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + Description = description; + Version = version; + Company = company; + Uri = uri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The provisioning state of the resource. + public ScriptPackageProvisioningState? ProvisioningState { get; } + /// User friendly description of the package. + public string Description { get; } + /// Module version. + public string Version { get; } + /// Company that created and supports the package. + public string Company { get; } + /// Link to support by the package vendor. + public string Uri { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs index b72e1842ea89..7d6bd7cac2f9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs @@ -34,10 +34,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ScriptParameter)} does not support writing '{format}' format."); } - if (options.Format != "W" && Avs.Optional.IsDefined(ParameterType)) + if (options.Format != "W" && Avs.Optional.IsDefined(Type)) { writer.WritePropertyName("type"u8); - writer.WriteStringValue(ParameterType.Value.ToString()); + writer.WriteStringValue(Type.Value.ToString()); } if (Avs.Optional.IsDefined(Name)) { @@ -99,8 +99,8 @@ internal static ScriptParameter DeserializeScriptParameter(JsonElement element, ScriptParameterType? type = default; string name = default; string description = default; - ParameterVisibilityStatus? visibility = default; - ParameterOptionalityStatus? optional = default; + VisibilityParameterEnum? visibility = default; + OptionalParamEnum? optional = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -130,7 +130,7 @@ internal static ScriptParameter DeserializeScriptParameter(JsonElement element, { continue; } - visibility = new ParameterVisibilityStatus(property.Value.GetString()); + visibility = new VisibilityParameterEnum(property.Value.GetString()); continue; } if (property.NameEquals("optional"u8)) @@ -139,7 +139,7 @@ internal static ScriptParameter DeserializeScriptParameter(JsonElement element, { continue; } - optional = new ParameterOptionalityStatus(property.Value.GetString()); + optional = new OptionalParamEnum(property.Value.GetString()); continue; } if (options.Format != "W") diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs index 403d98a87e69..2ae1c81ada81 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs @@ -51,7 +51,7 @@ internal ScriptParameter() } /// Initializes a new instance of . - /// + /// /// The type of parameter the script is expecting. psCredential is a /// PSCredentialObject /// @@ -63,9 +63,9 @@ internal ScriptParameter() /// /// Is this parameter required or optional. /// Keeps track of any properties unknown to the library. - internal ScriptParameter(ScriptParameterType? parameterType, string name, string description, ParameterVisibilityStatus? visibility, ParameterOptionalityStatus? optional, IDictionary serializedAdditionalRawData) + internal ScriptParameter(ScriptParameterType? type, string name, string description, VisibilityParameterEnum? visibility, OptionalParamEnum? optional, IDictionary serializedAdditionalRawData) { - ParameterType = parameterType; + Type = type; Name = name; Description = description; Visibility = visibility; @@ -77,7 +77,7 @@ internal ScriptParameter(ScriptParameterType? parameterType, string name, string /// The type of parameter the script is expecting. psCredential is a /// PSCredentialObject /// - public ScriptParameterType? ParameterType { get; } + public ScriptParameterType? Type { get; } /// The parameter name that the script will expect a parameter value for. public string Name { get; } /// User friendly description of the parameter. @@ -86,8 +86,8 @@ internal ScriptParameter(ScriptParameterType? parameterType, string name, string /// Should this parameter be visible to arm and passed in the parameters argument /// when executing /// - public ParameterVisibilityStatus? Visibility { get; } + public VisibilityParameterEnum? Visibility { get; } /// Is this parameter required or optional. - public ParameterOptionalityStatus? Optional { get; } + public OptionalParamEnum? Optional { get; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.Serialization.cs similarity index 65% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.Serialization.cs index 2dc2b3755433..cf1b4ee3200d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class ScriptSecureStringExecutionParameterDetails : IUtf8JsonSerializable, IJsonModel + public partial class ScriptSecureStringExecutionParameter : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWrite /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ScriptSecureStringExecutionParameterDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ScriptSecureStringExecutionParameter)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -42,19 +42,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - ScriptSecureStringExecutionParameterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ScriptSecureStringExecutionParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ScriptSecureStringExecutionParameterDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ScriptSecureStringExecutionParameter)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeScriptSecureStringExecutionParameterDetails(document.RootElement, options); + return DeserializeScriptSecureStringExecutionParameter(document.RootElement, options); } - internal static ScriptSecureStringExecutionParameterDetails DeserializeScriptSecureStringExecutionParameterDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static ScriptSecureStringExecutionParameter DeserializeScriptSecureStringExecutionParameter(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -90,38 +90,38 @@ internal static ScriptSecureStringExecutionParameterDetails DeserializeScriptSec } } serializedAdditionalRawData = rawDataDictionary; - return new ScriptSecureStringExecutionParameterDetails(type, name, serializedAdditionalRawData, secureValue); + return new ScriptSecureStringExecutionParameter(type, name, serializedAdditionalRawData, secureValue); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ScriptSecureStringExecutionParameterDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ScriptSecureStringExecutionParameter)} does not support writing '{options.Format}' format."); } } - ScriptSecureStringExecutionParameterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ScriptSecureStringExecutionParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeScriptSecureStringExecutionParameterDetails(document.RootElement, options); + return DeserializeScriptSecureStringExecutionParameter(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ScriptSecureStringExecutionParameterDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ScriptSecureStringExecutionParameter)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.cs similarity index 58% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.cs index 448b692ba630..52aaba76d97d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameterDetails.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.cs @@ -11,31 +11,31 @@ namespace Azure.ResourceManager.Avs.Models { /// a plain text value execution parameter. - public partial class ScriptSecureStringExecutionParameterDetails : ScriptExecutionParameterDetails + public partial class ScriptSecureStringExecutionParameter : ScriptExecutionParameter { - /// Initializes a new instance of . + /// Initializes a new instance of . /// The parameter name. /// is null. - public ScriptSecureStringExecutionParameterDetails(string name) : base(name) + public ScriptSecureStringExecutionParameter(string name) : base(name) { Argument.AssertNotNull(name, nameof(name)); - ParameterType = ScriptExecutionParameterType.SecureValue; + Type = ScriptExecutionParameterType.SecureValue; } - /// Initializes a new instance of . - /// script execution parameter type. + /// Initializes a new instance of . + /// script execution parameter type. /// The parameter name. /// Keeps track of any properties unknown to the library. /// A secure value for the passed parameter, not to be stored in logs. - internal ScriptSecureStringExecutionParameterDetails(ScriptExecutionParameterType parameterType, string name, IDictionary serializedAdditionalRawData, string secureValue) : base(parameterType, name, serializedAdditionalRawData) + internal ScriptSecureStringExecutionParameter(ScriptExecutionParameterType type, string name, IDictionary serializedAdditionalRawData, string secureValue) : base(type, name, serializedAdditionalRawData) { SecureValue = secureValue; - ParameterType = parameterType; + Type = type; } - /// Initializes a new instance of for deserialization. - internal ScriptSecureStringExecutionParameterDetails() + /// Initializes a new instance of for deserialization. + internal ScriptSecureStringExecutionParameter() { } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.Serialization.cs similarity index 64% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.Serialization.cs index c16d7803412a..ca01f7b20c5b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class ScriptStringExecutionParameterDetails : IUtf8JsonSerializable, IJsonModel + public partial class ScriptStringExecutionParameter : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writ /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ScriptStringExecutionParameterDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ScriptStringExecutionParameter)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -42,19 +42,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - ScriptStringExecutionParameterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ScriptStringExecutionParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ScriptStringExecutionParameterDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ScriptStringExecutionParameter)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeScriptStringExecutionParameterDetails(document.RootElement, options); + return DeserializeScriptStringExecutionParameter(document.RootElement, options); } - internal static ScriptStringExecutionParameterDetails DeserializeScriptStringExecutionParameterDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static ScriptStringExecutionParameter DeserializeScriptStringExecutionParameter(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -90,38 +90,38 @@ internal static ScriptStringExecutionParameterDetails DeserializeScriptStringExe } } serializedAdditionalRawData = rawDataDictionary; - return new ScriptStringExecutionParameterDetails(type, name, serializedAdditionalRawData, value); + return new ScriptStringExecutionParameter(type, name, serializedAdditionalRawData, value); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ScriptStringExecutionParameterDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ScriptStringExecutionParameter)} does not support writing '{options.Format}' format."); } } - ScriptStringExecutionParameterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ScriptStringExecutionParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeScriptStringExecutionParameterDetails(document.RootElement, options); + return DeserializeScriptStringExecutionParameter(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ScriptStringExecutionParameterDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ScriptStringExecutionParameter)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.cs similarity index 58% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.cs index f9476acd5ce7..b78aca46b9b0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameterDetails.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.cs @@ -11,31 +11,31 @@ namespace Azure.ResourceManager.Avs.Models { /// a plain text value execution parameter. - public partial class ScriptStringExecutionParameterDetails : ScriptExecutionParameterDetails + public partial class ScriptStringExecutionParameter : ScriptExecutionParameter { - /// Initializes a new instance of . + /// Initializes a new instance of . /// The parameter name. /// is null. - public ScriptStringExecutionParameterDetails(string name) : base(name) + public ScriptStringExecutionParameter(string name) : base(name) { Argument.AssertNotNull(name, nameof(name)); - ParameterType = ScriptExecutionParameterType.Value; + Type = ScriptExecutionParameterType.Value; } - /// Initializes a new instance of . - /// script execution parameter type. + /// Initializes a new instance of . + /// script execution parameter type. /// The parameter name. /// Keeps track of any properties unknown to the library. /// The value for the passed parameter. - internal ScriptStringExecutionParameterDetails(ScriptExecutionParameterType parameterType, string name, IDictionary serializedAdditionalRawData, string value) : base(parameterType, name, serializedAdditionalRawData) + internal ScriptStringExecutionParameter(ScriptExecutionParameterType type, string name, IDictionary serializedAdditionalRawData, string value) : base(type, name, serializedAdditionalRawData) { Value = value; - ParameterType = parameterType; + Type = type; } - /// Initializes a new instance of for deserialization. - internal ScriptStringExecutionParameterDetails() + /// Initializes a new instance of for deserialization. + internal ScriptStringExecutionParameter() { } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SegmentStatusEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SegmentStatusEnum.cs new file mode 100644 index 000000000000..607b86029845 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SegmentStatusEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Segment status. + public readonly partial struct SegmentStatusEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SegmentStatusEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SUCCESSValue = "SUCCESS"; + private const string FAILUREValue = "FAILURE"; + + /// is success. + public static SegmentStatusEnum SUCCESS { get; } = new SegmentStatusEnum(SUCCESSValue); + /// is failure. + public static SegmentStatusEnum FAILURE { get; } = new SegmentStatusEnum(FAILUREValue); + /// Determines if two values are the same. + public static bool operator ==(SegmentStatusEnum left, SegmentStatusEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SegmentStatusEnum left, SegmentStatusEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SegmentStatusEnum(string value) => new SegmentStatusEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SegmentStatusEnum other && Equals(other); + /// + public bool Equals(SegmentStatusEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SpecializedHostProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SpecializedHostProperties.Serialization.cs new file mode 100644 index 000000000000..40c156f5d82c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SpecializedHostProperties.Serialization.cs @@ -0,0 +1,162 @@ +// 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.Avs.Models +{ + public partial class SpecializedHostProperties : 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 override 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(SpecializedHostProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + SpecializedHostProperties 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(SpecializedHostProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSpecializedHostProperties(document.RootElement, options); + } + + internal static SpecializedHostProperties DeserializeSpecializedHostProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HostKind kind = default; + HostProvisioningState? provisioningState = default; + string displayName = default; + string moRefId = default; + string fqdn = default; + HostMaintenance? maintenance = default; + string faultDomain = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new HostKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new HostProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("moRefId"u8)) + { + moRefId = property.Value.GetString(); + continue; + } + if (property.NameEquals("fqdn"u8)) + { + fqdn = property.Value.GetString(); + continue; + } + if (property.NameEquals("maintenance"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maintenance = new HostMaintenance(property.Value.GetString()); + continue; + } + if (property.NameEquals("faultDomain"u8)) + { + faultDomain = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SpecializedHostProperties( + kind, + provisioningState, + displayName, + moRefId, + fqdn, + maintenance, + faultDomain, + 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); + default: + throw new FormatException($"The model {nameof(SpecializedHostProperties)} does not support writing '{options.Format}' format."); + } + } + + SpecializedHostProperties 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 DeserializeSpecializedHostProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SpecializedHostProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SpecializedHostProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SpecializedHostProperties.cs new file mode 100644 index 000000000000..88a70f3c0742 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SpecializedHostProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a specialized host. + public partial class SpecializedHostProperties : HostProperties + { + /// Initializes a new instance of . + internal SpecializedHostProperties() + { + Kind = HostKind.Specialized; + } + + /// Initializes a new instance of . + /// The kind of host. + /// The state of the host provisioning. + /// Display name of the host in VMware vCenter. + /// vCenter managed object reference ID of the host. + /// Fully qualified domain name of the host. + /// If provided, the host is in maintenance. The value is the reason for maintenance. + /// + /// Keeps track of any properties unknown to the library. + internal SpecializedHostProperties(HostKind kind, HostProvisioningState? provisioningState, string displayName, string moRefId, string fqdn, HostMaintenance? maintenance, string faultDomain, IDictionary serializedAdditionalRawData) : base(kind, provisioningState, displayName, moRefId, fqdn, maintenance, faultDomain, serializedAdditionalRawData) + { + Kind = kind; + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SslCertificateStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SslEnum.cs similarity index 50% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SslCertificateStatus.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SslEnum.cs index 438b8ef8d6e3..473cdd3f5a46 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SslCertificateStatus.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SslEnum.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.Avs.Models { /// Whether SSL is enabled or disabled. - public readonly partial struct SslCertificateStatus : IEquatable + public readonly partial struct SslEnum : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public SslCertificateStatus(string value) + public SslEnum(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -26,21 +26,21 @@ public SslCertificateStatus(string value) private const string DisabledValue = "Disabled"; /// is enabled. - public static SslCertificateStatus Enabled { get; } = new SslCertificateStatus(EnabledValue); + public static SslEnum Enabled { get; } = new SslEnum(EnabledValue); /// is disabled. - public static SslCertificateStatus Disabled { get; } = new SslCertificateStatus(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(SslCertificateStatus left, SslCertificateStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(SslCertificateStatus left, SslCertificateStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator SslCertificateStatus(string value) => new SslCertificateStatus(value); + public static SslEnum Disabled { get; } = new SslEnum(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(SslEnum left, SslEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SslEnum left, SslEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SslEnum(string value) => new SslEnum(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is SslCertificateStatus other && Equals(other); + public override bool Equals(object obj) => obj is SslEnum other && Equals(other); /// - public bool Equals(SslCertificateStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(SslEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.Serialization.cs similarity index 63% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.Serialization.cs index 8526e3844272..e9f9f7ceea7b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class AvsSubscriptionTrialAvailabilityResult : IUtf8JsonSerializable, IJsonModel + public partial class Trial : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter wri /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsSubscriptionTrialAvailabilityResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(Trial)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Status)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AvsSubscriptionTrialAvailabilityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + Trial IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsSubscriptionTrialAvailabilityResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(Trial)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsSubscriptionTrialAvailabilityResult(document.RootElement, options); + return DeserializeTrial(document.RootElement, options); } - internal static AvsSubscriptionTrialAvailabilityResult DeserializeAvsSubscriptionTrialAvailabilityResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static Trial DeserializeTrial(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,7 +81,7 @@ internal static AvsSubscriptionTrialAvailabilityResult DeserializeAvsSubscriptio { return null; } - AvsSubscriptionTrialStatus? status = default; + TrialStatus? status = default; int? availableHosts = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -93,7 +93,7 @@ internal static AvsSubscriptionTrialAvailabilityResult DeserializeAvsSubscriptio { continue; } - status = new AvsSubscriptionTrialStatus(property.Value.GetString()); + status = new TrialStatus(property.Value.GetString()); continue; } if (property.NameEquals("availableHosts"u8)) @@ -111,38 +111,38 @@ internal static AvsSubscriptionTrialAvailabilityResult DeserializeAvsSubscriptio } } serializedAdditionalRawData = rawDataDictionary; - return new AvsSubscriptionTrialAvailabilityResult(status, availableHosts, serializedAdditionalRawData); + return new Trial(status, availableHosts, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsSubscriptionTrialAvailabilityResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(Trial)} does not support writing '{options.Format}' format."); } } - AvsSubscriptionTrialAvailabilityResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + Trial IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsSubscriptionTrialAvailabilityResult(document.RootElement, options); + return DeserializeTrial(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsSubscriptionTrialAvailabilityResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(Trial)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.cs similarity index 79% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.cs index 06d1477d4a8b..20c61644134e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsSubscriptionTrialAvailabilityResult.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// Subscription trial availability. - public partial class AvsSubscriptionTrialAvailabilityResult + public partial class Trial { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class AvsSubscriptionTrialAvailabilityResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal AvsSubscriptionTrialAvailabilityResult() + /// Initializes a new instance of . + internal Trial() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Trial status. /// Number of trial hosts available. /// Keeps track of any properties unknown to the library. - internal AvsSubscriptionTrialAvailabilityResult(AvsSubscriptionTrialStatus? status, int? availableHosts, IDictionary serializedAdditionalRawData) + internal Trial(TrialStatus? status, int? availableHosts, IDictionary serializedAdditionalRawData) { Status = status; AvailableHosts = availableHosts; @@ -62,7 +62,7 @@ internal AvsSubscriptionTrialAvailabilityResult(AvsSubscriptionTrialStatus? stat } /// Trial status. - public AvsSubscriptionTrialStatus? Status { get; } + public TrialStatus? Status { get; } /// Number of trial hosts available. public int? AvailableHosts { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/TrialStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/TrialStatus.cs new file mode 100644 index 000000000000..88d1d7b56954 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/TrialStatus.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// trial status. + public readonly partial struct TrialStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TrialStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrialAvailableValue = "TrialAvailable"; + private const string TrialUsedValue = "TrialUsed"; + private const string TrialDisabledValue = "TrialDisabled"; + + /// is available. + public static TrialStatus TrialAvailable { get; } = new TrialStatus(TrialAvailableValue); + /// is used. + public static TrialStatus TrialUsed { get; } = new TrialStatus(TrialUsedValue); + /// is disabled. + public static TrialStatus TrialDisabled { get; } = new TrialStatus(TrialDisabledValue); + /// Determines if two values are the same. + public static bool operator ==(TrialStatus left, TrialStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TrialStatus left, TrialStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TrialStatus(string value) => new TrialStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TrialStatus other && Equals(other); + /// + public bool Equals(TrialStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.Serialization.cs index aa05650ec0d2..b005b1a5c2a6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - internal partial class UnknownAddonProperties : IUtf8JsonSerializable, IJsonModel + internal partial class UnknownAddonProperties : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,25 +28,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AddonProperties)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); } - AvsPrivateCloudAddonProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AddonProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AddonProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudAddonProperties(document.RootElement, options); + return DeserializeAddonProperties(document.RootElement, options); } internal static UnknownAddonProperties DeserializeUnknownAddonProperties(JsonElement element, ModelReaderWriterOptions options = null) @@ -86,35 +86,35 @@ internal static UnknownAddonProperties DeserializeUnknownAddonProperties(JsonEle return new UnknownAddonProperties(addonType, provisioningState, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AddonProperties)} does not support writing '{options.Format}' format."); } } - AvsPrivateCloudAddonProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AddonProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsPrivateCloudAddonProperties(document.RootElement, options); + return DeserializeAddonProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AddonProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.cs index 8288a6d5621c..b7dae0f15961 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownAddonProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// Unknown version of AddonProperties. - internal partial class UnknownAddonProperties : AvsPrivateCloudAddonProperties + internal partial class UnknownAddonProperties : AddonProperties { /// Initializes a new instance of . /// Addon type. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownHostProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownHostProperties.Serialization.cs new file mode 100644 index 000000000000..09818cb21787 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownHostProperties.Serialization.cs @@ -0,0 +1,162 @@ +// 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.Avs.Models +{ + internal partial class UnknownHostProperties : 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 override 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(HostProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + HostProperties 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(HostProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHostProperties(document.RootElement, options); + } + + internal static UnknownHostProperties DeserializeUnknownHostProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HostKind kind = "Unknown"; + HostProvisioningState? provisioningState = default; + string displayName = default; + string moRefId = default; + string fqdn = default; + HostMaintenance? maintenance = default; + string faultDomain = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new HostKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new HostProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("moRefId"u8)) + { + moRefId = property.Value.GetString(); + continue; + } + if (property.NameEquals("fqdn"u8)) + { + fqdn = property.Value.GetString(); + continue; + } + if (property.NameEquals("maintenance"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maintenance = new HostMaintenance(property.Value.GetString()); + continue; + } + if (property.NameEquals("faultDomain"u8)) + { + faultDomain = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownHostProperties( + kind, + provisioningState, + displayName, + moRefId, + fqdn, + maintenance, + faultDomain, + 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); + default: + throw new FormatException($"The model {nameof(HostProperties)} does not support writing '{options.Format}' format."); + } + } + + HostProperties 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 DeserializeHostProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HostProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownHostProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownHostProperties.cs new file mode 100644 index 000000000000..1b29250f2e67 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownHostProperties.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Unknown version of HostProperties. + internal partial class UnknownHostProperties : HostProperties + { + /// Initializes a new instance of . + /// The kind of host. + /// The state of the host provisioning. + /// Display name of the host in VMware vCenter. + /// vCenter managed object reference ID of the host. + /// Fully qualified domain name of the host. + /// If provided, the host is in maintenance. The value is the reason for maintenance. + /// + /// Keeps track of any properties unknown to the library. + internal UnknownHostProperties(HostKind kind, HostProvisioningState? provisioningState, string displayName, string moRefId, string fqdn, HostMaintenance? maintenance, string faultDomain, IDictionary serializedAdditionalRawData) : base(kind, provisioningState, displayName, moRefId, fqdn, maintenance, faultDomain, serializedAdditionalRawData) + { + Kind = kind; + } + + /// Initializes a new instance of for deserialization. + internal UnknownHostProperties() + { + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.cs index 9c3dbe6cf8df..d1c78222800a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownPlacementPolicyProperties.cs @@ -14,14 +14,14 @@ namespace Azure.ResourceManager.Avs.Models internal partial class UnknownPlacementPolicyProperties : PlacementPolicyProperties { /// Initializes a new instance of . - /// Placement Policy type. + /// Placement Policy type. /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. /// The provisioning state. /// Keeps track of any properties unknown to the library. - internal UnknownPlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(policyType, state, displayName, provisioningState, serializedAdditionalRawData) + internal UnknownPlacementPolicyProperties(PlacementPolicyType type, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(type, state, displayName, provisioningState, serializedAdditionalRawData) { - PolicyType = policyType; + Type = type; } /// Initializes a new instance of for deserialization. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.Serialization.cs index d7b866b72cd8..c78768414b07 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - internal partial class UnknownScriptExecutionParameter : IUtf8JsonSerializable, IJsonModel + internal partial class UnknownScriptExecutionParameter : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,25 +28,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ScriptExecutionParameterDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ScriptExecutionParameter)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); } - ScriptExecutionParameterDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ScriptExecutionParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ScriptExecutionParameterDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ScriptExecutionParameter)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeScriptExecutionParameterDetails(document.RootElement, options); + return DeserializeScriptExecutionParameter(document.RootElement, options); } internal static UnknownScriptExecutionParameter DeserializeUnknownScriptExecutionParameter(JsonElement element, ModelReaderWriterOptions options = null) @@ -82,35 +82,35 @@ internal static UnknownScriptExecutionParameter DeserializeUnknownScriptExecutio return new UnknownScriptExecutionParameter(type, name, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ScriptExecutionParameterDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ScriptExecutionParameter)} does not support writing '{options.Format}' format."); } } - ScriptExecutionParameterDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ScriptExecutionParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeScriptExecutionParameterDetails(document.RootElement, options); + return DeserializeScriptExecutionParameter(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ScriptExecutionParameterDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ScriptExecutionParameter)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.cs index c75b63f7cc41..5fb433e5744b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/UnknownScriptExecutionParameter.cs @@ -11,15 +11,15 @@ namespace Azure.ResourceManager.Avs.Models { /// Unknown version of ScriptExecutionParameter. - internal partial class UnknownScriptExecutionParameter : ScriptExecutionParameterDetails + internal partial class UnknownScriptExecutionParameter : ScriptExecutionParameter { /// Initializes a new instance of . - /// script execution parameter type. + /// script execution parameter type. /// The parameter name. /// Keeps track of any properties unknown to the library. - internal UnknownScriptExecutionParameter(ScriptExecutionParameterType parameterType, string name, IDictionary serializedAdditionalRawData) : base(parameterType, name, serializedAdditionalRawData) + internal UnknownScriptExecutionParameter(ScriptExecutionParameterType type, string name, IDictionary serializedAdditionalRawData) : base(type, name, serializedAdditionalRawData) { - ParameterType = parameterType; + Type = type; } /// Initializes a new instance of for deserialization. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineProperties.Serialization.cs new file mode 100644 index 000000000000..5c5e7380667f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineProperties.Serialization.cs @@ -0,0 +1,187 @@ +// 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.Avs.Models +{ + public partial class VirtualMachineProperties : 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(VirtualMachineProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (options.Format != "W" && Optional.IsDefined(MoRefId)) + { + writer.WritePropertyName("moRefId"u8); + writer.WriteStringValue(MoRefId); + } + if (options.Format != "W" && Optional.IsDefined(FolderPath)) + { + writer.WritePropertyName("folderPath"u8); + writer.WriteStringValue(FolderPath); + } + if (options.Format != "W" && Optional.IsDefined(RestrictMovement)) + { + writer.WritePropertyName("restrictMovement"u8); + writer.WriteStringValue(RestrictMovement.Value.ToString()); + } + 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 + } + } + } + + VirtualMachineProperties 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(VirtualMachineProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineProperties(document.RootElement, options); + } + + internal static VirtualMachineProperties DeserializeVirtualMachineProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VirtualMachineProvisioningState? provisioningState = default; + string displayName = default; + string moRefId = default; + string folderPath = default; + VirtualMachineRestrictMovementState? restrictMovement = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new VirtualMachineProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("moRefId"u8)) + { + moRefId = property.Value.GetString(); + continue; + } + if (property.NameEquals("folderPath"u8)) + { + folderPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("restrictMovement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + restrictMovement = new VirtualMachineRestrictMovementState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VirtualMachineProperties( + provisioningState, + displayName, + moRefId, + folderPath, + restrictMovement, + 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); + default: + throw new FormatException($"The model {nameof(VirtualMachineProperties)} does not support writing '{options.Format}' format."); + } + } + + VirtualMachineProperties 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 DeserializeVirtualMachineProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VirtualMachineProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineProperties.cs similarity index 66% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineProperties.cs index efefe62f2927..06427fd9835f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineProperties.cs @@ -7,17 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the AvsPrivateCloudClusterVirtualMachine data model. - /// Virtual Machine - /// - public partial class AvsPrivateCloudClusterVirtualMachineData : ResourceData + /// Virtual Machine Properties. + public partial class VirtualMachineProperties { /// /// Keeps track of any properties unknown to the library. @@ -51,23 +45,19 @@ public partial class AvsPrivateCloudClusterVirtualMachineData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public AvsPrivateCloudClusterVirtualMachineData() + /// Initializes a new instance of . + internal VirtualMachineProperties() { } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// The provisioning state of the resource. /// Display name of the VM. - /// Virtual machine managed object reference id. + /// vCenter managed object reference ID of the virtual machine. /// Path to virtual machine's folder starting from datacenter virtual machine folder. /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudClusterVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AvsVirtualMachineProvisioningState? provisioningState, string displayName, string moRefId, string folderPath, VirtualMachineRestrictMovementState? restrictMovement, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal VirtualMachineProperties(VirtualMachineProvisioningState? provisioningState, string displayName, string moRefId, string folderPath, VirtualMachineRestrictMovementState? restrictMovement, IDictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; DisplayName = displayName; @@ -78,10 +68,10 @@ internal AvsPrivateCloudClusterVirtualMachineData(ResourceIdentifier id, string } /// The provisioning state of the resource. - public AvsVirtualMachineProvisioningState? ProvisioningState { get; } + public VirtualMachineProvisioningState? ProvisioningState { get; } /// Display name of the VM. public string DisplayName { get; } - /// Virtual machine managed object reference id. + /// vCenter managed object reference ID of the virtual machine. public string MoRefId { get; } /// Path to virtual machine's folder starting from datacenter virtual machine folder. public string FolderPath { get; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineProvisioningState.cs new file mode 100644 index 000000000000..8e2c48b64eec --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Virtual Machine provisioning state. + public readonly partial struct VirtualMachineProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VirtualMachineProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static VirtualMachineProvisioningState Succeeded { get; } = new VirtualMachineProvisioningState(SucceededValue); + /// Resource creation failed. + public static VirtualMachineProvisioningState Failed { get; } = new VirtualMachineProvisioningState(FailedValue); + /// Resource creation was canceled. + public static VirtualMachineProvisioningState Canceled { get; } = new VirtualMachineProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(VirtualMachineProvisioningState left, VirtualMachineProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VirtualMachineProvisioningState left, VirtualMachineProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VirtualMachineProvisioningState(string value) => new VirtualMachineProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VirtualMachineProvisioningState other && Equals(other); + /// + public bool Equals(VirtualMachineProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.Serialization.cs similarity index 59% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.Serialization.cs index 654410980b33..04a6d626a47a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class AvsPrivateCloudClusterVirtualMachineRestrictMovement : IUtf8JsonSerializable, IJsonModel + public partial class VirtualMachineRestrictMovement : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8 /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterVirtualMachineRestrictMovement)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VirtualMachineRestrictMovement)} does not support writing '{format}' format."); } if (Optional.IsDefined(RestrictMovement)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AvsPrivateCloudClusterVirtualMachineRestrictMovement IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VirtualMachineRestrictMovement IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterVirtualMachineRestrictMovement)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VirtualMachineRestrictMovement)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudClusterVirtualMachineRestrictMovement(document.RootElement, options); + return DeserializeVirtualMachineRestrictMovement(document.RootElement, options); } - internal static AvsPrivateCloudClusterVirtualMachineRestrictMovement DeserializeAvsPrivateCloudClusterVirtualMachineRestrictMovement(JsonElement element, ModelReaderWriterOptions options = null) + internal static VirtualMachineRestrictMovement DeserializeVirtualMachineRestrictMovement(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -96,38 +96,38 @@ internal static AvsPrivateCloudClusterVirtualMachineRestrictMovement Deserialize } } serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudClusterVirtualMachineRestrictMovement(restrictMovement, serializedAdditionalRawData); + return new VirtualMachineRestrictMovement(restrictMovement, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterVirtualMachineRestrictMovement)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VirtualMachineRestrictMovement)} does not support writing '{options.Format}' format."); } } - AvsPrivateCloudClusterVirtualMachineRestrictMovement IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VirtualMachineRestrictMovement IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsPrivateCloudClusterVirtualMachineRestrictMovement(document.RootElement, options); + return DeserializeVirtualMachineRestrictMovement(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsPrivateCloudClusterVirtualMachineRestrictMovement)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VirtualMachineRestrictMovement)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.cs similarity index 79% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.cs index 2b93d13f3160..98f725d3a083 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvsPrivateCloudClusterVirtualMachineRestrictMovement.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Avs.Models { /// Set VM DRS-driven movement to restricted (enabled) or not (disabled). - public partial class AvsPrivateCloudClusterVirtualMachineRestrictMovement + public partial class VirtualMachineRestrictMovement { /// /// Keeps track of any properties unknown to the library. @@ -45,15 +45,15 @@ public partial class AvsPrivateCloudClusterVirtualMachineRestrictMovement /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public AvsPrivateCloudClusterVirtualMachineRestrictMovement() + /// Initializes a new instance of . + public VirtualMachineRestrictMovement() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). /// Keeps track of any properties unknown to the library. - internal AvsPrivateCloudClusterVirtualMachineRestrictMovement(VirtualMachineRestrictMovementState? restrictMovement, IDictionary serializedAdditionalRawData) + internal VirtualMachineRestrictMovement(VirtualMachineRestrictMovementState? restrictMovement, IDictionary serializedAdditionalRawData) { RestrictMovement = restrictMovement; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs index d672b2e88ab3..40aed2854fe6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs @@ -83,7 +83,7 @@ internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement e { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement e { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(AvsPrivateCloudClusterVirtualMachineData.DeserializeAvsPrivateCloudClusterVirtualMachineData(item, options)); + array.Add(VirtualMachineData.DeserializeVirtualMachineData(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs index 5fd2fe12a7e8..85c098100b64 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs @@ -49,7 +49,7 @@ internal partial class VirtualMachinesList /// Initializes a new instance of . /// The VirtualMachine items on this page. /// is null. - internal VirtualMachinesList(IEnumerable value) + internal VirtualMachinesList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal VirtualMachinesList(IEnumerable The VirtualMachine items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal VirtualMachinesList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal VirtualMachinesList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal VirtualMachinesList() } /// The VirtualMachine items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VisibilityParameterEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VisibilityParameterEnum.cs new file mode 100644 index 000000000000..1b74a7f4912e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VisibilityParameterEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Visibility Parameter. + public readonly partial struct VisibilityParameterEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VisibilityParameterEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string VisibleValue = "Visible"; + private const string HiddenValue = "Hidden"; + + /// is visible. + public static VisibilityParameterEnum Visible { get; } = new VisibilityParameterEnum(VisibleValue); + /// is hidden. + public static VisibilityParameterEnum Hidden { get; } = new VisibilityParameterEnum(HiddenValue); + /// Determines if two values are the same. + public static bool operator ==(VisibilityParameterEnum left, VisibilityParameterEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VisibilityParameterEnum left, VisibilityParameterEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VisibilityParameterEnum(string value) => new VisibilityParameterEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VisibilityParameterEnum other && Equals(other); + /// + public bool Equals(VisibilityParameterEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmGroupStatusEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmGroupStatusEnum.cs new file mode 100644 index 000000000000..bcfd8b360b74 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmGroupStatusEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// VM group status. + public readonly partial struct VmGroupStatusEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VmGroupStatusEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SUCCESSValue = "SUCCESS"; + private const string FAILUREValue = "FAILURE"; + + /// is success. + public static VmGroupStatusEnum SUCCESS { get; } = new VmGroupStatusEnum(SUCCESSValue); + /// is failure. + public static VmGroupStatusEnum FAILURE { get; } = new VmGroupStatusEnum(FAILUREValue); + /// Determines if two values are the same. + public static bool operator ==(VmGroupStatusEnum left, VmGroupStatusEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VmGroupStatusEnum left, VmGroupStatusEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VmGroupStatusEnum(string value) => new VmGroupStatusEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VmGroupStatusEnum other && Equals(other); + /// + public bool Equals(VmGroupStatusEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyAffinityStrength.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyAffinityStrength.cs deleted file mode 100644 index d8f6ef880e89..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyAffinityStrength.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Affinity Strength. - public readonly partial struct VmHostPlacementPolicyAffinityStrength : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public VmHostPlacementPolicyAffinityStrength(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ShouldValue = "Should"; - private const string MustValue = "Must"; - - /// is should. - public static VmHostPlacementPolicyAffinityStrength Should { get; } = new VmHostPlacementPolicyAffinityStrength(ShouldValue); - /// is must. - public static VmHostPlacementPolicyAffinityStrength Must { get; } = new VmHostPlacementPolicyAffinityStrength(MustValue); - /// Determines if two values are the same. - public static bool operator ==(VmHostPlacementPolicyAffinityStrength left, VmHostPlacementPolicyAffinityStrength right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(VmHostPlacementPolicyAffinityStrength left, VmHostPlacementPolicyAffinityStrength right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator VmHostPlacementPolicyAffinityStrength(string value) => new VmHostPlacementPolicyAffinityStrength(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is VmHostPlacementPolicyAffinityStrength other && Equals(other); - /// - public bool Equals(VmHostPlacementPolicyAffinityStrength other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs index de296ab4d7c8..208da1d46b81 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs @@ -39,11 +39,6 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteStartArray(); foreach (var item in VmMembers) { - if (item == null) - { - writer.WriteNullValue(); - continue; - } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -88,10 +83,10 @@ internal static VmHostPlacementPolicyProperties DeserializeVmHostPlacementPolicy { return null; } - IList vmMembers = default; + IList vmMembers = default; IList hostMembers = default; - AvsPlacementPolicyAffinityType affinityType = default; - VmHostPlacementPolicyAffinityStrength? affinityStrength = default; + AffinityType affinityType = default; + AffinityStrength? affinityStrength = default; AzureHybridBenefitType? azureHybridBenefitType = default; PlacementPolicyType type = default; PlacementPolicyState? state = default; @@ -103,17 +98,10 @@ internal static VmHostPlacementPolicyProperties DeserializeVmHostPlacementPolicy { if (property.NameEquals("vmMembers"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(new ResourceIdentifier(item.GetString())); - } + array.Add(item.GetString()); } vmMembers = array; continue; @@ -130,7 +118,7 @@ internal static VmHostPlacementPolicyProperties DeserializeVmHostPlacementPolicy } if (property.NameEquals("affinityType"u8)) { - affinityType = new AvsPlacementPolicyAffinityType(property.Value.GetString()); + affinityType = new AffinityType(property.Value.GetString()); continue; } if (property.NameEquals("affinityStrength"u8)) @@ -139,7 +127,7 @@ internal static VmHostPlacementPolicyProperties DeserializeVmHostPlacementPolicy { continue; } - affinityStrength = new VmHostPlacementPolicyAffinityStrength(property.Value.GetString()); + affinityStrength = new AffinityStrength(property.Value.GetString()); continue; } if (property.NameEquals("azureHybridBenefitType"u8)) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs index 9ff0fec0165c..e107c4499cf7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Azure.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,7 +19,7 @@ public partial class VmHostPlacementPolicyProperties : PlacementPolicyProperties /// Host members list. /// placement policy affinity type. /// or is null. - public VmHostPlacementPolicyProperties(IEnumerable vmMembers, IEnumerable hostMembers, AvsPlacementPolicyAffinityType affinityType) + public VmHostPlacementPolicyProperties(IEnumerable vmMembers, IEnumerable hostMembers, AffinityType affinityType) { Argument.AssertNotNull(vmMembers, nameof(vmMembers)); Argument.AssertNotNull(hostMembers, nameof(hostMembers)); @@ -28,11 +27,11 @@ public VmHostPlacementPolicyProperties(IEnumerable vmMembers VmMembers = vmMembers.ToList(); HostMembers = hostMembers.ToList(); AffinityType = affinityType; - PolicyType = PlacementPolicyType.VmHost; + Type = PlacementPolicyType.VmHost; } /// Initializes a new instance of . - /// Placement Policy type. + /// Placement Policy type. /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. /// The provisioning state. @@ -42,14 +41,14 @@ public VmHostPlacementPolicyProperties(IEnumerable vmMembers /// placement policy affinity type. /// vm-host placement policy affinity strength (should/must). /// placement policy azure hybrid benefit opt-in type. - internal VmHostPlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData, IList vmMembers, IList hostMembers, AvsPlacementPolicyAffinityType affinityType, VmHostPlacementPolicyAffinityStrength? affinityStrength, AzureHybridBenefitType? azureHybridBenefitType) : base(policyType, state, displayName, provisioningState, serializedAdditionalRawData) + internal VmHostPlacementPolicyProperties(PlacementPolicyType type, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData, IList vmMembers, IList hostMembers, AffinityType affinityType, AffinityStrength? affinityStrength, AzureHybridBenefitType? azureHybridBenefitType) : base(type, state, displayName, provisioningState, serializedAdditionalRawData) { VmMembers = vmMembers; HostMembers = hostMembers; AffinityType = affinityType; AffinityStrength = affinityStrength; AzureHybridBenefitType = azureHybridBenefitType; - PolicyType = policyType; + Type = type; } /// Initializes a new instance of for deserialization. @@ -58,13 +57,13 @@ internal VmHostPlacementPolicyProperties() } /// Virtual machine members list. - public IList VmMembers { get; } + public IList VmMembers { get; } /// Host members list. public IList HostMembers { get; } /// placement policy affinity type. - public AvsPlacementPolicyAffinityType AffinityType { get; set; } + public AffinityType AffinityType { get; set; } /// vm-host placement policy affinity strength (should/must). - public VmHostPlacementPolicyAffinityStrength? AffinityStrength { get; set; } + public AffinityStrength? AffinityStrength { get; set; } /// placement policy azure hybrid benefit opt-in type. public AzureHybridBenefitType? AzureHybridBenefitType { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmTypeEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmTypeEnum.cs new file mode 100644 index 000000000000..cdf5dc998bab --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmTypeEnum.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// VM type. + public readonly partial struct VmTypeEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VmTypeEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string REGULARValue = "REGULAR"; + private const string EDGEValue = "EDGE"; + private const string SERVICEValue = "SERVICE"; + + /// is regular. + public static VmTypeEnum REGULAR { get; } = new VmTypeEnum(REGULARValue); + /// is edge. + public static VmTypeEnum EDGE { get; } = new VmTypeEnum(EDGEValue); + /// is service. + public static VmTypeEnum SERVICE { get; } = new VmTypeEnum(SERVICEValue); + /// Determines if two values are the same. + public static bool operator ==(VmTypeEnum left, VmTypeEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VmTypeEnum left, VmTypeEnum right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VmTypeEnum(string value) => new VmTypeEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VmTypeEnum other && Equals(other); + /// + public bool Equals(VmTypeEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmVmPlacementPolicyProperties.Serialization.cs similarity index 65% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmVmPlacementPolicyProperties.Serialization.cs index d15ac9421481..32d4b325dfba 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmVmPlacementPolicyProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Avs.Models { - public partial class VmPlacementPolicyProperties : IUtf8JsonSerializable, IJsonModel + public partial class VmVmPlacementPolicyProperties : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(VmPlacementPolicyProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VmVmPlacementPolicyProperties)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -39,11 +39,6 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteStartArray(); foreach (var item in VmMembers) { - if (item == null) - { - writer.WriteNullValue(); - continue; - } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -51,19 +46,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteStringValue(AffinityType.ToString()); } - VmPlacementPolicyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VmVmPlacementPolicyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(VmPlacementPolicyProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VmVmPlacementPolicyProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeVmPlacementPolicyProperties(document.RootElement, options); + return DeserializeVmVmPlacementPolicyProperties(document.RootElement, options); } - internal static VmPlacementPolicyProperties DeserializeVmPlacementPolicyProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static VmVmPlacementPolicyProperties DeserializeVmVmPlacementPolicyProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -71,8 +66,8 @@ internal static VmPlacementPolicyProperties DeserializeVmPlacementPolicyProperti { return null; } - IList vmMembers = default; - AvsPlacementPolicyAffinityType affinityType = default; + IList vmMembers = default; + AffinityType affinityType = default; PlacementPolicyType type = default; PlacementPolicyState? state = default; string displayName = default; @@ -83,24 +78,17 @@ internal static VmPlacementPolicyProperties DeserializeVmPlacementPolicyProperti { if (property.NameEquals("vmMembers"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(new ResourceIdentifier(item.GetString())); - } + array.Add(item.GetString()); } vmMembers = array; continue; } if (property.NameEquals("affinityType"u8)) { - affinityType = new AvsPlacementPolicyAffinityType(property.Value.GetString()); + affinityType = new AffinityType(property.Value.GetString()); continue; } if (property.NameEquals("type"u8)) @@ -137,7 +125,7 @@ internal static VmPlacementPolicyProperties DeserializeVmPlacementPolicyProperti } } serializedAdditionalRawData = rawDataDictionary; - return new VmPlacementPolicyProperties( + return new VmVmPlacementPolicyProperties( type, state, displayName, @@ -147,35 +135,35 @@ internal static VmPlacementPolicyProperties DeserializeVmPlacementPolicyProperti affinityType); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(VmPlacementPolicyProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VmVmPlacementPolicyProperties)} does not support writing '{options.Format}' format."); } } - VmPlacementPolicyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VmVmPlacementPolicyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeVmPlacementPolicyProperties(document.RootElement, options); + return DeserializeVmVmPlacementPolicyProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(VmPlacementPolicyProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VmVmPlacementPolicyProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmVmPlacementPolicyProperties.cs similarity index 60% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmVmPlacementPolicyProperties.cs index 90b781cf8c56..7da171563485 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmVmPlacementPolicyProperties.cs @@ -8,49 +8,48 @@ using System; using System.Collections.Generic; using System.Linq; -using Azure.Core; namespace Azure.ResourceManager.Avs.Models { /// VM-VM placement policy properties. - public partial class VmPlacementPolicyProperties : PlacementPolicyProperties + public partial class VmVmPlacementPolicyProperties : PlacementPolicyProperties { - /// Initializes a new instance of . + /// Initializes a new instance of . /// Virtual machine members list. /// placement policy affinity type. /// is null. - public VmPlacementPolicyProperties(IEnumerable vmMembers, AvsPlacementPolicyAffinityType affinityType) + public VmVmPlacementPolicyProperties(IEnumerable vmMembers, AffinityType affinityType) { Argument.AssertNotNull(vmMembers, nameof(vmMembers)); VmMembers = vmMembers.ToList(); AffinityType = affinityType; - PolicyType = PlacementPolicyType.VmVm; + Type = PlacementPolicyType.VmVm; } - /// Initializes a new instance of . - /// Placement Policy type. + /// Initializes a new instance of . + /// Placement Policy type. /// Whether the placement policy is enabled or disabled. /// Display name of the placement policy. /// The provisioning state. /// Keeps track of any properties unknown to the library. /// Virtual machine members list. /// placement policy affinity type. - internal VmPlacementPolicyProperties(PlacementPolicyType policyType, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData, IList vmMembers, AvsPlacementPolicyAffinityType affinityType) : base(policyType, state, displayName, provisioningState, serializedAdditionalRawData) + internal VmVmPlacementPolicyProperties(PlacementPolicyType type, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData, IList vmMembers, AffinityType affinityType) : base(type, state, displayName, provisioningState, serializedAdditionalRawData) { VmMembers = vmMembers; AffinityType = affinityType; - PolicyType = policyType; + Type = type; } - /// Initializes a new instance of for deserialization. - internal VmPlacementPolicyProperties() + /// Initializes a new instance of for deserialization. + internal VmVmPlacementPolicyProperties() { } /// Virtual machine members list. - public IList VmMembers { get; } + public IList VmMembers { get; } /// placement policy affinity type. - public AvsPlacementPolicyAffinityType AffinityType { get; set; } + public AffinityType AffinityType { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.Serialization.cs new file mode 100644 index 000000000000..2d61ac764e43 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.Serialization.cs @@ -0,0 +1,154 @@ +// 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; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkDhcp : 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 override 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(WorkloadNetworkDhcp)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + WorkloadNetworkDhcp 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(WorkloadNetworkDhcp)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDhcp(document.RootElement, options); + } + + internal static WorkloadNetworkDhcp DeserializeWorkloadNetworkDhcp(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WorkloadNetworkDhcpEntity properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WorkloadNetworkDhcpEntity.DeserializeWorkloadNetworkDhcpEntity(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkDhcp( + id, + name, + type, + systemData, + properties, + 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkDhcp)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkDhcp 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 DeserializeWorkloadNetworkDhcp(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkDhcp)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs similarity index 83% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs index cc3dbd1aadea..399765f4abf8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs @@ -8,16 +8,12 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the WorkloadNetworkDhcp data model. - /// NSX DHCP - /// - public partial class WorkloadNetworkDhcpData : ResourceData + /// NSX DHCP. + public partial class WorkloadNetworkDhcp : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,12 +47,12 @@ public partial class WorkloadNetworkDhcpData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public WorkloadNetworkDhcpData() + /// Initializes a new instance of . + public WorkloadNetworkDhcp() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -67,7 +63,7 @@ public WorkloadNetworkDhcpData() /// The available derived classes include and . /// /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkDhcpData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkDhcpEntity properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal WorkloadNetworkDhcp(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkDhcpEntity properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs index 982e9a432cf5..e5de31d0f070 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs @@ -83,7 +83,7 @@ internal static WorkloadNetworkDhcpList DeserializeWorkloadNetworkDhcpList(JsonE { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static WorkloadNetworkDhcpList DeserializeWorkloadNetworkDhcpList(JsonE { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(item, options)); + array.Add(WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs index e96fb124ba1e..52d0b984586a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs @@ -49,7 +49,7 @@ internal partial class WorkloadNetworkDhcpList /// Initializes a new instance of . /// The WorkloadNetworkDhcp items on this page. /// is null. - internal WorkloadNetworkDhcpList(IEnumerable value) + internal WorkloadNetworkDhcpList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal WorkloadNetworkDhcpList(IEnumerable value) /// The WorkloadNetworkDhcp items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkDhcpList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal WorkloadNetworkDhcpList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal WorkloadNetworkDhcpList() } /// The WorkloadNetworkDhcp items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs index 76dd79b838df..163f96ee1593 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs @@ -17,7 +17,7 @@ public partial class WorkloadNetworkDhcpRelay : WorkloadNetworkDhcpEntity public WorkloadNetworkDhcpRelay() { ServerAddresses = new ChangeTrackingList(); - DhcpType = DhcpTypeEnum.Relay; + DhcpType = DhcpTypeEnum.RELAY; } /// Initializes a new instance of . diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs index 6b14f44d6c3b..4e9d275013f2 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs @@ -16,7 +16,7 @@ public partial class WorkloadNetworkDhcpServer : WorkloadNetworkDhcpEntity /// Initializes a new instance of . public WorkloadNetworkDhcpServer() { - DhcpType = DhcpTypeEnum.Server; + DhcpType = DhcpTypeEnum.SERVER; } /// Initializes a new instance of . diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.Serialization.cs new file mode 100644 index 000000000000..959f6fafb813 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.Serialization.cs @@ -0,0 +1,154 @@ +// 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; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkDnsService : 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 override 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(WorkloadNetworkDnsService)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + WorkloadNetworkDnsService 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(WorkloadNetworkDnsService)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDnsService(document.RootElement, options); + } + + internal static WorkloadNetworkDnsService DeserializeWorkloadNetworkDnsService(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WorkloadNetworkDnsServiceProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WorkloadNetworkDnsServiceProperties.DeserializeWorkloadNetworkDnsServiceProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkDnsService( + id, + name, + type, + systemData, + properties, + 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkDnsService)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkDnsService 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 DeserializeWorkloadNetworkDnsService(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkDnsService)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.cs new file mode 100644 index 000000000000..102e4def74e9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX DNS Service. + public partial class WorkloadNetworkDnsService : ResourceData + { + /// + /// 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 . + public WorkloadNetworkDnsService() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDnsService(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkDnsServiceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public WorkloadNetworkDnsServiceProperties Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceProperties.Serialization.cs new file mode 100644 index 000000000000..c72cfc0c20bb --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceProperties.Serialization.cs @@ -0,0 +1,245 @@ +// 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.Avs.Models +{ + public partial class WorkloadNetworkDnsServiceProperties : 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(WorkloadNetworkDnsServiceProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(DnsServiceIP)) + { + writer.WritePropertyName("dnsServiceIp"u8); + writer.WriteStringValue(DnsServiceIP); + } + if (Optional.IsDefined(DefaultDnsZone)) + { + writer.WritePropertyName("defaultDnsZone"u8); + writer.WriteStringValue(DefaultDnsZone); + } + if (Optional.IsCollectionDefined(FqdnZones)) + { + writer.WritePropertyName("fqdnZones"u8); + writer.WriteStartArray(); + foreach (var item in FqdnZones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(LogLevel)) + { + writer.WritePropertyName("logLevel"u8); + writer.WriteStringValue(LogLevel.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"u8); + writer.WriteNumberValue(Revision.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 + } + } + } + + WorkloadNetworkDnsServiceProperties 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(WorkloadNetworkDnsServiceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDnsServiceProperties(document.RootElement, options); + } + + internal static WorkloadNetworkDnsServiceProperties DeserializeWorkloadNetworkDnsServiceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + string dnsServiceIP = default; + string defaultDnsZone = default; + IList fqdnZones = default; + DnsServiceLogLevelEnum? logLevel = default; + DnsServiceStatusEnum? status = default; + WorkloadNetworkDnsServiceProvisioningState? provisioningState = default; + long? revision = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("dnsServiceIp"u8)) + { + dnsServiceIP = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultDnsZone"u8)) + { + defaultDnsZone = property.Value.GetString(); + continue; + } + if (property.NameEquals("fqdnZones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + fqdnZones = array; + continue; + } + if (property.NameEquals("logLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logLevel = new DnsServiceLogLevelEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new DnsServiceStatusEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new WorkloadNetworkDnsServiceProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("revision"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + revision = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkDnsServiceProperties( + displayName, + dnsServiceIP, + defaultDnsZone, + fqdnZones ?? new ChangeTrackingList(), + logLevel, + status, + provisioningState, + revision, + 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkDnsServiceProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkDnsServiceProperties 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 DeserializeWorkloadNetworkDnsServiceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkDnsServiceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceProperties.cs similarity index 73% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceProperties.cs index 7ce5749e1356..1a0537621d7f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceProperties.cs @@ -7,18 +7,11 @@ using System; using System.Collections.Generic; -using System.Net; -using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the WorkloadNetworkDnsService data model. - /// NSX DNS Service - /// - public partial class WorkloadNetworkDnsServiceData : ResourceData + /// NSX DNS Service Properties. + public partial class WorkloadNetworkDnsServiceProperties { /// /// Keeps track of any properties unknown to the library. @@ -52,17 +45,13 @@ public partial class WorkloadNetworkDnsServiceData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public WorkloadNetworkDnsServiceData() + /// Initializes a new instance of . + public WorkloadNetworkDnsServiceProperties() { FqdnZones = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// Display name of the DNS Service. /// DNS service IP of the DNS Service. /// Default DNS zone of the DNS Service. @@ -72,7 +61,7 @@ public WorkloadNetworkDnsServiceData() /// The provisioning state. /// NSX revision number. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkDnsServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IPAddress dnsServiceIP, string defaultDnsZone, IList fqdnZones, DnsServiceLogLevel? logLevel, DnsServiceStatus? status, WorkloadNetworkDnsServiceProvisioningState? provisioningState, long? revision, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal WorkloadNetworkDnsServiceProperties(string displayName, string dnsServiceIP, string defaultDnsZone, IList fqdnZones, DnsServiceLogLevelEnum? logLevel, DnsServiceStatusEnum? status, WorkloadNetworkDnsServiceProvisioningState? provisioningState, long? revision, IDictionary serializedAdditionalRawData) { DisplayName = displayName; DnsServiceIP = dnsServiceIP; @@ -88,15 +77,15 @@ internal WorkloadNetworkDnsServiceData(ResourceIdentifier id, string name, Resou /// Display name of the DNS Service. public string DisplayName { get; set; } /// DNS service IP of the DNS Service. - public IPAddress DnsServiceIP { get; set; } + public string DnsServiceIP { get; set; } /// Default DNS zone of the DNS Service. public string DefaultDnsZone { get; set; } /// FQDN zones of the DNS Service. public IList FqdnZones { get; } /// DNS Service log level. - public DnsServiceLogLevel? LogLevel { get; set; } + public DnsServiceLogLevelEnum? LogLevel { get; set; } /// DNS Service status. - public DnsServiceStatus? Status { get; } + public DnsServiceStatusEnum? Status { get; } /// The provisioning state. public WorkloadNetworkDnsServiceProvisioningState? ProvisioningState { get; } /// NSX revision number. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs index c8d2f409bf38..e450da0a36d3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs @@ -83,7 +83,7 @@ internal static WorkloadNetworkDnsServicesList DeserializeWorkloadNetworkDnsServ { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static WorkloadNetworkDnsServicesList DeserializeWorkloadNetworkDnsServ { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(item, options)); + array.Add(WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs index 9e4bbbf3938d..fc6cdf7cfb1f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs @@ -49,7 +49,7 @@ internal partial class WorkloadNetworkDnsServicesList /// Initializes a new instance of . /// The WorkloadNetworkDnsService items on this page. /// is null. - internal WorkloadNetworkDnsServicesList(IEnumerable value) + internal WorkloadNetworkDnsServicesList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal WorkloadNetworkDnsServicesList(IEnumerable The WorkloadNetworkDnsService items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkDnsServicesList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal WorkloadNetworkDnsServicesList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal WorkloadNetworkDnsServicesList() } /// The WorkloadNetworkDnsService items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.Serialization.cs new file mode 100644 index 000000000000..be5a6b7410f3 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.Serialization.cs @@ -0,0 +1,154 @@ +// 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; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkDnsZone : 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 override 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(WorkloadNetworkDnsZone)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + WorkloadNetworkDnsZone 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(WorkloadNetworkDnsZone)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDnsZone(document.RootElement, options); + } + + internal static WorkloadNetworkDnsZone DeserializeWorkloadNetworkDnsZone(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WorkloadNetworkDnsZoneProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WorkloadNetworkDnsZoneProperties.DeserializeWorkloadNetworkDnsZoneProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkDnsZone( + id, + name, + type, + systemData, + properties, + 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkDnsZone)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkDnsZone 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 DeserializeWorkloadNetworkDnsZone(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkDnsZone)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.cs new file mode 100644 index 000000000000..e73d2274c9af --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX DNS Zone. + public partial class WorkloadNetworkDnsZone : ResourceData + { + /// + /// 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 . + public WorkloadNetworkDnsZone() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkDnsZone(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkDnsZoneProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public WorkloadNetworkDnsZoneProperties Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneProperties.Serialization.cs new file mode 100644 index 000000000000..411399e81132 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneProperties.Serialization.cs @@ -0,0 +1,243 @@ +// 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.Avs.Models +{ + public partial class WorkloadNetworkDnsZoneProperties : 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(WorkloadNetworkDnsZoneProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsCollectionDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStartArray(); + foreach (var item in Domain) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(DnsServerIPs)) + { + writer.WritePropertyName("dnsServerIps"u8); + writer.WriteStartArray(); + foreach (var item in DnsServerIPs) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SourceIP)) + { + writer.WritePropertyName("sourceIp"u8); + writer.WriteStringValue(SourceIP); + } + if (Optional.IsDefined(DnsServices)) + { + writer.WritePropertyName("dnsServices"u8); + writer.WriteNumberValue(DnsServices.Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"u8); + writer.WriteNumberValue(Revision.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 + } + } + } + + WorkloadNetworkDnsZoneProperties 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(WorkloadNetworkDnsZoneProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkDnsZoneProperties(document.RootElement, options); + } + + internal static WorkloadNetworkDnsZoneProperties DeserializeWorkloadNetworkDnsZoneProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + IList domain = default; + IList dnsServerIPs = default; + string sourceIP = default; + long? dnsServices = default; + WorkloadNetworkDnsZoneProvisioningState? provisioningState = default; + long? revision = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("domain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + domain = array; + continue; + } + if (property.NameEquals("dnsServerIps"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dnsServerIPs = array; + continue; + } + if (property.NameEquals("sourceIp"u8)) + { + sourceIP = property.Value.GetString(); + continue; + } + if (property.NameEquals("dnsServices"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsServices = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new WorkloadNetworkDnsZoneProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("revision"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + revision = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkDnsZoneProperties( + displayName, + domain ?? new ChangeTrackingList(), + dnsServerIPs ?? new ChangeTrackingList(), + sourceIP, + dnsServices, + provisioningState, + revision, + 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkDnsZoneProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkDnsZoneProperties 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 DeserializeWorkloadNetworkDnsZoneProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkDnsZoneProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneProperties.cs similarity index 73% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneProperties.cs index 36faf6aa2a5b..33141ba7a4ef 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneProperties.cs @@ -7,18 +7,11 @@ using System; using System.Collections.Generic; -using System.Net; -using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the WorkloadNetworkDnsZone data model. - /// NSX DNS Zone - /// - public partial class WorkloadNetworkDnsZoneData : ResourceData + /// NSX DNS Zone Properties. + public partial class WorkloadNetworkDnsZoneProperties { /// /// Keeps track of any properties unknown to the library. @@ -52,18 +45,14 @@ public partial class WorkloadNetworkDnsZoneData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public WorkloadNetworkDnsZoneData() + /// Initializes a new instance of . + public WorkloadNetworkDnsZoneProperties() { Domain = new ChangeTrackingList(); - DnsServerIPs = new ChangeTrackingList(); + DnsServerIPs = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// Display name of the DNS Zone. /// Domain names of the DNS Zone. /// DNS Server IP array of the DNS Zone. @@ -72,7 +61,7 @@ public WorkloadNetworkDnsZoneData() /// The provisioning state. /// NSX revision number. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkDnsZoneData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IList domain, IList dnsServerIPs, IPAddress sourceIP, long? dnsServices, WorkloadNetworkDnsZoneProvisioningState? provisioningState, long? revision, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal WorkloadNetworkDnsZoneProperties(string displayName, IList domain, IList dnsServerIPs, string sourceIP, long? dnsServices, WorkloadNetworkDnsZoneProvisioningState? provisioningState, long? revision, IDictionary serializedAdditionalRawData) { DisplayName = displayName; Domain = domain; @@ -89,9 +78,9 @@ internal WorkloadNetworkDnsZoneData(ResourceIdentifier id, string name, Resource /// Domain names of the DNS Zone. public IList Domain { get; } /// DNS Server IP array of the DNS Zone. - public IList DnsServerIPs { get; } + public IList DnsServerIPs { get; } /// Source IP of the DNS Zone. - public IPAddress SourceIP { get; set; } + public string SourceIP { get; set; } /// Number of DNS Services using the DNS zone. public long? DnsServices { get; set; } /// The provisioning state. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs index d1d796c7f334..7cdb188f8274 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs @@ -83,7 +83,7 @@ internal static WorkloadNetworkDnsZonesList DeserializeWorkloadNetworkDnsZonesLi { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static WorkloadNetworkDnsZonesList DeserializeWorkloadNetworkDnsZonesLi { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(item, options)); + array.Add(WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs index d4af95740ee8..deba594502d6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs @@ -49,7 +49,7 @@ internal partial class WorkloadNetworkDnsZonesList /// Initializes a new instance of . /// The WorkloadNetworkDnsZone items on this page. /// is null. - internal WorkloadNetworkDnsZonesList(IEnumerable value) + internal WorkloadNetworkDnsZonesList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal WorkloadNetworkDnsZonesList(IEnumerable val /// The WorkloadNetworkDnsZone items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkDnsZonesList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal WorkloadNetworkDnsZonesList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal WorkloadNetworkDnsZonesList() } /// The WorkloadNetworkDnsZone items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayProperties.Serialization.cs new file mode 100644 index 000000000000..52e2e3e71af9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayProperties.Serialization.cs @@ -0,0 +1,155 @@ +// 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.Avs.Models +{ + public partial class WorkloadNetworkGatewayProperties : 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(WorkloadNetworkGatewayProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (options.Format != "W" && Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + 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 + } + } + } + + WorkloadNetworkGatewayProperties 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(WorkloadNetworkGatewayProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkGatewayProperties(document.RootElement, options); + } + + internal static WorkloadNetworkGatewayProperties DeserializeWorkloadNetworkGatewayProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WorkloadNetworkProvisioningState? provisioningState = default; + string displayName = default; + string path = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new WorkloadNetworkProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("path"u8)) + { + path = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkGatewayProperties(provisioningState, displayName, path, 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkGatewayProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkGatewayProperties 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 DeserializeWorkloadNetworkGatewayProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkGatewayProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayProperties.cs new file mode 100644 index 000000000000..9d6fa400cf48 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Properties of a NSX Gateway. + public partial class WorkloadNetworkGatewayProperties + { + /// + /// 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 . + internal WorkloadNetworkGatewayProperties() + { + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// Display name of the DHCP entity. + /// NSX Gateway Path. + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkGatewayProperties(WorkloadNetworkProvisioningState? provisioningState, string displayName, string path, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + DisplayName = displayName; + Path = path; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The provisioning state of the resource. + public WorkloadNetworkProvisioningState? ProvisioningState { get; } + /// Display name of the DHCP entity. + public string DisplayName { get; } + /// NSX Gateway Path. + public string Path { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.Serialization.cs new file mode 100644 index 000000000000..4f9c4408f8f1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.Serialization.cs @@ -0,0 +1,154 @@ +// 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; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkPortMirroring : 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 override 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(WorkloadNetworkPortMirroring)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + WorkloadNetworkPortMirroring 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(WorkloadNetworkPortMirroring)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkPortMirroring(document.RootElement, options); + } + + internal static WorkloadNetworkPortMirroring DeserializeWorkloadNetworkPortMirroring(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WorkloadNetworkPortMirroringProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WorkloadNetworkPortMirroringProperties.DeserializeWorkloadNetworkPortMirroringProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkPortMirroring( + id, + name, + type, + systemData, + properties, + 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkPortMirroring)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkPortMirroring 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 DeserializeWorkloadNetworkPortMirroring(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkPortMirroring)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs new file mode 100644 index 000000000000..a1a8a0bd71b7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX Port Mirroring. + public partial class WorkloadNetworkPortMirroring : ResourceData + { + /// + /// 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 . + public WorkloadNetworkPortMirroring() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkPortMirroring(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkPortMirroringProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public WorkloadNetworkPortMirroringProperties Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs index 5a986faa470b..d1f06c0e1995 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs @@ -83,7 +83,7 @@ internal static WorkloadNetworkPortMirroringList DeserializeWorkloadNetworkPortM { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static WorkloadNetworkPortMirroringList DeserializeWorkloadNetworkPortM { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkPortMirroringProfileData.DeserializeWorkloadNetworkPortMirroringProfileData(item, options)); + array.Add(WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs index 5077aff247f2..3c8ed576daf6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs @@ -49,7 +49,7 @@ internal partial class WorkloadNetworkPortMirroringList /// Initializes a new instance of . /// The WorkloadNetworkPortMirroring items on this page. /// is null. - internal WorkloadNetworkPortMirroringList(IEnumerable value) + internal WorkloadNetworkPortMirroringList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal WorkloadNetworkPortMirroringList(IEnumerable The WorkloadNetworkPortMirroring items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkPortMirroringList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal WorkloadNetworkPortMirroringList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal WorkloadNetworkPortMirroringList() } /// The WorkloadNetworkPortMirroring items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProperties.Serialization.cs new file mode 100644 index 000000000000..6d9b10312d65 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProperties.Serialization.cs @@ -0,0 +1,219 @@ +// 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.Avs.Models +{ + public partial class WorkloadNetworkPortMirroringProperties : 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(WorkloadNetworkPortMirroringProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Direction)) + { + writer.WritePropertyName("direction"u8); + writer.WriteStringValue(Direction.Value.ToString()); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + writer.WriteStringValue(Source); + } + if (Optional.IsDefined(Destination)) + { + writer.WritePropertyName("destination"u8); + writer.WriteStringValue(Destination); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"u8); + writer.WriteNumberValue(Revision.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 + } + } + } + + WorkloadNetworkPortMirroringProperties 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(WorkloadNetworkPortMirroringProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkPortMirroringProperties(document.RootElement, options); + } + + internal static WorkloadNetworkPortMirroringProperties DeserializeWorkloadNetworkPortMirroringProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + PortMirroringDirectionEnum? direction = default; + string source = default; + string destination = default; + PortMirroringStatusEnum? status = default; + WorkloadNetworkPortMirroringProvisioningState? provisioningState = default; + long? revision = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("direction"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + direction = new PortMirroringDirectionEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("source"u8)) + { + source = property.Value.GetString(); + continue; + } + if (property.NameEquals("destination"u8)) + { + destination = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new PortMirroringStatusEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new WorkloadNetworkPortMirroringProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("revision"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + revision = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkPortMirroringProperties( + displayName, + direction, + source, + destination, + status, + provisioningState, + revision, + 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkPortMirroringProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkPortMirroringProperties 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 DeserializeWorkloadNetworkPortMirroringProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkPortMirroringProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProperties.cs similarity index 69% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProperties.cs index b55c37548016..ef1078ace08d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProperties.cs @@ -7,17 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the WorkloadNetworkPortMirroringProfile data model. - /// NSX Port Mirroring - /// - public partial class WorkloadNetworkPortMirroringProfileData : ResourceData + /// NSX Port Mirroring Properties. + public partial class WorkloadNetworkPortMirroringProperties { /// /// Keeps track of any properties unknown to the library. @@ -51,16 +45,12 @@ public partial class WorkloadNetworkPortMirroringProfileData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public WorkloadNetworkPortMirroringProfileData() + /// Initializes a new instance of . + public WorkloadNetworkPortMirroringProperties() { } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// Display name of the port mirroring profile. /// Direction of port mirroring profile. /// Source VM Group. @@ -69,7 +59,7 @@ public WorkloadNetworkPortMirroringProfileData() /// The provisioning state. /// NSX revision number. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkPortMirroringProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, PortMirroringProfileDirection? direction, string source, string destination, PortMirroringProfileStatus? status, WorkloadNetworkPortMirroringProfileProvisioningState? provisioningState, long? revision, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal WorkloadNetworkPortMirroringProperties(string displayName, PortMirroringDirectionEnum? direction, string source, string destination, PortMirroringStatusEnum? status, WorkloadNetworkPortMirroringProvisioningState? provisioningState, long? revision, IDictionary serializedAdditionalRawData) { DisplayName = displayName; Direction = direction; @@ -84,15 +74,15 @@ internal WorkloadNetworkPortMirroringProfileData(ResourceIdentifier id, string n /// Display name of the port mirroring profile. public string DisplayName { get; set; } /// Direction of port mirroring profile. - public PortMirroringProfileDirection? Direction { get; set; } + public PortMirroringDirectionEnum? Direction { get; set; } /// Source VM Group. public string Source { get; set; } /// Destination VM Group. public string Destination { get; set; } /// Port Mirroring Status. - public PortMirroringProfileStatus? Status { get; } + public PortMirroringStatusEnum? Status { get; } /// The provisioning state. - public WorkloadNetworkPortMirroringProfileProvisioningState? ProvisioningState { get; } + public WorkloadNetworkPortMirroringProvisioningState? ProvisioningState { get; } /// NSX revision number. public long? Revision { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProfileProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs similarity index 51% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProfileProvisioningState.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs index f3e6f6d01ecf..b0421a88e08c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProfileProvisioningState.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.Avs.Models { /// Workload Network Port Mirroring provisioning state. - public readonly partial struct WorkloadNetworkPortMirroringProfileProvisioningState : IEquatable + public readonly partial struct WorkloadNetworkPortMirroringProvisioningState : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public WorkloadNetworkPortMirroringProfileProvisioningState(string value) + public WorkloadNetworkPortMirroringProvisioningState(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -30,29 +30,29 @@ public WorkloadNetworkPortMirroringProfileProvisioningState(string value) private const string UpdatingValue = "Updating"; /// Resource has been created. - public static WorkloadNetworkPortMirroringProfileProvisioningState Succeeded { get; } = new WorkloadNetworkPortMirroringProfileProvisioningState(SucceededValue); + public static WorkloadNetworkPortMirroringProvisioningState Succeeded { get; } = new WorkloadNetworkPortMirroringProvisioningState(SucceededValue); /// Resource creation failed. - public static WorkloadNetworkPortMirroringProfileProvisioningState Failed { get; } = new WorkloadNetworkPortMirroringProfileProvisioningState(FailedValue); + public static WorkloadNetworkPortMirroringProvisioningState Failed { get; } = new WorkloadNetworkPortMirroringProvisioningState(FailedValue); /// Resource creation was canceled. - public static WorkloadNetworkPortMirroringProfileProvisioningState Canceled { get; } = new WorkloadNetworkPortMirroringProfileProvisioningState(CanceledValue); + public static WorkloadNetworkPortMirroringProvisioningState Canceled { get; } = new WorkloadNetworkPortMirroringProvisioningState(CanceledValue); /// is building. - public static WorkloadNetworkPortMirroringProfileProvisioningState Building { get; } = new WorkloadNetworkPortMirroringProfileProvisioningState(BuildingValue); + public static WorkloadNetworkPortMirroringProvisioningState Building { get; } = new WorkloadNetworkPortMirroringProvisioningState(BuildingValue); /// is deleting. - public static WorkloadNetworkPortMirroringProfileProvisioningState Deleting { get; } = new WorkloadNetworkPortMirroringProfileProvisioningState(DeletingValue); + public static WorkloadNetworkPortMirroringProvisioningState Deleting { get; } = new WorkloadNetworkPortMirroringProvisioningState(DeletingValue); /// is updating. - public static WorkloadNetworkPortMirroringProfileProvisioningState Updating { get; } = new WorkloadNetworkPortMirroringProfileProvisioningState(UpdatingValue); - /// Determines if two values are the same. - public static bool operator ==(WorkloadNetworkPortMirroringProfileProvisioningState left, WorkloadNetworkPortMirroringProfileProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(WorkloadNetworkPortMirroringProfileProvisioningState left, WorkloadNetworkPortMirroringProfileProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator WorkloadNetworkPortMirroringProfileProvisioningState(string value) => new WorkloadNetworkPortMirroringProfileProvisioningState(value); + public static WorkloadNetworkPortMirroringProvisioningState Updating { get; } = new WorkloadNetworkPortMirroringProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(WorkloadNetworkPortMirroringProvisioningState left, WorkloadNetworkPortMirroringProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WorkloadNetworkPortMirroringProvisioningState left, WorkloadNetworkPortMirroringProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator WorkloadNetworkPortMirroringProvisioningState(string value) => new WorkloadNetworkPortMirroringProvisioningState(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is WorkloadNetworkPortMirroringProfileProvisioningState other && Equals(other); + public override bool Equals(object obj) => obj is WorkloadNetworkPortMirroringProvisioningState other && Equals(other); /// - public bool Equals(WorkloadNetworkPortMirroringProfileProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(WorkloadNetworkPortMirroringProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkProperties.Serialization.cs new file mode 100644 index 000000000000..93f4afd4c621 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkProperties.Serialization.cs @@ -0,0 +1,133 @@ +// 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.Avs.Models +{ + internal partial class WorkloadNetworkProperties : 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(WorkloadNetworkProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + 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 + } + } + } + + WorkloadNetworkProperties 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(WorkloadNetworkProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkProperties(document.RootElement, options); + } + + internal static WorkloadNetworkProperties DeserializeWorkloadNetworkProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WorkloadNetworkProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new WorkloadNetworkProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkProperties(provisioningState, 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkProperties 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 DeserializeWorkloadNetworkProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkProperties.cs new file mode 100644 index 000000000000..f4fd076b7341 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkProperties.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a workload network. + internal partial class WorkloadNetworkProperties + { + /// + /// 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 . + internal WorkloadNetworkProperties() + { + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkProperties(WorkloadNetworkProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The provisioning state of the resource. + public WorkloadNetworkProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.Serialization.cs similarity index 73% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.Serialization.cs index f7fc714ba232..ef15e987d512 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.Serialization.cs @@ -10,16 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - public partial class WorkloadNetworkDhcpData : IUtf8JsonSerializable, IJsonModel + public partial class WorkloadNetworkPublicIP : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -30,10 +29,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(WorkloadNetworkDhcpData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(WorkloadNetworkPublicIP)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -44,19 +43,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - WorkloadNetworkDhcpData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + WorkloadNetworkPublicIP IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(WorkloadNetworkDhcpData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(WorkloadNetworkPublicIP)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWorkloadNetworkDhcpData(document.RootElement, options); + return DeserializeWorkloadNetworkPublicIP(document.RootElement, options); } - internal static WorkloadNetworkDhcpData DeserializeWorkloadNetworkDhcpData(JsonElement element, ModelReaderWriterOptions options = null) + internal static WorkloadNetworkPublicIP DeserializeWorkloadNetworkPublicIP(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -64,7 +63,7 @@ internal static WorkloadNetworkDhcpData DeserializeWorkloadNetworkDhcpData(JsonE { return null; } - WorkloadNetworkDhcpEntity properties = default; + WorkloadNetworkPublicIPProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; @@ -79,7 +78,7 @@ internal static WorkloadNetworkDhcpData DeserializeWorkloadNetworkDhcpData(JsonE { continue; } - properties = WorkloadNetworkDhcpEntity.DeserializeWorkloadNetworkDhcpEntity(property.Value, options); + properties = WorkloadNetworkPublicIPProperties.DeserializeWorkloadNetworkPublicIPProperties(property.Value, options); continue; } if (property.NameEquals("id"u8)) @@ -112,7 +111,7 @@ internal static WorkloadNetworkDhcpData DeserializeWorkloadNetworkDhcpData(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new WorkloadNetworkDhcpData( + return new WorkloadNetworkPublicIP( id, name, type, @@ -121,35 +120,35 @@ internal static WorkloadNetworkDhcpData DeserializeWorkloadNetworkDhcpData(JsonE serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(WorkloadNetworkDhcpData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(WorkloadNetworkPublicIP)} does not support writing '{options.Format}' format."); } } - WorkloadNetworkDhcpData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + WorkloadNetworkPublicIP IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeWorkloadNetworkDhcpData(document.RootElement, options); + return DeserializeWorkloadNetworkPublicIP(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(WorkloadNetworkDhcpData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(WorkloadNetworkPublicIP)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.cs new file mode 100644 index 000000000000..2ab3a7974ef6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX Public IP Block. + public partial class WorkloadNetworkPublicIP : ResourceData + { + /// + /// 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 . + public WorkloadNetworkPublicIP() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkPublicIP(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkPublicIPProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public WorkloadNetworkPublicIPProperties Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPProperties.Serialization.cs new file mode 100644 index 000000000000..be14b39ab155 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPProperties.Serialization.cs @@ -0,0 +1,170 @@ +// 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.Avs.Models +{ + public partial class WorkloadNetworkPublicIPProperties : 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(WorkloadNetworkPublicIPProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(NumberOfPublicIPs)) + { + writer.WritePropertyName("numberOfPublicIPs"u8); + writer.WriteNumberValue(NumberOfPublicIPs.Value); + } + if (options.Format != "W" && Optional.IsDefined(PublicIPBlock)) + { + writer.WritePropertyName("publicIPBlock"u8); + writer.WriteStringValue(PublicIPBlock); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + 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 + } + } + } + + WorkloadNetworkPublicIPProperties 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(WorkloadNetworkPublicIPProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkPublicIPProperties(document.RootElement, options); + } + + internal static WorkloadNetworkPublicIPProperties DeserializeWorkloadNetworkPublicIPProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + long? numberOfPublicIPs = default; + string publicIPBlock = default; + WorkloadNetworkPublicIPProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("numberOfPublicIPs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + numberOfPublicIPs = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("publicIPBlock"u8)) + { + publicIPBlock = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new WorkloadNetworkPublicIPProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkPublicIPProperties(displayName, numberOfPublicIPs, publicIPBlock, provisioningState, 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkPublicIPProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkPublicIPProperties 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 DeserializeWorkloadNetworkPublicIPProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkPublicIPProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPProperties.cs similarity index 73% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPProperties.cs index 81f50a2c801b..bad92a5aeee5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPProperties.cs @@ -7,17 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the WorkloadNetworkPublicIP data model. - /// NSX Public IP Block - /// - public partial class WorkloadNetworkPublicIPData : ResourceData + /// NSX Public IP Block Properties. + public partial class WorkloadNetworkPublicIPProperties { /// /// Keeps track of any properties unknown to the library. @@ -51,22 +45,18 @@ public partial class WorkloadNetworkPublicIPData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public WorkloadNetworkPublicIPData() + /// Initializes a new instance of . + public WorkloadNetworkPublicIPProperties() { } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// Display name of the Public IP Block. /// Number of Public IPs requested. /// CIDR Block of the Public IP Block. /// The provisioning state. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkPublicIPData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, long? numberOfPublicIPs, string publicIPBlock, WorkloadNetworkPublicIPProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal WorkloadNetworkPublicIPProperties(string displayName, long? numberOfPublicIPs, string publicIPBlock, WorkloadNetworkPublicIPProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) { DisplayName = displayName; NumberOfPublicIPs = numberOfPublicIPs; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs index c362bba95382..4c15f232afbb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs @@ -83,7 +83,7 @@ internal static WorkloadNetworkPublicIPsList DeserializeWorkloadNetworkPublicIPs { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static WorkloadNetworkPublicIPsList DeserializeWorkloadNetworkPublicIPs { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(item, options)); + array.Add(WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs index 757f010d9747..bca418758631 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs @@ -49,7 +49,7 @@ internal partial class WorkloadNetworkPublicIPsList /// Initializes a new instance of . /// The WorkloadNetworkPublicIP items on this page. /// is null. - internal WorkloadNetworkPublicIPsList(IEnumerable value) + internal WorkloadNetworkPublicIPsList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal WorkloadNetworkPublicIPsList(IEnumerable v /// The WorkloadNetworkPublicIP items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkPublicIPsList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal WorkloadNetworkPublicIPsList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal WorkloadNetworkPublicIPsList() } /// The WorkloadNetworkPublicIP items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentProperties.Serialization.cs new file mode 100644 index 000000000000..4148e6fc9f6f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentProperties.Serialization.cs @@ -0,0 +1,233 @@ +// 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.Avs.Models +{ + public partial class WorkloadNetworkSegmentProperties : 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(WorkloadNetworkSegmentProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(ConnectedGateway)) + { + writer.WritePropertyName("connectedGateway"u8); + writer.WriteStringValue(ConnectedGateway); + } + if (Optional.IsDefined(Subnet)) + { + writer.WritePropertyName("subnet"u8); + writer.WriteObjectValue(Subnet, options); + } + if (options.Format != "W" && Optional.IsCollectionDefined(PortVif)) + { + writer.WritePropertyName("portVif"u8); + writer.WriteStartArray(); + foreach (var item in PortVif) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"u8); + writer.WriteNumberValue(Revision.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 + } + } + } + + WorkloadNetworkSegmentProperties 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(WorkloadNetworkSegmentProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkSegmentProperties(document.RootElement, options); + } + + internal static WorkloadNetworkSegmentProperties DeserializeWorkloadNetworkSegmentProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + string connectedGateway = default; + WorkloadNetworkSegmentSubnet subnet = default; + IReadOnlyList portVif = default; + SegmentStatusEnum? status = default; + WorkloadNetworkSegmentProvisioningState? provisioningState = default; + long? revision = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("connectedGateway"u8)) + { + connectedGateway = property.Value.GetString(); + continue; + } + if (property.NameEquals("subnet"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subnet = WorkloadNetworkSegmentSubnet.DeserializeWorkloadNetworkSegmentSubnet(property.Value, options); + continue; + } + if (property.NameEquals("portVif"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkSegmentPortVif.DeserializeWorkloadNetworkSegmentPortVif(item, options)); + } + portVif = array; + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new SegmentStatusEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new WorkloadNetworkSegmentProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("revision"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + revision = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkSegmentProperties( + displayName, + connectedGateway, + subnet, + portVif ?? new ChangeTrackingList(), + status, + provisioningState, + revision, + 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkSegmentProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkSegmentProperties 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 DeserializeWorkloadNetworkSegmentProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkSegmentProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentProperties.cs new file mode 100644 index 000000000000..f1c2847967aa --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX Segment Properties. + public partial class WorkloadNetworkSegmentProperties + { + /// + /// 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 . + public WorkloadNetworkSegmentProperties() + { + PortVif = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Display name of the segment. + /// Gateway which to connect segment to. + /// Subnet which to connect segment to. + /// Port Vif which segment is associated with. + /// Segment status. + /// The provisioning state. + /// NSX revision number. + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkSegmentProperties(string displayName, string connectedGateway, WorkloadNetworkSegmentSubnet subnet, IReadOnlyList portVif, SegmentStatusEnum? status, WorkloadNetworkSegmentProvisioningState? provisioningState, long? revision, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + ConnectedGateway = connectedGateway; + Subnet = subnet; + PortVif = portVif; + Status = status; + ProvisioningState = provisioningState; + Revision = revision; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Display name of the segment. + public string DisplayName { get; set; } + /// Gateway which to connect segment to. + public string ConnectedGateway { get; set; } + /// Subnet which to connect segment to. + public WorkloadNetworkSegmentSubnet Subnet { get; set; } + /// Port Vif which segment is associated with. + public IReadOnlyList PortVif { get; } + /// Segment status. + public SegmentStatusEnum? Status { get; } + /// The provisioning state. + public WorkloadNetworkSegmentProvisioningState? ProvisioningState { get; } + /// NSX revision number. + public long? Revision { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentStatus.cs deleted file mode 100644 index 4e5141b66c4b..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentStatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// Segment status. - public readonly partial struct WorkloadNetworkSegmentStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public WorkloadNetworkSegmentStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SuccessValue = "SUCCESS"; - private const string FailureValue = "FAILURE"; - - /// is success. - public static WorkloadNetworkSegmentStatus Success { get; } = new WorkloadNetworkSegmentStatus(SuccessValue); - /// is failure. - public static WorkloadNetworkSegmentStatus Failure { get; } = new WorkloadNetworkSegmentStatus(FailureValue); - /// Determines if two values are the same. - public static bool operator ==(WorkloadNetworkSegmentStatus left, WorkloadNetworkSegmentStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(WorkloadNetworkSegmentStatus left, WorkloadNetworkSegmentStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator WorkloadNetworkSegmentStatus(string value) => new WorkloadNetworkSegmentStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is WorkloadNetworkSegmentStatus other && Equals(other); - /// - public bool Equals(WorkloadNetworkSegmentStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineProperties.Serialization.cs new file mode 100644 index 000000000000..912db101ee94 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineProperties.Serialization.cs @@ -0,0 +1,159 @@ +// 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.Avs.Models +{ + public partial class WorkloadNetworkVirtualMachineProperties : 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(WorkloadNetworkVirtualMachineProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (options.Format != "W" && Optional.IsDefined(VmType)) + { + writer.WritePropertyName("vmType"u8); + writer.WriteStringValue(VmType.Value.ToString()); + } + 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 + } + } + } + + WorkloadNetworkVirtualMachineProperties 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(WorkloadNetworkVirtualMachineProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkVirtualMachineProperties(document.RootElement, options); + } + + internal static WorkloadNetworkVirtualMachineProperties DeserializeWorkloadNetworkVirtualMachineProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WorkloadNetworkProvisioningState? provisioningState = default; + string displayName = default; + VmTypeEnum? vmType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new WorkloadNetworkProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("vmType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vmType = new VmTypeEnum(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkVirtualMachineProperties(provisioningState, displayName, vmType, 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkVirtualMachineProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkVirtualMachineProperties 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 DeserializeWorkloadNetworkVirtualMachineProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkVirtualMachineProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineProperties.cs new file mode 100644 index 000000000000..231fe887b50d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX Virtual Machine Properties. + public partial class WorkloadNetworkVirtualMachineProperties + { + /// + /// 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 . + internal WorkloadNetworkVirtualMachineProperties() + { + } + + /// Initializes a new instance of . + /// The provisioning state of the resource. + /// Display name of the VM. + /// Virtual machine type. + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkVirtualMachineProperties(WorkloadNetworkProvisioningState? provisioningState, string displayName, VmTypeEnum? vmType, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + DisplayName = displayName; + VmType = vmType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The provisioning state of the resource. + public WorkloadNetworkProvisioningState? ProvisioningState { get; } + /// Display name of the VM. + public string DisplayName { get; } + /// Virtual machine type. + public VmTypeEnum? VmType { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroup.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroup.Serialization.cs new file mode 100644 index 000000000000..aed66223374b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroup.Serialization.cs @@ -0,0 +1,154 @@ +// 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; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkVmGroup : 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 override 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(WorkloadNetworkVmGroup)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + WorkloadNetworkVmGroup 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(WorkloadNetworkVmGroup)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkVmGroup(document.RootElement, options); + } + + internal static WorkloadNetworkVmGroup DeserializeWorkloadNetworkVmGroup(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WorkloadNetworkVmGroupProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WorkloadNetworkVmGroupProperties.DeserializeWorkloadNetworkVmGroupProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkVmGroup( + id, + name, + type, + systemData, + properties, + 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkVmGroup)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkVmGroup 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 DeserializeWorkloadNetworkVmGroup(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkVmGroup)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroup.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroup.cs new file mode 100644 index 000000000000..83ea874ff4ad --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroup.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX VM Group. + public partial class WorkloadNetworkVmGroup : ResourceData + { + /// + /// 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 . + public WorkloadNetworkVmGroup() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal WorkloadNetworkVmGroup(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkVmGroupProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public WorkloadNetworkVmGroupProperties Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupProperties.Serialization.cs new file mode 100644 index 000000000000..9e33583c7c3f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupProperties.Serialization.cs @@ -0,0 +1,205 @@ +// 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.Avs.Models +{ + public partial class WorkloadNetworkVmGroupProperties : 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(WorkloadNetworkVmGroupProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsCollectionDefined(Members)) + { + writer.WritePropertyName("members"u8); + writer.WriteStartArray(); + foreach (var item in Members) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"u8); + writer.WriteNumberValue(Revision.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 + } + } + } + + WorkloadNetworkVmGroupProperties 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(WorkloadNetworkVmGroupProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadNetworkVmGroupProperties(document.RootElement, options); + } + + internal static WorkloadNetworkVmGroupProperties DeserializeWorkloadNetworkVmGroupProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + IList members = default; + VmGroupStatusEnum? status = default; + WorkloadNetworkVmGroupProvisioningState? provisioningState = default; + long? revision = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("members"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + members = array; + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new VmGroupStatusEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new WorkloadNetworkVmGroupProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("revision"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + revision = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadNetworkVmGroupProperties( + displayName, + members ?? new ChangeTrackingList(), + status, + provisioningState, + revision, + 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); + default: + throw new FormatException($"The model {nameof(WorkloadNetworkVmGroupProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadNetworkVmGroupProperties 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 DeserializeWorkloadNetworkVmGroupProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadNetworkVmGroupProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupProperties.cs similarity index 73% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupProperties.cs index 2075fdda5262..fcba776b98df 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupProperties.cs @@ -7,17 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// - /// A class representing the WorkloadNetworkVmGroup data model. - /// NSX VM Group - /// - public partial class WorkloadNetworkVmGroupData : ResourceData + /// NSX VM Group Properties. + public partial class WorkloadNetworkVmGroupProperties { /// /// Keeps track of any properties unknown to the library. @@ -51,24 +45,20 @@ public partial class WorkloadNetworkVmGroupData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public WorkloadNetworkVmGroupData() + /// Initializes a new instance of . + public WorkloadNetworkVmGroupProperties() { Members = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// Display name of the VM group. /// Virtual machine members of this group. /// VM Group status. /// The provisioning state. /// NSX revision number. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkVmGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IList members, WorkloadNetworkVmGroupStatus? status, WorkloadNetworkVmGroupProvisioningState? provisioningState, long? revision, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal WorkloadNetworkVmGroupProperties(string displayName, IList members, VmGroupStatusEnum? status, WorkloadNetworkVmGroupProvisioningState? provisioningState, long? revision, IDictionary serializedAdditionalRawData) { DisplayName = displayName; Members = members; @@ -83,7 +73,7 @@ internal WorkloadNetworkVmGroupData(ResourceIdentifier id, string name, Resource /// Virtual machine members of this group. public IList Members { get; } /// VM Group status. - public WorkloadNetworkVmGroupStatus? Status { get; } + public VmGroupStatusEnum? Status { get; } /// The provisioning state. public WorkloadNetworkVmGroupProvisioningState? ProvisioningState { get; } /// NSX revision number. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupStatus.cs deleted file mode 100644 index 99a01aaef942..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupStatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// VM group status. - public readonly partial struct WorkloadNetworkVmGroupStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public WorkloadNetworkVmGroupStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SuccessValue = "SUCCESS"; - private const string FailureValue = "FAILURE"; - - /// is success. - public static WorkloadNetworkVmGroupStatus Success { get; } = new WorkloadNetworkVmGroupStatus(SuccessValue); - /// is failure. - public static WorkloadNetworkVmGroupStatus Failure { get; } = new WorkloadNetworkVmGroupStatus(FailureValue); - /// Determines if two values are the same. - public static bool operator ==(WorkloadNetworkVmGroupStatus left, WorkloadNetworkVmGroupStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(WorkloadNetworkVmGroupStatus left, WorkloadNetworkVmGroupStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator WorkloadNetworkVmGroupStatus(string value) => new WorkloadNetworkVmGroupStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is WorkloadNetworkVmGroupStatus other && Equals(other); - /// - public bool Equals(WorkloadNetworkVmGroupStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.Serialization.cs index a8f7d52bf1f2..6a7afd2bf34b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.Serialization.cs @@ -83,7 +83,7 @@ internal static WorkloadNetworkVmGroupsList DeserializeWorkloadNetworkVmGroupsLi { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static WorkloadNetworkVmGroupsList DeserializeWorkloadNetworkVmGroupsLi { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkVmGroupData.DeserializeWorkloadNetworkVmGroupData(item, options)); + array.Add(WorkloadNetworkVmGroup.DeserializeWorkloadNetworkVmGroup(item, options)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.cs index 01e927e5d2ef..f0f3d06a5842 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmGroupsList.cs @@ -49,7 +49,7 @@ internal partial class WorkloadNetworkVmGroupsList /// Initializes a new instance of . /// The WorkloadNetworkVMGroup items on this page. /// is null. - internal WorkloadNetworkVmGroupsList(IEnumerable value) + internal WorkloadNetworkVmGroupsList(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal WorkloadNetworkVmGroupsList(IEnumerable val /// The WorkloadNetworkVMGroup items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkVmGroupsList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal WorkloadNetworkVmGroupsList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,7 +73,7 @@ internal WorkloadNetworkVmGroupsList() } /// The WorkloadNetworkVMGroup items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmType.cs deleted file mode 100644 index 4de720cc0e5f..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVmType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Avs.Models -{ - /// VM type. - public readonly partial struct WorkloadNetworkVmType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public WorkloadNetworkVmType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string RegularValue = "REGULAR"; - private const string EdgeValue = "EDGE"; - private const string ServiceValue = "SERVICE"; - - /// is regular. - public static WorkloadNetworkVmType Regular { get; } = new WorkloadNetworkVmType(RegularValue); - /// is edge. - public static WorkloadNetworkVmType Edge { get; } = new WorkloadNetworkVmType(EdgeValue); - /// is service. - public static WorkloadNetworkVmType Service { get; } = new WorkloadNetworkVmType(ServiceValue); - /// Determines if two values are the same. - public static bool operator ==(WorkloadNetworkVmType left, WorkloadNetworkVmType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(WorkloadNetworkVmType left, WorkloadNetworkVmType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator WorkloadNetworkVmType(string value) => new WorkloadNetworkVmType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is WorkloadNetworkVmType other && Equals(other); - /// - public bool Equals(WorkloadNetworkVmType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs index 292f843e9d49..c208700957b7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs @@ -19,8 +19,8 @@ namespace Azure.ResourceManager.Avs { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetPlacementPolicies method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetPlacementPolicies method from an instance of . /// public partial class PlacementPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -47,8 +47,8 @@ internal PlacementPolicyCollection(ArmClient client, ResourceIdentifier id) : ba internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudClusterResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudClusterResource.ResourceType), nameof(id)); + if (id.ResourceType != ClusterResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ClusterResource.ResourceType), nameof(id)); } /// @@ -60,11 +60,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// PlacementPolicies_CreateOrUpdate + /// PlacementPolicy_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -109,11 +109,11 @@ public virtual async Task> CreateOrUpdateA /// /// /// Operation Id - /// PlacementPolicies_CreateOrUpdate + /// PlacementPolicy_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -158,11 +158,11 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa /// /// /// Operation Id - /// PlacementPolicies_Get + /// PlacementPolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -203,11 +203,11 @@ public virtual async Task> GetAsync(string pla /// /// /// Operation Id - /// PlacementPolicies_Get + /// PlacementPolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -248,11 +248,11 @@ public virtual Response Get(string placementPolicyName, /// /// /// Operation Id - /// PlacementPolicies_List + /// PlacementPolicy_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -278,11 +278,11 @@ public virtual AsyncPageable GetAllAsync(CancellationTo /// /// /// Operation Id - /// PlacementPolicies_List + /// PlacementPolicy_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -308,11 +308,11 @@ public virtual Pageable GetAll(CancellationToken cancel /// /// /// Operation Id - /// PlacementPolicies_Get + /// PlacementPolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -351,11 +351,11 @@ public virtual async Task> ExistsAsync(string placementPolicyName /// /// /// Operation Id - /// PlacementPolicies_Get + /// PlacementPolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -394,11 +394,11 @@ public virtual Response Exists(string placementPolicyName, CancellationTok /// /// /// Operation Id - /// PlacementPolicies_Get + /// PlacementPolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -439,11 +439,11 @@ public virtual async Task> GetIfExists /// /// /// Operation Id - /// PlacementPolicies_Get + /// PlacementPolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs index 1803f4098840..5e5184e5da5b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs @@ -64,7 +64,7 @@ public PlacementPolicyData() /// /// The resource-specific properties for this resource. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include and . /// /// Keeps track of any properties unknown to the library. internal PlacementPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PlacementPolicyProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) @@ -76,7 +76,7 @@ internal PlacementPolicyData(ResourceIdentifier id, string name, ResourceType re /// /// The resource-specific properties for this resource. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include and . /// public PlacementPolicyProperties Properties { get; set; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyResource.cs index 8f28aedd0dcd..5bfd587dcf3a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyResource.cs @@ -19,7 +19,7 @@ namespace Azure.ResourceManager.Avs /// A Class representing a PlacementPolicy along with the instance operations that can be performed on it. /// If you have a you can construct a /// from an instance of using the GetPlacementPolicyResource method. - /// Otherwise you can get one from its parent resource using the GetPlacementPolicy method. + /// Otherwise you can get one from its parent resource using the GetPlacementPolicy method. /// public partial class PlacementPolicyResource : ArmResource { @@ -99,11 +99,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// PlacementPolicies_Get + /// PlacementPolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -139,11 +139,11 @@ public virtual async Task> GetAsync(Cancellati /// /// /// Operation Id - /// PlacementPolicies_Get + /// PlacementPolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -179,11 +179,11 @@ public virtual Response Get(CancellationToken cancellat /// /// /// Operation Id - /// PlacementPolicies_Delete + /// PlacementPolicy_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -221,11 +221,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// PlacementPolicies_Delete + /// PlacementPolicy_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -263,11 +263,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// PlacementPolicies_Update + /// PlacementPolicy_Update /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -276,10 +276,10 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The placement policy properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, PlacementPolicyPatch patch, CancellationToken cancellationToken = default) + public virtual async Task UpdateAsync(WaitUntil waitUntil, PlacementPolicyPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); @@ -288,9 +288,9 @@ public virtual async Task> UpdateAsync(Wai try { var response = await _placementPolicyRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new PlacementPolicyOperationSource(Client), _placementPolicyClientDiagnostics, Pipeline, _placementPolicyRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var operation = new AvsArmOperation(_placementPolicyClientDiagnostics, Pipeline, _placementPolicyRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -309,11 +309,11 @@ public virtual async Task> UpdateAsync(Wai /// /// /// Operation Id - /// PlacementPolicies_Update + /// PlacementPolicy_Update /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -322,10 +322,10 @@ public virtual async Task> UpdateAsync(Wai /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The placement policy properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, PlacementPolicyPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, PlacementPolicyPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); @@ -334,9 +334,9 @@ public virtual ArmOperation Update(WaitUntil waitUntil, try { var response = _placementPolicyRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new AvsArmOperation(new PlacementPolicyOperationSource(Client), _placementPolicyClientDiagnostics, Pipeline, _placementPolicyRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var operation = new AvsArmOperation(_placementPolicyClientDiagnostics, Pipeline, _placementPolicyRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs similarity index 62% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs index 15f59a39cc8c..bb0f4e3007eb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.Avs { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetAvsPrivateClouds method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetPrivateClouds method from an instance of . /// - public partial class AvsPrivateCloudCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class PrivateCloudCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _avsPrivateCloudPrivateCloudsClientDiagnostics; - private readonly PrivateCloudsRestOperations _avsPrivateCloudPrivateCloudsRestClient; + private readonly ClientDiagnostics _privateCloudClientDiagnostics; + private readonly PrivateCloudsRestOperations _privateCloudRestClient; - /// Initializes a new instance of the class for mocking. - protected AvsPrivateCloudCollection() + /// Initializes a new instance of the class for mocking. + protected PrivateCloudCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal AvsPrivateCloudCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal PrivateCloudCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsPrivateCloudPrivateCloudsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", AvsPrivateCloudResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(AvsPrivateCloudResource.ResourceType, out string avsPrivateCloudPrivateCloudsApiVersion); - _avsPrivateCloudPrivateCloudsRestClient = new PrivateCloudsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsPrivateCloudPrivateCloudsApiVersion); + _privateCloudClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", PrivateCloudResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PrivateCloudResource.ResourceType, out string privateCloudApiVersion); + _privateCloudRestClient = new PrivateCloudsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, privateCloudApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -61,15 +61,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// PrivateClouds_CreateOrUpdate + /// PrivateCloud_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -79,17 +79,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateCloudName, AvsPrivateCloudData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateCloudName, PrivateCloudData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudCollection.CreateOrUpdate"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _avsPrivateCloudPrivateCloudsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new AvsPrivateCloudOperationSource(Client), _avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, _avsPrivateCloudPrivateCloudsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _privateCloudRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new PrivateCloudOperationSource(Client), _privateCloudClientDiagnostics, Pipeline, _privateCloudRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -110,15 +110,15 @@ public virtual async Task> CreateOrUpdateA /// /// /// Operation Id - /// PrivateClouds_CreateOrUpdate + /// PrivateCloud_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -128,17 +128,17 @@ public virtual async Task> CreateOrUpdateA /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateCloudName, AvsPrivateCloudData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateCloudName, PrivateCloudData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudCollection.CreateOrUpdate"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudCollection.CreateOrUpdate"); scope.Start(); try { - var response = _avsPrivateCloudPrivateCloudsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, data, cancellationToken); - var operation = new AvsArmOperation(new AvsPrivateCloudOperationSource(Client), _avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, _avsPrivateCloudPrivateCloudsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _privateCloudRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, data, cancellationToken); + var operation = new AvsArmOperation(new PrivateCloudOperationSource(Client), _privateCloudClientDiagnostics, Pipeline, _privateCloudRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -159,15 +159,15 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -175,18 +175,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string privateCloudName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudCollection.Get"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudCollection.Get"); scope.Start(); try { - var response = await _avsPrivateCloudPrivateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken).ConfigureAwait(false); + var response = await _privateCloudRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new PrivateCloudResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -204,15 +204,15 @@ public virtual async Task> GetAsync(string pri /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -220,18 +220,18 @@ public virtual async Task> GetAsync(string pri /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string privateCloudName, CancellationToken cancellationToken = default) + public virtual Response Get(string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudCollection.Get"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudCollection.Get"); scope.Start(); try { - var response = _avsPrivateCloudPrivateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken); + var response = _privateCloudRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new PrivateCloudResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -249,25 +249,25 @@ public virtual Response Get(string privateCloudName, Ca /// /// /// Operation Id - /// PrivateClouds_List + /// PrivateCloud_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudPrivateCloudsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudPrivateCloudsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), _avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "AvsPrivateCloudCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _privateCloudRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _privateCloudRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PrivateCloudResource(Client, PrivateCloudData.DeserializePrivateCloudData(e)), _privateCloudClientDiagnostics, Pipeline, "PrivateCloudCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -279,25 +279,25 @@ public virtual AsyncPageable GetAllAsync(CancellationTo /// /// /// Operation Id - /// PrivateClouds_List + /// PrivateCloud_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudPrivateCloudsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudPrivateCloudsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), _avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "AvsPrivateCloudCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _privateCloudRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _privateCloudRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PrivateCloudResource(Client, PrivateCloudData.DeserializePrivateCloudData(e)), _privateCloudClientDiagnostics, Pipeline, "PrivateCloudCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -309,15 +309,15 @@ public virtual Pageable GetAll(CancellationToken cancel /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -329,11 +329,11 @@ public virtual async Task> ExistsAsync(string privateCloudName, C { Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudCollection.Exists"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudCollection.Exists"); scope.Start(); try { - var response = await _avsPrivateCloudPrivateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _privateCloudRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -352,15 +352,15 @@ public virtual async Task> ExistsAsync(string privateCloudName, C /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -372,11 +372,11 @@ public virtual Response Exists(string privateCloudName, CancellationToken { Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudCollection.Exists"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudCollection.Exists"); scope.Start(); try { - var response = _avsPrivateCloudPrivateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken); + var response = _privateCloudRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -395,15 +395,15 @@ public virtual Response Exists(string privateCloudName, CancellationToken /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -411,18 +411,18 @@ public virtual Response Exists(string privateCloudName, CancellationToken /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string privateCloudName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudCollection.GetIfExists"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudCollection.GetIfExists"); scope.Start(); try { - var response = await _avsPrivateCloudPrivateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _privateCloudRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateCloudResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -440,15 +440,15 @@ public virtual async Task> GetIfExists /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -456,18 +456,18 @@ public virtual async Task> GetIfExists /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string privateCloudName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudCollection.GetIfExists"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudCollection.GetIfExists"); scope.Start(); try { - var response = _avsPrivateCloudPrivateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken); + var response = _privateCloudRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PrivateCloudResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -476,7 +476,7 @@ public virtual NullableResponse GetIfExists(string priv } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -486,7 +486,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.Serialization.cs similarity index 52% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkData.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.Serialization.cs index e9db6f69d732..5ab6b05ad222 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.Avs { - public partial class AvsCloudLinkData : IUtf8JsonSerializable, IJsonModel + public partial class PrivateCloudData : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -30,46 +30,50 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsCloudLinkData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(PrivateCloudData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsDefined(Status)) + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + if (Optional.IsDefined(Identity)) { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); } - if (Optional.IsDefined(LinkedCloud)) + if (Optional.IsCollectionDefined(Zones)) { - writer.WritePropertyName("linkedCloud"u8); - writer.WriteStringValue(LinkedCloud); + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); } - writer.WriteEndObject(); } - AvsCloudLinkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PrivateCloudData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsCloudLinkData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(PrivateCloudData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsCloudLinkData(document.RootElement, options); + return DeserializePrivateCloudData(document.RootElement, options); } - internal static AvsCloudLinkData DeserializeAvsCloudLinkData(JsonElement element, ModelReaderWriterOptions options = null) + internal static PrivateCloudData DeserializePrivateCloudData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -77,78 +81,98 @@ internal static AvsCloudLinkData DeserializeAvsCloudLinkData(JsonElement element { return null; } + PrivateCloudProperties properties = default; + AvsSku sku = default; + ManagedServiceIdentity identity = default; + IList zones = default; + IDictionary tags = default; + AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - AvsCloudLinkProvisioningState? provisioningState = default; - AvsCloudLinkStatus? status = default; - ResourceIdentifier linkedCloud = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (property.NameEquals("properties"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PrivateCloudProperties.DeserializePrivateCloudProperties(property.Value, options); continue; } - if (property.NameEquals("name"u8)) + if (property.NameEquals("sku"u8)) { - name = property.Value.GetString(); + sku = AvsSku.DeserializeAvsSku(property.Value, options); continue; } - if (property.NameEquals("type"u8)) + if (property.NameEquals("identity"u8)) { - type = new ResourceType(property.Value.GetString()); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("systemData"u8)) + if (property.NameEquals("zones"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; continue; } - if (property.NameEquals("properties"u8)) + if (property.NameEquals("tags"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new AvsCloudLinkProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new AvsCloudLinkStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("linkedCloud"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - linkedCloud = new ResourceIdentifier(property0.Value.GetString()); - continue; - } + dictionary.Add(property0.Name, property0.Value.GetString()); } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } if (options.Format != "W") @@ -157,46 +181,49 @@ internal static AvsCloudLinkData DeserializeAvsCloudLinkData(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new AvsCloudLinkData( + return new PrivateCloudData( id, name, type, systemData, - provisioningState, - status, - linkedCloud, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + sku, + identity, + zones ?? new ChangeTrackingList(), serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsCloudLinkData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(PrivateCloudData)} does not support writing '{options.Format}' format."); } } - AvsCloudLinkData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PrivateCloudData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsCloudLinkData(document.RootElement, options); + return DeserializePrivateCloudData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsCloudLinkData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(PrivateCloudData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs new file mode 100644 index 000000000000..7ae0c86a77d2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing the PrivateCloud data model. + /// A private cloud resource + /// + public partial class PrivateCloudData : TrackedResourceData + { + /// + /// 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 location. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// is null. + public PrivateCloudData(AzureLocation location, AvsSku sku) : base(location) + { + Argument.AssertNotNull(sku, nameof(sku)); + + Sku = sku; + Zones = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. + /// The availability zones. + /// Keeps track of any properties unknown to the library. + internal PrivateCloudData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PrivateCloudProperties properties, AvsSku sku, ManagedServiceIdentity identity, IList zones, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Sku = sku; + Identity = identity; + Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PrivateCloudData() + { + } + + /// The resource-specific properties for this resource. + public PrivateCloudProperties Properties { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + public AvsSku Sku { get; set; } + /// The managed service identities assigned to this resource. Current supported identity types: None, SystemAssigned. + public ManagedServiceIdentity Identity { get; set; } + /// The availability zones. + public IList Zones { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudResource.Serialization.cs new file mode 100644 index 000000000000..413cd97f653e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Avs +{ + public partial class PrivateCloudResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + PrivateCloudData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + PrivateCloudData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudResource.cs similarity index 69% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudResource.cs index dc03d06a5dfa..4dc65e630e7a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudResource.cs @@ -18,14 +18,14 @@ namespace Azure.ResourceManager.Avs { /// - /// A Class representing an AvsPrivateCloud along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetAvsPrivateCloudResource method. - /// Otherwise you can get one from its parent resource using the GetAvsPrivateCloud method. + /// A Class representing a PrivateCloud along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetPrivateCloudResource method. + /// Otherwise you can get one from its parent resource using the GetPrivateCloud method. /// - public partial class AvsPrivateCloudResource : ArmResource + public partial class PrivateCloudResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The privateCloudName. @@ -35,35 +35,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _avsPrivateCloudPrivateCloudsClientDiagnostics; - private readonly PrivateCloudsRestOperations _avsPrivateCloudPrivateCloudsRestClient; - private readonly AvsPrivateCloudData _data; + private readonly ClientDiagnostics _privateCloudClientDiagnostics; + private readonly PrivateCloudsRestOperations _privateCloudRestClient; + private readonly PrivateCloudData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds"; - /// Initializes a new instance of the class for mocking. - protected AvsPrivateCloudResource() + /// Initializes a new instance of the class for mocking. + protected PrivateCloudResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal AvsPrivateCloudResource(ArmClient client, AvsPrivateCloudData data) : this(client, data.Id) + internal PrivateCloudResource(ArmClient client, PrivateCloudData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal AvsPrivateCloudResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal PrivateCloudResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsPrivateCloudPrivateCloudsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string avsPrivateCloudPrivateCloudsApiVersion); - _avsPrivateCloudPrivateCloudsRestClient = new PrivateCloudsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsPrivateCloudPrivateCloudsApiVersion); + _privateCloudClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string privateCloudApiVersion); + _privateCloudRestClient = new PrivateCloudsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, privateCloudApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -74,7 +74,7 @@ internal AvsPrivateCloudResource(ArmClient client, ResourceIdentifier id) : base /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual AvsPrivateCloudData Data + public virtual PrivateCloudData Data { get { @@ -90,11 +90,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of AvsPrivateCloudAddonResources in the AvsPrivateCloud. - /// An object representing collection of AvsPrivateCloudAddonResources and their operations over a AvsPrivateCloudAddonResource. - public virtual AvsPrivateCloudAddonCollection GetAvsPrivateCloudAddons() + /// Gets a collection of AddonResources in the PrivateCloud. + /// An object representing collection of AddonResources and their operations over a AddonResource. + public virtual AddonCollection GetAddons() { - return GetCachedClient(client => new AvsPrivateCloudAddonCollection(client, Id)); + return GetCachedClient(client => new AddonCollection(client, Id)); } /// @@ -106,15 +106,15 @@ public virtual AvsPrivateCloudAddonCollection GetAvsPrivateCloudAddons() /// /// /// Operation Id - /// Addons_Get + /// Addon_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -123,9 +123,9 @@ public virtual AvsPrivateCloudAddonCollection GetAvsPrivateCloudAddons() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetAvsPrivateCloudAddonAsync(string addonName, CancellationToken cancellationToken = default) + public virtual async Task> GetAddonAsync(string addonName, CancellationToken cancellationToken = default) { - return await GetAvsPrivateCloudAddons().GetAsync(addonName, cancellationToken).ConfigureAwait(false); + return await GetAddons().GetAsync(addonName, cancellationToken).ConfigureAwait(false); } /// @@ -137,15 +137,15 @@ public virtual async Task> GetAvsPrivateC /// /// /// Operation Id - /// Addons_Get + /// Addon_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -154,12 +154,12 @@ public virtual async Task> GetAvsPrivateC /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetAvsPrivateCloudAddon(string addonName, CancellationToken cancellationToken = default) + public virtual Response GetAddon(string addonName, CancellationToken cancellationToken = default) { - return GetAvsPrivateCloudAddons().Get(addonName, cancellationToken); + return GetAddons().Get(addonName, cancellationToken); } - /// Gets a collection of ExpressRouteAuthorizationResources in the AvsPrivateCloud. + /// Gets a collection of ExpressRouteAuthorizationResources in the PrivateCloud. /// An object representing collection of ExpressRouteAuthorizationResources and their operations over a ExpressRouteAuthorizationResource. public virtual ExpressRouteAuthorizationCollection GetExpressRouteAuthorizations() { @@ -175,11 +175,11 @@ public virtual ExpressRouteAuthorizationCollection GetExpressRouteAuthorizations /// /// /// Operation Id - /// Authorizations_Get + /// ExpressRouteAuthorization_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -206,11 +206,11 @@ public virtual async Task> GetExpres /// /// /// Operation Id - /// Authorizations_Get + /// ExpressRouteAuthorization_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -228,11 +228,11 @@ public virtual Response GetExpressRouteAuthor return GetExpressRouteAuthorizations().Get(authorizationName, cancellationToken); } - /// Gets a collection of AvsCloudLinkResources in the AvsPrivateCloud. - /// An object representing collection of AvsCloudLinkResources and their operations over a AvsCloudLinkResource. - public virtual AvsCloudLinkCollection GetAvsCloudLinks() + /// Gets a collection of CloudLinkResources in the PrivateCloud. + /// An object representing collection of CloudLinkResources and their operations over a CloudLinkResource. + public virtual CloudLinkCollection GetCloudLinks() { - return GetCachedClient(client => new AvsCloudLinkCollection(client, Id)); + return GetCachedClient(client => new CloudLinkCollection(client, Id)); } /// @@ -244,15 +244,15 @@ public virtual AvsCloudLinkCollection GetAvsCloudLinks() /// /// /// Operation Id - /// CloudLinks_Get + /// CloudLink_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -261,9 +261,9 @@ public virtual AvsCloudLinkCollection GetAvsCloudLinks() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetAvsCloudLinkAsync(string cloudLinkName, CancellationToken cancellationToken = default) + public virtual async Task> GetCloudLinkAsync(string cloudLinkName, CancellationToken cancellationToken = default) { - return await GetAvsCloudLinks().GetAsync(cloudLinkName, cancellationToken).ConfigureAwait(false); + return await GetCloudLinks().GetAsync(cloudLinkName, cancellationToken).ConfigureAwait(false); } /// @@ -275,15 +275,15 @@ public virtual async Task> GetAvsCloudLinkAsync(s /// /// /// Operation Id - /// CloudLinks_Get + /// CloudLink_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -292,16 +292,16 @@ public virtual async Task> GetAvsCloudLinkAsync(s /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetAvsCloudLink(string cloudLinkName, CancellationToken cancellationToken = default) + public virtual Response GetCloudLink(string cloudLinkName, CancellationToken cancellationToken = default) { - return GetAvsCloudLinks().Get(cloudLinkName, cancellationToken); + return GetCloudLinks().Get(cloudLinkName, cancellationToken); } - /// Gets a collection of AvsPrivateCloudClusterResources in the AvsPrivateCloud. - /// An object representing collection of AvsPrivateCloudClusterResources and their operations over a AvsPrivateCloudClusterResource. - public virtual AvsPrivateCloudClusterCollection GetAvsPrivateCloudClusters() + /// Gets a collection of ClusterResources in the PrivateCloud. + /// An object representing collection of ClusterResources and their operations over a ClusterResource. + public virtual ClusterCollection GetClusters() { - return GetCachedClient(client => new AvsPrivateCloudClusterCollection(client, Id)); + return GetCachedClient(client => new ClusterCollection(client, Id)); } /// @@ -313,15 +313,15 @@ public virtual AvsPrivateCloudClusterCollection GetAvsPrivateCloudClusters() /// /// /// Operation Id - /// Clusters_Get + /// Cluster_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -330,9 +330,9 @@ public virtual AvsPrivateCloudClusterCollection GetAvsPrivateCloudClusters() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetAvsPrivateCloudClusterAsync(string clusterName, CancellationToken cancellationToken = default) + public virtual async Task> GetClusterAsync(string clusterName, CancellationToken cancellationToken = default) { - return await GetAvsPrivateCloudClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -344,15 +344,15 @@ public virtual async Task> GetAvsPrivat /// /// /// Operation Id - /// Clusters_Get + /// Cluster_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -361,12 +361,12 @@ public virtual async Task> GetAvsPrivat /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetAvsPrivateCloudCluster(string clusterName, CancellationToken cancellationToken = default) + public virtual Response GetCluster(string clusterName, CancellationToken cancellationToken = default) { - return GetAvsPrivateCloudClusters().Get(clusterName, cancellationToken); + return GetClusters().Get(clusterName, cancellationToken); } - /// Gets a collection of GlobalReachConnectionResources in the AvsPrivateCloud. + /// Gets a collection of GlobalReachConnectionResources in the PrivateCloud. /// An object representing collection of GlobalReachConnectionResources and their operations over a GlobalReachConnectionResource. public virtual GlobalReachConnectionCollection GetGlobalReachConnections() { @@ -382,11 +382,11 @@ public virtual GlobalReachConnectionCollection GetGlobalReachConnections() /// /// /// Operation Id - /// GlobalReachConnections_Get + /// GlobalReachConnection_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -413,11 +413,11 @@ public virtual async Task> GetGlobalReac /// /// /// Operation Id - /// GlobalReachConnections_Get + /// GlobalReachConnection_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -435,7 +435,7 @@ public virtual Response GetGlobalReachConnection( return GetGlobalReachConnections().Get(globalReachConnectionName, cancellationToken); } - /// Gets a collection of HcxEnterpriseSiteResources in the AvsPrivateCloud. + /// Gets a collection of HcxEnterpriseSiteResources in the PrivateCloud. /// An object representing collection of HcxEnterpriseSiteResources and their operations over a HcxEnterpriseSiteResource. public virtual HcxEnterpriseSiteCollection GetHcxEnterpriseSites() { @@ -451,11 +451,11 @@ public virtual HcxEnterpriseSiteCollection GetHcxEnterpriseSites() /// /// /// Operation Id - /// HcxEnterpriseSites_Get + /// HcxEnterpriseSite_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -482,11 +482,11 @@ public virtual async Task> GetHcxEnterpriseS /// /// /// Operation Id - /// HcxEnterpriseSites_Get + /// HcxEnterpriseSite_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -504,14 +504,152 @@ public virtual Response GetHcxEnterpriseSite(string h return GetHcxEnterpriseSites().Get(hcxEnterpriseSiteName, cancellationToken); } - /// Gets an object representing a IscsiPathResource along with the instance operations that can be performed on it in the AvsPrivateCloud. + /// Gets an object representing a IscsiPathResource along with the instance operations that can be performed on it in the PrivateCloud. /// Returns a object. public virtual IscsiPathResource GetIscsiPath() { return new IscsiPathResource(Client, Id.AppendChildResource("iscsiPaths", "default")); } - /// Gets a collection of ScriptExecutionResources in the AvsPrivateCloud. + /// Gets a collection of ProvisionedNetworkResources in the PrivateCloud. + /// An object representing collection of ProvisionedNetworkResources and their operations over a ProvisionedNetworkResource. + public virtual ProvisionedNetworkCollection GetProvisionedNetworks() + { + return GetCachedClient(client => new ProvisionedNetworkCollection(client, Id)); + } + + /// + /// Get a ProvisionedNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName} + /// + /// + /// Operation Id + /// ProvisionedNetwork_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the cloud link. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetProvisionedNetworkAsync(string provisionedNetworkName, CancellationToken cancellationToken = default) + { + return await GetProvisionedNetworks().GetAsync(provisionedNetworkName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a ProvisionedNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName} + /// + /// + /// Operation Id + /// ProvisionedNetwork_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the cloud link. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetProvisionedNetwork(string provisionedNetworkName, CancellationToken cancellationToken = default) + { + return GetProvisionedNetworks().Get(provisionedNetworkName, cancellationToken); + } + + /// Gets a collection of PureStoragePolicyResources in the PrivateCloud. + /// An object representing collection of PureStoragePolicyResources and their operations over a PureStoragePolicyResource. + public virtual PureStoragePolicyCollection GetPureStoragePolicies() + { + return GetCachedClient(client => new PureStoragePolicyCollection(client, Id)); + } + + /// + /// Get a PureStoragePolicy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} + /// + /// + /// Operation Id + /// PureStoragePolicy_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the storage policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPureStoragePolicyAsync(string storagePolicyName, CancellationToken cancellationToken = default) + { + return await GetPureStoragePolicies().GetAsync(storagePolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a PureStoragePolicy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} + /// + /// + /// Operation Id + /// PureStoragePolicy_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the storage policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPureStoragePolicy(string storagePolicyName, CancellationToken cancellationToken = default) + { + return GetPureStoragePolicies().Get(storagePolicyName, cancellationToken); + } + + /// Gets a collection of ScriptExecutionResources in the PrivateCloud. /// An object representing collection of ScriptExecutionResources and their operations over a ScriptExecutionResource. public virtual ScriptExecutionCollection GetScriptExecutions() { @@ -527,11 +665,11 @@ public virtual ScriptExecutionCollection GetScriptExecutions() /// /// /// Operation Id - /// ScriptExecutions_Get + /// ScriptExecution_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -558,11 +696,11 @@ public virtual async Task> GetScriptExecutionA /// /// /// Operation Id - /// ScriptExecutions_Get + /// ScriptExecution_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -580,7 +718,7 @@ public virtual Response GetScriptExecution(string scrip return GetScriptExecutions().Get(scriptExecutionName, cancellationToken); } - /// Gets a collection of ScriptPackageResources in the AvsPrivateCloud. + /// Gets a collection of ScriptPackageResources in the PrivateCloud. /// An object representing collection of ScriptPackageResources and their operations over a ScriptPackageResource. public virtual ScriptPackageCollection GetScriptPackages() { @@ -596,11 +734,11 @@ public virtual ScriptPackageCollection GetScriptPackages() /// /// /// Operation Id - /// ScriptPackages_Get + /// ScriptPackage_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -627,11 +765,11 @@ public virtual async Task> GetScriptPackageAsync /// /// /// Operation Id - /// ScriptPackages_Get + /// ScriptPackage_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -649,7 +787,7 @@ public virtual Response GetScriptPackage(string scriptPac return GetScriptPackages().Get(scriptPackageName, cancellationToken); } - /// Gets an object representing a WorkloadNetworkResource along with the instance operations that can be performed on it in the AvsPrivateCloud. + /// Gets an object representing a WorkloadNetworkResource along with the instance operations that can be performed on it in the PrivateCloud. /// Returns a object. public virtual WorkloadNetworkResource GetWorkloadNetwork() { @@ -665,29 +803,29 @@ public virtual WorkloadNetworkResource GetWorkloadNetwork() /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.Get"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.Get"); scope.Start(); try { - var response = await _avsPrivateCloudPrivateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _privateCloudRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new PrivateCloudResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -705,29 +843,29 @@ public virtual async Task> GetAsync(Cancellati /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.Get"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.Get"); scope.Start(); try { - var response = _avsPrivateCloudPrivateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _privateCloudRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new PrivateCloudResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -745,15 +883,15 @@ public virtual Response Get(CancellationToken cancellat /// /// /// Operation Id - /// PrivateClouds_Delete + /// PrivateCloud_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -761,12 +899,12 @@ public virtual Response Get(CancellationToken cancellat /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.Delete"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.Delete"); scope.Start(); try { - var response = await _avsPrivateCloudPrivateCloudsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, _avsPrivateCloudPrivateCloudsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _privateCloudRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_privateCloudClientDiagnostics, Pipeline, _privateCloudRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -787,15 +925,15 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// PrivateClouds_Delete + /// PrivateCloud_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -803,12 +941,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.Delete"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.Delete"); scope.Start(); try { - var response = _avsPrivateCloudPrivateCloudsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, _avsPrivateCloudPrivateCloudsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _privateCloudRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new AvsArmOperation(_privateCloudClientDiagnostics, Pipeline, _privateCloudRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -829,32 +967,32 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// PrivateClouds_Update + /// PrivateCloud_Update /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The private cloud properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, AvsPrivateCloudPatch patch, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PrivateCloudPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.Update"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.Update"); scope.Start(); try { - var response = await _avsPrivateCloudPrivateCloudsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new AvsPrivateCloudOperationSource(Client), _avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, _avsPrivateCloudPrivateCloudsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = await _privateCloudRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new PrivateCloudOperationSource(Client), _privateCloudClientDiagnostics, Pipeline, _privateCloudRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -875,32 +1013,32 @@ public virtual async Task> UpdateAsync(Wai /// /// /// Operation Id - /// PrivateClouds_Update + /// PrivateCloud_Update /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The private cloud properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, AvsPrivateCloudPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, PrivateCloudPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.Update"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.Update"); scope.Start(); try { - var response = _avsPrivateCloudPrivateCloudsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - var operation = new AvsArmOperation(new AvsPrivateCloudOperationSource(Client), _avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, _avsPrivateCloudPrivateCloudsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = _privateCloudRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new AvsArmOperation(new PrivateCloudOperationSource(Client), _privateCloudClientDiagnostics, Pipeline, _privateCloudRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -913,35 +1051,39 @@ public virtual ArmOperation Update(WaitUntil waitUntil, } /// - /// List the admin credentials for the private cloud + /// Rotate the vCenter password /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword /// /// /// Operation Id - /// PrivateClouds_ListAdminCredentials + /// PrivateClouds_RotateVcenterPassword /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual async Task> GetAdminCredentialsAsync(CancellationToken cancellationToken = default) + public virtual async Task RotateVcenterPasswordAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.GetAdminCredentials"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.RotateVcenterPassword"); scope.Start(); try { - var response = await _avsPrivateCloudPrivateCloudsRestClient.ListAdminCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return response; + var response = await _privateCloudRestClient.RotateVcenterPasswordAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_privateCloudClientDiagnostics, Pipeline, _privateCloudRestClient.CreateRotateVcenterPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; } catch (Exception e) { @@ -951,35 +1093,39 @@ public virtual async Task> GetAdminCredentialsAsync(C } /// - /// List the admin credentials for the private cloud + /// Rotate the vCenter password /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword /// /// /// Operation Id - /// PrivateClouds_ListAdminCredentials + /// PrivateClouds_RotateVcenterPassword /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual Response GetAdminCredentials(CancellationToken cancellationToken = default) + public virtual ArmOperation RotateVcenterPassword(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.GetAdminCredentials"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.RotateVcenterPassword"); scope.Start(); try { - var response = _avsPrivateCloudPrivateCloudsRestClient.ListAdminCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return response; + var response = _privateCloudRestClient.RotateVcenterPassword(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new AvsArmOperation(_privateCloudClientDiagnostics, Pipeline, _privateCloudRestClient.CreateRotateVcenterPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; } catch (Exception e) { @@ -1001,11 +1147,11 @@ public virtual Response GetAdminCredentials(CancellationToken /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -1013,12 +1159,12 @@ public virtual Response GetAdminCredentials(CancellationToken /// The cancellation token to use. public virtual async Task RotateNsxtPasswordAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.RotateNsxtPassword"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.RotateNsxtPassword"); scope.Start(); try { - var response = await _avsPrivateCloudPrivateCloudsRestClient.RotateNsxtPasswordAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, _avsPrivateCloudPrivateCloudsRestClient.CreateRotateNsxtPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _privateCloudRestClient.RotateNsxtPasswordAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_privateCloudClientDiagnostics, Pipeline, _privateCloudRestClient.CreateRotateNsxtPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1043,11 +1189,11 @@ public virtual async Task RotateNsxtPasswordAsync(WaitUntil waitUn /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -1055,12 +1201,12 @@ public virtual async Task RotateNsxtPasswordAsync(WaitUntil waitUn /// The cancellation token to use. public virtual ArmOperation RotateNsxtPassword(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.RotateNsxtPassword"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.RotateNsxtPassword"); scope.Start(); try { - var response = _avsPrivateCloudPrivateCloudsRestClient.RotateNsxtPassword(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, _avsPrivateCloudPrivateCloudsRestClient.CreateRotateNsxtPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _privateCloudRestClient.RotateNsxtPassword(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new AvsArmOperation(_privateCloudClientDiagnostics, Pipeline, _privateCloudRestClient.CreateRotateNsxtPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -1073,39 +1219,35 @@ public virtual ArmOperation RotateNsxtPassword(WaitUntil waitUntil, Cancellation } /// - /// Rotate the vCenter password + /// List the admin credentials for the private cloud /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials /// /// /// Operation Id - /// PrivateClouds_RotateVcenterPassword + /// PrivateClouds_ListAdminCredentials /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual async Task RotateVCenterPasswordAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task> GetAdminCredentialsAsync(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.RotateVCenterPassword"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.GetAdminCredentials"); scope.Start(); try { - var response = await _avsPrivateCloudPrivateCloudsRestClient.RotateVcenterPasswordAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, _avsPrivateCloudPrivateCloudsRestClient.CreateRotateVcenterPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + var response = await _privateCloudRestClient.ListAdminCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return response; } catch (Exception e) { @@ -1115,39 +1257,35 @@ public virtual async Task RotateVCenterPasswordAsync(WaitUntil wai } /// - /// Rotate the vCenter password + /// List the admin credentials for the private cloud /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials /// /// /// Operation Id - /// PrivateClouds_RotateVcenterPassword + /// PrivateClouds_ListAdminCredentials /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual ArmOperation RotateVCenterPassword(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual Response GetAdminCredentials(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.RotateVCenterPassword"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.GetAdminCredentials"); scope.Start(); try { - var response = _avsPrivateCloudPrivateCloudsRestClient.RotateVcenterPassword(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_avsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, _avsPrivateCloudPrivateCloudsRestClient.CreateRotateVcenterPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + var response = _privateCloudRestClient.ListAdminCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return response; } catch (Exception e) { @@ -1165,15 +1303,15 @@ public virtual ArmOperation RotateVCenterPassword(WaitUntil waitUntil, Cancellat /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -1181,12 +1319,12 @@ public virtual ArmOperation RotateVCenterPassword(WaitUntil waitUntil, Cancellat /// The value for the tag. /// The cancellation token to use. /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.AddTag"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.AddTag"); scope.Start(); try { @@ -1195,13 +1333,13 @@ public virtual async Task> AddTagAsync(string var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _avsPrivateCloudPrivateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AvsPrivateCloudResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _privateCloudRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PrivateCloudResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new AvsPrivateCloudPatch(); + var patch = new PrivateCloudPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -1227,15 +1365,15 @@ public virtual async Task> AddTagAsync(string /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -1243,12 +1381,12 @@ public virtual async Task> AddTagAsync(string /// The value for the tag. /// The cancellation token to use. /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.AddTag"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.AddTag"); scope.Start(); try { @@ -1257,13 +1395,13 @@ public virtual Response AddTag(string key, string value var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _avsPrivateCloudPrivateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new AvsPrivateCloudResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _privateCloudRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PrivateCloudResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new AvsPrivateCloudPatch(); + var patch = new PrivateCloudPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -1289,26 +1427,26 @@ public virtual Response AddTag(string key, string value /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The set of tags to use as replacement. /// The cancellation token to use. /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.SetTags"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.SetTags"); scope.Start(); try { @@ -1318,13 +1456,13 @@ public virtual async Task> SetTagsAsync(IDicti var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _avsPrivateCloudPrivateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AvsPrivateCloudResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _privateCloudRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PrivateCloudResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new AvsPrivateCloudPatch(); + var patch = new PrivateCloudPatch(); patch.Tags.ReplaceWith(tags); var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); @@ -1346,26 +1484,26 @@ public virtual async Task> SetTagsAsync(IDicti /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The set of tags to use as replacement. /// The cancellation token to use. /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.SetTags"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.SetTags"); scope.Start(); try { @@ -1375,13 +1513,13 @@ public virtual Response SetTags(IDictionary SetTags(IDictionary /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The key for the tag. /// The cancellation token to use. /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.RemoveTag"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.RemoveTag"); scope.Start(); try { @@ -1431,13 +1569,13 @@ public virtual async Task> RemoveTagAsync(stri var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _avsPrivateCloudPrivateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AvsPrivateCloudResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _privateCloudRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PrivateCloudResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new AvsPrivateCloudPatch(); + var patch = new PrivateCloudPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -1463,26 +1601,26 @@ public virtual async Task> RemoveTagAsync(stri /// /// /// Operation Id - /// PrivateClouds_Get + /// PrivateCloud_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The key for the tag. /// The cancellation token to use. /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); - using var scope = _avsPrivateCloudPrivateCloudsClientDiagnostics.CreateScope("AvsPrivateCloudResource.RemoveTag"); + using var scope = _privateCloudClientDiagnostics.CreateScope("PrivateCloudResource.RemoveTag"); scope.Start(); try { @@ -1491,13 +1629,13 @@ public virtual Response RemoveTag(string key, Cancellat var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _avsPrivateCloudPrivateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new AvsPrivateCloudResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _privateCloudRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PrivateCloudResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new AvsPrivateCloudPatch(); + var patch = new PrivateCloudPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkCollection.cs new file mode 100644 index 000000000000..2b2460168833 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkCollection.cs @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetProvisionedNetworks method from an instance of . + /// + public partial class ProvisionedNetworkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _provisionedNetworkClientDiagnostics; + private readonly ProvisionedNetworksRestOperations _provisionedNetworkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ProvisionedNetworkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ProvisionedNetworkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _provisionedNetworkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ProvisionedNetworkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ProvisionedNetworkResource.ResourceType, out string provisionedNetworkApiVersion); + _provisionedNetworkRestClient = new ProvisionedNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, provisionedNetworkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloudResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloudResource.ResourceType), nameof(id)); + } + + /// + /// Get a ProvisionedNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName} + /// + /// + /// Operation Id + /// ProvisionedNetwork_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the cloud link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string provisionedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(provisionedNetworkName, nameof(provisionedNetworkName)); + + using var scope = _provisionedNetworkClientDiagnostics.CreateScope("ProvisionedNetworkCollection.Get"); + scope.Start(); + try + { + var response = await _provisionedNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, provisionedNetworkName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ProvisionedNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ProvisionedNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName} + /// + /// + /// Operation Id + /// ProvisionedNetwork_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the cloud link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string provisionedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(provisionedNetworkName, nameof(provisionedNetworkName)); + + using var scope = _provisionedNetworkClientDiagnostics.CreateScope("ProvisionedNetworkCollection.Get"); + scope.Start(); + try + { + var response = _provisionedNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, provisionedNetworkName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ProvisionedNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List ProvisionedNetwork resources by PrivateCloud + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks + /// + /// + /// Operation Id + /// ProvisionedNetwork_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _provisionedNetworkRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _provisionedNetworkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProvisionedNetworkResource(Client, ProvisionedNetworkData.DeserializeProvisionedNetworkData(e)), _provisionedNetworkClientDiagnostics, Pipeline, "ProvisionedNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List ProvisionedNetwork resources by PrivateCloud + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks + /// + /// + /// Operation Id + /// ProvisionedNetwork_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _provisionedNetworkRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _provisionedNetworkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProvisionedNetworkResource(Client, ProvisionedNetworkData.DeserializeProvisionedNetworkData(e)), _provisionedNetworkClientDiagnostics, Pipeline, "ProvisionedNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName} + /// + /// + /// Operation Id + /// ProvisionedNetwork_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the cloud link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string provisionedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(provisionedNetworkName, nameof(provisionedNetworkName)); + + using var scope = _provisionedNetworkClientDiagnostics.CreateScope("ProvisionedNetworkCollection.Exists"); + scope.Start(); + try + { + var response = await _provisionedNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, provisionedNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName} + /// + /// + /// Operation Id + /// ProvisionedNetwork_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the cloud link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string provisionedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(provisionedNetworkName, nameof(provisionedNetworkName)); + + using var scope = _provisionedNetworkClientDiagnostics.CreateScope("ProvisionedNetworkCollection.Exists"); + scope.Start(); + try + { + var response = _provisionedNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, provisionedNetworkName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName} + /// + /// + /// Operation Id + /// ProvisionedNetwork_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the cloud link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string provisionedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(provisionedNetworkName, nameof(provisionedNetworkName)); + + using var scope = _provisionedNetworkClientDiagnostics.CreateScope("ProvisionedNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _provisionedNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, provisionedNetworkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProvisionedNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName} + /// + /// + /// Operation Id + /// ProvisionedNetwork_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the cloud link. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string provisionedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(provisionedNetworkName, nameof(provisionedNetworkName)); + + using var scope = _provisionedNetworkClientDiagnostics.CreateScope("ProvisionedNetworkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _provisionedNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, provisionedNetworkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ProvisionedNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkData.Serialization.cs new file mode 100644 index 000000000000..551ca2aa1c9a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkData.Serialization.cs @@ -0,0 +1,155 @@ +// 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; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class ProvisionedNetworkData : 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 override 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(ProvisionedNetworkData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + ProvisionedNetworkData 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(ProvisionedNetworkData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProvisionedNetworkData(document.RootElement, options); + } + + internal static ProvisionedNetworkData DeserializeProvisionedNetworkData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisionedNetworkProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ProvisionedNetworkProperties.DeserializeProvisionedNetworkProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProvisionedNetworkData( + id, + name, + type, + systemData, + properties, + 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); + default: + throw new FormatException($"The model {nameof(ProvisionedNetworkData)} does not support writing '{options.Format}' format."); + } + } + + ProvisionedNetworkData 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 DeserializeProvisionedNetworkData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProvisionedNetworkData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkData.cs new file mode 100644 index 000000000000..0dba2e03af8a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing the ProvisionedNetwork data model. + /// A provisioned network resource + /// + public partial class ProvisionedNetworkData : ResourceData + { + /// + /// 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 . + internal ProvisionedNetworkData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal ProvisionedNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisionedNetworkProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public ProvisionedNetworkProperties Properties { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkResource.Serialization.cs new file mode 100644 index 000000000000..f449f44546ed --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Avs +{ + public partial class ProvisionedNetworkResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ProvisionedNetworkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + ProvisionedNetworkData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkResource.cs new file mode 100644 index 000000000000..227fc5613341 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ProvisionedNetworkResource.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A Class representing a ProvisionedNetwork along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetProvisionedNetworkResource method. + /// Otherwise you can get one from its parent resource using the GetProvisionedNetwork method. + /// + public partial class ProvisionedNetworkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The provisionedNetworkName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string provisionedNetworkName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _provisionedNetworkClientDiagnostics; + private readonly ProvisionedNetworksRestOperations _provisionedNetworkRestClient; + private readonly ProvisionedNetworkData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/provisionedNetworks"; + + /// Initializes a new instance of the class for mocking. + protected ProvisionedNetworkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ProvisionedNetworkResource(ArmClient client, ProvisionedNetworkData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ProvisionedNetworkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _provisionedNetworkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string provisionedNetworkApiVersion); + _provisionedNetworkRestClient = new ProvisionedNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, provisionedNetworkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ProvisionedNetworkData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a ProvisionedNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName} + /// + /// + /// Operation Id + /// ProvisionedNetwork_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _provisionedNetworkClientDiagnostics.CreateScope("ProvisionedNetworkResource.Get"); + scope.Start(); + try + { + var response = await _provisionedNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ProvisionedNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ProvisionedNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/provisionedNetworks/{provisionedNetworkName} + /// + /// + /// Operation Id + /// ProvisionedNetwork_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _provisionedNetworkClientDiagnostics.CreateScope("ProvisionedNetworkResource.Get"); + scope.Start(); + try + { + var response = _provisionedNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ProvisionedNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyCollection.cs new file mode 100644 index 000000000000..47f49c39e4f5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetPureStoragePolicies method from an instance of . + /// + public partial class PureStoragePolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _pureStoragePolicyClientDiagnostics; + private readonly PureStoragePoliciesRestOperations _pureStoragePolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected PureStoragePolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal PureStoragePolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _pureStoragePolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", PureStoragePolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PureStoragePolicyResource.ResourceType, out string pureStoragePolicyApiVersion); + _pureStoragePolicyRestClient = new PureStoragePoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, pureStoragePolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloudResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloudResource.ResourceType), nameof(id)); + } + + /// + /// Create a PureStoragePolicy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} + /// + /// + /// Operation Id + /// PureStoragePolicy_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the storage policy. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string storagePolicyName, PureStoragePolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _pureStoragePolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storagePolicyName, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new PureStoragePolicyOperationSource(Client), _pureStoragePolicyClientDiagnostics, Pipeline, _pureStoragePolicyRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storagePolicyName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a PureStoragePolicy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} + /// + /// + /// Operation Id + /// PureStoragePolicy_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the storage policy. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string storagePolicyName, PureStoragePolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _pureStoragePolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storagePolicyName, data, cancellationToken); + var operation = new AvsArmOperation(new PureStoragePolicyOperationSource(Client), _pureStoragePolicyClientDiagnostics, Pipeline, _pureStoragePolicyRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storagePolicyName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a PureStoragePolicy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} + /// + /// + /// Operation Id + /// PureStoragePolicy_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the storage policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string storagePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyCollection.Get"); + scope.Start(); + try + { + var response = await _pureStoragePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storagePolicyName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PureStoragePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a PureStoragePolicy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} + /// + /// + /// Operation Id + /// PureStoragePolicy_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the storage policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string storagePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyCollection.Get"); + scope.Start(); + try + { + var response = _pureStoragePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storagePolicyName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PureStoragePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List PureStoragePolicy resources by PrivateCloud + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies + /// + /// + /// Operation Id + /// PureStoragePolicy_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _pureStoragePolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _pureStoragePolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PureStoragePolicyResource(Client, PureStoragePolicyData.DeserializePureStoragePolicyData(e)), _pureStoragePolicyClientDiagnostics, Pipeline, "PureStoragePolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List PureStoragePolicy resources by PrivateCloud + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies + /// + /// + /// Operation Id + /// PureStoragePolicy_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _pureStoragePolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _pureStoragePolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PureStoragePolicyResource(Client, PureStoragePolicyData.DeserializePureStoragePolicyData(e)), _pureStoragePolicyClientDiagnostics, Pipeline, "PureStoragePolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} + /// + /// + /// Operation Id + /// PureStoragePolicy_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the storage policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string storagePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _pureStoragePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storagePolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} + /// + /// + /// Operation Id + /// PureStoragePolicy_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the storage policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string storagePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyCollection.Exists"); + scope.Start(); + try + { + var response = _pureStoragePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storagePolicyName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} + /// + /// + /// Operation Id + /// PureStoragePolicy_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the storage policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string storagePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _pureStoragePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storagePolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PureStoragePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} + /// + /// + /// Operation Id + /// PureStoragePolicy_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the storage policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string storagePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _pureStoragePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, storagePolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PureStoragePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyData.Serialization.cs similarity index 67% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonData.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyData.Serialization.cs index f7c1ff6d0e63..24584a5fc9e6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.Avs { - public partial class AvsPrivateCloudAddonData : IUtf8JsonSerializable, IJsonModel + public partial class PureStoragePolicyData : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -30,10 +30,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(PureStoragePolicyData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -44,19 +44,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - AvsPrivateCloudAddonData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PureStoragePolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(PureStoragePolicyData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAvsPrivateCloudAddonData(document.RootElement, options); + return DeserializePureStoragePolicyData(document.RootElement, options); } - internal static AvsPrivateCloudAddonData DeserializeAvsPrivateCloudAddonData(JsonElement element, ModelReaderWriterOptions options = null) + internal static PureStoragePolicyData DeserializePureStoragePolicyData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -64,7 +64,7 @@ internal static AvsPrivateCloudAddonData DeserializeAvsPrivateCloudAddonData(Jso { return null; } - AvsPrivateCloudAddonProperties properties = default; + PureStoragePolicyProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; @@ -79,7 +79,7 @@ internal static AvsPrivateCloudAddonData DeserializeAvsPrivateCloudAddonData(Jso { continue; } - properties = AvsPrivateCloudAddonProperties.DeserializeAvsPrivateCloudAddonProperties(property.Value, options); + properties = PureStoragePolicyProperties.DeserializePureStoragePolicyProperties(property.Value, options); continue; } if (property.NameEquals("id"u8)) @@ -112,7 +112,7 @@ internal static AvsPrivateCloudAddonData DeserializeAvsPrivateCloudAddonData(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new AvsPrivateCloudAddonData( + return new PureStoragePolicyData( id, name, type, @@ -121,35 +121,35 @@ internal static AvsPrivateCloudAddonData DeserializeAvsPrivateCloudAddonData(Jso serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(PureStoragePolicyData)} does not support writing '{options.Format}' format."); } } - AvsPrivateCloudAddonData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PureStoragePolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAvsPrivateCloudAddonData(document.RootElement, options); + return DeserializePureStoragePolicyData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AvsPrivateCloudAddonData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(PureStoragePolicyData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyData.cs new file mode 100644 index 000000000000..0d00ce8c7913 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing the PureStoragePolicy data model. + /// An instance describing a Pure Storage Policy Based Management policy + /// + public partial class PureStoragePolicyData : ResourceData + { + /// + /// 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 . + public PureStoragePolicyData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal PureStoragePolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PureStoragePolicyProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public PureStoragePolicyProperties Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyResource.Serialization.cs new file mode 100644 index 000000000000..5824c74f576e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Avs +{ + public partial class PureStoragePolicyResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + PureStoragePolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + PureStoragePolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyResource.cs similarity index 58% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpResource.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyResource.cs index 5054a8e50ccc..9422ad1c5dd3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PureStoragePolicyResource.cs @@ -15,53 +15,53 @@ namespace Azure.ResourceManager.Avs { /// - /// A Class representing a WorkloadNetworkDhcp along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetWorkloadNetworkDhcpResource method. - /// Otherwise you can get one from its parent resource using the GetWorkloadNetworkDhcp method. + /// A Class representing a PureStoragePolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetPureStoragePolicyResource method. + /// Otherwise you can get one from its parent resource using the GetPureStoragePolicy method. /// - public partial class WorkloadNetworkDhcpResource : ArmResource + public partial class PureStoragePolicyResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The privateCloudName. - /// The dhcpId. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) + /// The storagePolicyName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName) { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"; + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _workloadNetworkDhcpWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkDhcpWorkloadNetworksRestClient; - private readonly WorkloadNetworkDhcpData _data; + private readonly ClientDiagnostics _pureStoragePolicyClientDiagnostics; + private readonly PureStoragePoliciesRestOperations _pureStoragePolicyRestClient; + private readonly PureStoragePolicyData _data; /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/dhcpConfigurations"; + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/pureStoragePolicies"; - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkDhcpResource() + /// Initializes a new instance of the class for mocking. + protected PureStoragePolicyResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal WorkloadNetworkDhcpResource(ArmClient client, WorkloadNetworkDhcpData data) : this(client, data.Id) + internal PureStoragePolicyResource(ArmClient client, PureStoragePolicyData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal WorkloadNetworkDhcpResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal PureStoragePolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _workloadNetworkDhcpWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string workloadNetworkDhcpWorkloadNetworksApiVersion); - _workloadNetworkDhcpWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkDhcpWorkloadNetworksApiVersion); + _pureStoragePolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string pureStoragePolicyApiVersion); + _pureStoragePolicyRestClient = new PureStoragePoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, pureStoragePolicyApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -72,7 +72,7 @@ internal WorkloadNetworkDhcpResource(ArmClient client, ResourceIdentifier id) : /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual WorkloadNetworkDhcpData Data + public virtual PureStoragePolicyData Data { get { @@ -89,37 +89,37 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Get a WorkloadNetworkDhcp + /// Get a PureStoragePolicy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} /// /// /// Operation Id - /// WorkloadNetworks_GetDhcp + /// PureStoragePolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpResource.Get"); + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyResource.Get"); scope.Start(); try { - var response = await _workloadNetworkDhcpWorkloadNetworksRestClient.GetDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _pureStoragePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDhcpResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new PureStoragePolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -129,37 +129,37 @@ public virtual async Task> GetAsync(Cancel } /// - /// Get a WorkloadNetworkDhcp + /// Get a PureStoragePolicy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} /// /// /// Operation Id - /// WorkloadNetworks_GetDhcp + /// PureStoragePolicy_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpResource.Get"); + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyResource.Get"); scope.Start(); try { - var response = _workloadNetworkDhcpWorkloadNetworksRestClient.GetDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var response = _pureStoragePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDhcpResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new PureStoragePolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -169,23 +169,23 @@ public virtual Response Get(CancellationToken cance } /// - /// Delete a WorkloadNetworkDhcp + /// Delete a PureStoragePolicy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} /// /// /// Operation Id - /// WorkloadNetworks_DeleteDhcp + /// PureStoragePolicy_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -193,12 +193,12 @@ public virtual Response Get(CancellationToken cance /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpResource.Delete"); + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyResource.Delete"); scope.Start(); try { - var response = await _workloadNetworkDhcpWorkloadNetworksRestClient.DeleteDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDhcpWorkloadNetworksRestClient.CreateDeleteDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _pureStoragePolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_pureStoragePolicyClientDiagnostics, Pipeline, _pureStoragePolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -211,23 +211,23 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete a WorkloadNetworkDhcp + /// Delete a PureStoragePolicy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} /// /// /// Operation Id - /// WorkloadNetworks_DeleteDhcp + /// PureStoragePolicy_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -235,12 +235,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpResource.Delete"); + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyResource.Delete"); scope.Start(); try { - var response = _workloadNetworkDhcpWorkloadNetworksRestClient.DeleteDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDhcpWorkloadNetworksRestClient.CreateDeleteDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _pureStoragePolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new AvsArmOperation(_pureStoragePolicyClientDiagnostics, Pipeline, _pureStoragePolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -253,40 +253,40 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Update a WorkloadNetworkDhcp + /// Create a PureStoragePolicy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} /// /// /// Operation Id - /// WorkloadNetworks_UpdateDhcp + /// PureStoragePolicy_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. + /// Resource create parameters. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, WorkloadNetworkDhcpData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PureStoragePolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpResource.Update"); + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyResource.Update"); scope.Start(); try { - var response = await _workloadNetworkDhcpWorkloadNetworksRestClient.UpdateDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkDhcpOperationSource(Client), _workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDhcpWorkloadNetworksRestClient.CreateUpdateDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = await _pureStoragePolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new PureStoragePolicyOperationSource(Client), _pureStoragePolicyClientDiagnostics, Pipeline, _pureStoragePolicyRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -299,40 +299,40 @@ public virtual async Task> UpdateAsync } /// - /// Update a WorkloadNetworkDhcp + /// Create a PureStoragePolicy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/pureStoragePolicies/{storagePolicyName} /// /// /// Operation Id - /// WorkloadNetworks_UpdateDhcp + /// PureStoragePolicy_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. + /// Resource create parameters. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, WorkloadNetworkDhcpData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, PureStoragePolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpResource.Update"); + using var scope = _pureStoragePolicyClientDiagnostics.CreateScope("PureStoragePolicyResource.Update"); scope.Start(); try { - var response = _workloadNetworkDhcpWorkloadNetworksRestClient.UpdateDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkDhcpOperationSource(Client), _workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDhcpWorkloadNetworksRestClient.CreateUpdateDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = _pureStoragePolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new AvsArmOperation(new PureStoragePolicyOperationSource(Client), _pureStoragePolicyClientDiagnostics, Pipeline, _pureStoragePolicyRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs index 3549c05e7741..39f26298d029 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs @@ -25,14 +25,14 @@ internal partial class AddonsRestOperations /// Initializes a new instance of AddonsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public AddonsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -176,7 +176,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -189,13 +189,13 @@ public async Task> GetAsync(string subscripti { case 200: { - AvsPrivateCloudAddonData value = default; + AddonData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AvsPrivateCloudAddonData.DeserializeAvsPrivateCloudAddonData(document.RootElement); + value = AddonData.DeserializeAddonData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsPrivateCloudAddonData)null, message.Response); + return Response.FromValue((AddonData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -209,7 +209,7 @@ public async Task> GetAsync(string subscripti /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -222,19 +222,19 @@ public Response Get(string subscriptionId, string reso { case 200: { - AvsPrivateCloudAddonData value = default; + AddonData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AvsPrivateCloudAddonData.DeserializeAvsPrivateCloudAddonData(document.RootElement); + value = AddonData.DeserializeAddonData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsPrivateCloudAddonData)null, message.Response); + return Response.FromValue((AddonData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AvsPrivateCloudAddonData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AddonData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -250,7 +250,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AvsPrivateCloudAddonData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AddonData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -285,7 +285,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AvsPrivateCloudAddonData data, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AddonData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -314,7 +314,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AvsPrivateCloudAddonData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AddonData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs index f2034264fa7d..dbe1bb1be9d0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs @@ -25,14 +25,14 @@ internal partial class AuthorizationsRestOperations /// Initializes a new instance of AuthorizationsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public AuthorizationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs index 442752a3b7c3..d9efc67e78c4 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs @@ -25,14 +25,14 @@ internal partial class CloudLinksRestOperations /// Initializes a new instance of CloudLinksRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public CloudLinksRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -176,7 +176,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -189,13 +189,13 @@ public async Task> GetAsync(string subscriptionId, st { case 200: { - AvsCloudLinkData value = default; + CloudLinkData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AvsCloudLinkData.DeserializeAvsCloudLinkData(document.RootElement); + value = CloudLinkData.DeserializeCloudLinkData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsCloudLinkData)null, message.Response); + return Response.FromValue((CloudLinkData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -209,7 +209,7 @@ public async Task> GetAsync(string subscriptionId, st /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -222,19 +222,19 @@ public Response Get(string subscriptionId, string resourceGrou { case 200: { - AvsCloudLinkData value = default; + CloudLinkData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AvsCloudLinkData.DeserializeAvsCloudLinkData(document.RootElement); + value = CloudLinkData.DeserializeCloudLinkData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsCloudLinkData)null, message.Response); + return Response.FromValue((CloudLinkData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, AvsCloudLinkData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -250,7 +250,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, AvsCloudLinkData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -285,7 +285,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, AvsCloudLinkData data, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -314,7 +314,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, AvsCloudLinkData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs index 8b7d05eb87cd..0af416679a24 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs @@ -25,14 +25,14 @@ internal partial class ClustersRestOperations /// Initializes a new instance of ClustersRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public ClustersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -176,7 +176,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -189,13 +189,13 @@ public async Task> GetAsync(string subscrip { case 200: { - AvsPrivateCloudClusterData value = default; + ClusterData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AvsPrivateCloudClusterData.DeserializeAvsPrivateCloudClusterData(document.RootElement); + value = ClusterData.DeserializeClusterData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsPrivateCloudClusterData)null, message.Response); + return Response.FromValue((ClusterData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -209,7 +209,7 @@ public async Task> GetAsync(string subscrip /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -222,19 +222,19 @@ public Response Get(string subscriptionId, string re { case 200: { - AvsPrivateCloudClusterData value = default; + ClusterData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AvsPrivateCloudClusterData.DeserializeAvsPrivateCloudClusterData(document.RootElement); + value = ClusterData.DeserializeClusterData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsPrivateCloudClusterData)null, message.Response); + return Response.FromValue((ClusterData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, AvsPrivateCloudClusterData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -250,7 +250,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, AvsPrivateCloudClusterData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -285,7 +285,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, AvsPrivateCloudClusterData data, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -314,7 +314,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, AvsPrivateCloudClusterData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -334,7 +334,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, AvsPrivateCloudClusterPatch patch) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterPatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -350,7 +350,7 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, AvsPrivateCloudClusterPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -381,11 +381,11 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster. - /// The cluster properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, AvsPrivateCloudClusterPatch patch, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -410,11 +410,11 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster. - /// The cluster properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, AvsPrivateCloudClusterPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs index 3562ddd5ea4a..ce283a7f198f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs @@ -25,14 +25,14 @@ internal partial class DatastoresRestOperations /// Initializes a new instance of DatastoresRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public DatastoresRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -189,7 +189,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -203,13 +203,13 @@ public async Task> GetAsync(string subscr { case 200: { - AvsPrivateCloudDatastoreData value = default; + DatastoreData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AvsPrivateCloudDatastoreData.DeserializeAvsPrivateCloudDatastoreData(document.RootElement); + value = DatastoreData.DeserializeDatastoreData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsPrivateCloudDatastoreData)null, message.Response); + return Response.FromValue((DatastoreData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -224,7 +224,7 @@ public async Task> GetAsync(string subscr /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -238,19 +238,19 @@ public Response Get(string subscriptionId, string { case 200: { - AvsPrivateCloudDatastoreData value = default; + DatastoreData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AvsPrivateCloudDatastoreData.DeserializeAvsPrivateCloudDatastoreData(document.RootElement); + value = DatastoreData.DeserializeDatastoreData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsPrivateCloudDatastoreData)null, message.Response); + return Response.FromValue((DatastoreData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, AvsPrivateCloudDatastoreData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -268,7 +268,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, AvsPrivateCloudDatastoreData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -306,7 +306,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The cancellation token to use. /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, AvsPrivateCloudDatastoreData data, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -337,7 +337,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re /// The cancellation token to use. /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, AvsPrivateCloudDatastoreData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs index 4fa97203e62b..7897adc1762d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs @@ -25,14 +25,14 @@ internal partial class GlobalReachConnectionsRestOperations /// Initializes a new instance of GlobalReachConnectionsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public GlobalReachConnectionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs index 01f1b7657159..d16984ef2417 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs @@ -25,14 +25,14 @@ internal partial class HcxEnterpriseSitesRestOperations /// Initializes a new instance of HcxEnterpriseSitesRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public HcxEnterpriseSitesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HostsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HostsRestOperations.cs new file mode 100644 index 000000000000..6cafb50e3d2c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HostsRestOperations.cs @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class HostsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of HostsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public HostsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/hosts", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/hosts", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Host resources by Cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + HostListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = HostListResult.DeserializeHostListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Host resources by Cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + HostListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = HostListResult.DeserializeHostListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string hostId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/hosts/", false); + uri.AppendPath(hostId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string hostId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/hosts/", false); + uri.AppendPath(hostId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Host. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster. + /// The host identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string hostId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + Argument.AssertNotNullOrEmpty(hostId, nameof(hostId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, hostId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + HostData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = HostData.DeserializeHostData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((HostData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Host. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster. + /// The host identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string hostId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + Argument.AssertNotNullOrEmpty(hostId, nameof(hostId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, hostId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + HostData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = HostData.DeserializeHostData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((HostData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Host resources by Cluster. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + HostListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = HostListResult.DeserializeHostListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Host resources by Cluster. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + HostListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = HostListResult.DeserializeHostListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/IscsiPathsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/IscsiPathsRestOperations.cs index 89d927b5de4f..2ef79b36d3f0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/IscsiPathsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/IscsiPathsRestOperations.cs @@ -25,14 +25,14 @@ internal partial class IscsiPathsRestOperations /// Initializes a new instance of IscsiPathsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public IscsiPathsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs index 851331278330..083fbd99bcbb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs @@ -25,18 +25,18 @@ internal partial class LocationsRestOperations /// Initializes a new instance of LocationsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public LocationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCheckQuotaAvailabilityRequestUri(string subscriptionId, AzureLocation location) + internal RequestUriBuilder CreateCheckTrialAvailabilityRequestUri(string subscriptionId, string location, AvsSku sku) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -44,12 +44,12 @@ internal RequestUriBuilder CreateCheckQuotaAvailabilityRequestUri(string subscri uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.AVS/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/checkQuotaAvailability", false); + uri.AppendPath("/checkTrialAvailability", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCheckQuotaAvailabilityRequest(string subscriptionId, AzureLocation location) + internal HttpMessage CreateCheckTrialAvailabilityRequest(string subscriptionId, string location, AvsSku sku) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -60,33 +60,42 @@ internal HttpMessage CreateCheckQuotaAvailabilityRequest(string subscriptionId, uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.AVS/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/checkQuotaAvailability", false); + uri.AppendPath("/checkTrialAvailability", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + if (sku != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(sku, ModelSerializationExtensions.WireOptions); + request.Content = content; + } _userAgent.Apply(message); return message; } - /// Return quota for subscription by region. + /// Return trial status for subscription by region. /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. + /// A location in a subscription. + /// Optionally, check for a specific SKU. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> CheckQuotaAvailabilityAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> CheckTrialAvailabilityAsync(string subscriptionId, string location, AvsSku sku = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); - using var message = CreateCheckQuotaAvailabilityRequest(subscriptionId, location); + using var message = CreateCheckTrialAvailabilityRequest(subscriptionId, location, sku); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - AvsSubscriptionQuotaAvailabilityResult value = default; + Trial value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AvsSubscriptionQuotaAvailabilityResult.DeserializeAvsSubscriptionQuotaAvailabilityResult(document.RootElement); + value = Trial.DeserializeTrial(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -94,25 +103,27 @@ public async Task> CheckQuotaAv } } - /// Return quota for subscription by region. + /// Return trial status for subscription by region. /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. + /// A location in a subscription. + /// Optionally, check for a specific SKU. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response CheckQuotaAvailability(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response CheckTrialAvailability(string subscriptionId, string location, AvsSku sku = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); - using var message = CreateCheckQuotaAvailabilityRequest(subscriptionId, location); + using var message = CreateCheckTrialAvailabilityRequest(subscriptionId, location, sku); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - AvsSubscriptionQuotaAvailabilityResult value = default; + Trial value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AvsSubscriptionQuotaAvailabilityResult.DeserializeAvsSubscriptionQuotaAvailabilityResult(document.RootElement); + value = Trial.DeserializeTrial(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -120,7 +131,7 @@ public Response CheckQuotaAvailability(s } } - internal RequestUriBuilder CreateCheckTrialAvailabilityRequestUri(string subscriptionId, AzureLocation location, AvsSku sku) + internal RequestUriBuilder CreateCheckQuotaAvailabilityRequestUri(string subscriptionId, string location) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -128,12 +139,12 @@ internal RequestUriBuilder CreateCheckTrialAvailabilityRequestUri(string subscri uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.AVS/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/checkTrialAvailability", false); + uri.AppendPath("/checkQuotaAvailability", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCheckTrialAvailabilityRequest(string subscriptionId, AzureLocation location, AvsSku sku) + internal HttpMessage CreateCheckQuotaAvailabilityRequest(string subscriptionId, string location) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -144,41 +155,34 @@ internal HttpMessage CreateCheckTrialAvailabilityRequest(string subscriptionId, uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.AVS/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/checkTrialAvailability", false); + uri.AppendPath("/checkQuotaAvailability", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - if (sku != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(sku, ModelSerializationExtensions.WireOptions); - request.Content = content; - } _userAgent.Apply(message); return message; } - /// Return trial status for subscription by region. + /// Return quota for subscription by region. /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// Optionally, check for a specific SKU. + /// A location in a subscription. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> CheckTrialAvailabilityAsync(string subscriptionId, AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> CheckQuotaAvailabilityAsync(string subscriptionId, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); - using var message = CreateCheckTrialAvailabilityRequest(subscriptionId, location, sku); + using var message = CreateCheckQuotaAvailabilityRequest(subscriptionId, location); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - AvsSubscriptionTrialAvailabilityResult value = default; + Quota value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AvsSubscriptionTrialAvailabilityResult.DeserializeAvsSubscriptionTrialAvailabilityResult(document.RootElement); + value = Quota.DeserializeQuota(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -186,26 +190,26 @@ public async Task> CheckTrialAv } } - /// Return trial status for subscription by region. + /// Return quota for subscription by region. /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// Optionally, check for a specific SKU. + /// A location in a subscription. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response CheckTrialAvailability(string subscriptionId, AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response CheckQuotaAvailability(string subscriptionId, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); - using var message = CreateCheckTrialAvailabilityRequest(subscriptionId, location, sku); + using var message = CreateCheckQuotaAvailabilityRequest(subscriptionId, location); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - AvsSubscriptionTrialAvailabilityResult value = default; + Quota value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AvsSubscriptionTrialAvailabilityResult.DeserializeAvsSubscriptionTrialAvailabilityResult(document.RootElement); + value = Quota.DeserializeQuota(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs index 43a62b8636eb..1c276d379d9f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs @@ -25,14 +25,14 @@ internal partial class PlacementPoliciesRestOperations /// Initializes a new instance of PlacementPoliciesRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public PlacementPoliciesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -410,7 +410,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// Name of the private cloud. /// Name of the cluster. /// Name of the placement policy. - /// The placement policy properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. @@ -441,7 +441,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr /// Name of the private cloud. /// Name of the cluster. /// Name of the placement policy. - /// The placement policy properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs index 247b2b887348..92a4c9347b00 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs @@ -25,29 +25,31 @@ internal partial class PrivateCloudsRestOperations /// Initializes a new instance of PrivateCloudsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public PrivateCloudsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListInSubscriptionRequestUri(string subscriptionId) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AVS/privateClouds", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListInSubscriptionRequest(string subscriptionId) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -56,6 +58,8 @@ internal HttpMessage CreateListInSubscriptionRequest(string subscriptionId) uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AVS/privateClouds", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -64,16 +68,18 @@ internal HttpMessage CreateListInSubscriptionRequest(string subscriptionId) return message; } - /// List PrivateCloud resources by subscription ID. + /// List PrivateCloud resources by resource group. /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListInSubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListInSubscriptionRequest(subscriptionId); + using var message = CreateListRequest(subscriptionId, resourceGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -89,16 +95,18 @@ public async Task> ListInSubscriptionAsync(string sub } } - /// List PrivateCloud resources by subscription ID. + /// List PrivateCloud resources by resource group. /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListInSubscription(string subscriptionId, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListInSubscriptionRequest(subscriptionId); + using var message = CreateListRequest(subscriptionId, resourceGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -114,20 +122,18 @@ public Response ListInSubscription(string subscriptionId, Canc } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName) + internal RequestUriBuilder CreateListInSubscriptionRequestUri(string subscriptionId) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AVS/privateClouds", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName) + internal HttpMessage CreateListInSubscriptionRequest(string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -136,8 +142,6 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AVS/privateClouds", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -146,18 +150,16 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro return message; } - /// List PrivateCloud resources by resource group. + /// List PrivateCloud resources by subscription ID. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListInSubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName); + using var message = CreateListInSubscriptionRequest(subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -173,18 +175,16 @@ public async Task> ListAsync(string subscriptionId, s } } - /// List PrivateCloud resources by resource group. + /// List PrivateCloud resources by subscription ID. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListInSubscription(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName); + using var message = CreateListInSubscriptionRequest(subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -241,7 +241,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -253,13 +253,13 @@ public async Task> GetAsync(string subscriptionId, { case 200: { - AvsPrivateCloudData value = default; + PrivateCloudData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AvsPrivateCloudData.DeserializeAvsPrivateCloudData(document.RootElement); + value = PrivateCloudData.DeserializePrivateCloudData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsPrivateCloudData)null, message.Response); + return Response.FromValue((PrivateCloudData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -272,7 +272,7 @@ public async Task> GetAsync(string subscriptionId, /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -284,19 +284,19 @@ public Response Get(string subscriptionId, string resourceG { case 200: { - AvsPrivateCloudData value = default; + PrivateCloudData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AvsPrivateCloudData.DeserializeAvsPrivateCloudData(document.RootElement); + value = PrivateCloudData.DeserializePrivateCloudData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsPrivateCloudData)null, message.Response); + return Response.FromValue((PrivateCloudData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, AvsPrivateCloudData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -310,7 +310,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, AvsPrivateCloudData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -342,7 +342,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, AvsPrivateCloudData data, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -369,7 +369,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, AvsPrivateCloudData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -388,7 +388,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, AvsPrivateCloudPatch patch) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudPatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -402,7 +402,7 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, AvsPrivateCloudPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -430,11 +430,11 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. - /// The private cloud properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, AvsPrivateCloudPatch patch, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -457,11 +457,11 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. - /// The private cloud properties to be updated. + /// The resource properties to be updated. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, AvsPrivateCloudPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -566,7 +566,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string p } } - internal RequestUriBuilder CreateListAdminCredentialsRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + internal RequestUriBuilder CreateRotateVcenterPasswordRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -576,12 +576,12 @@ internal RequestUriBuilder CreateListAdminCredentialsRequestUri(string subscript uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); uri.AppendPath(privateCloudName, true); - uri.AppendPath("/listAdminCredentials", false); + uri.AppendPath("/rotateVcenterPassword", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListAdminCredentialsRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateRotateVcenterPasswordRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -594,7 +594,7 @@ internal HttpMessage CreateListAdminCredentialsRequest(string subscriptionId, st uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); uri.AppendPath(privateCloudName, true); - uri.AppendPath("/listAdminCredentials", false); + uri.AppendPath("/rotateVcenterPassword", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -602,59 +602,51 @@ internal HttpMessage CreateListAdminCredentialsRequest(string subscriptionId, st return message; } - /// List the admin credentials for the private cloud. + /// Rotate the vCenter password. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAdminCredentialsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + public async Task RotateVcenterPasswordAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var message = CreateListAdminCredentialsRequest(subscriptionId, resourceGroupName, privateCloudName); + using var message = CreateRotateVcenterPasswordRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: - { - AdminCredentials value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AdminCredentials.DeserializeAdminCredentials(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List the admin credentials for the private cloud. + /// Rotate the vCenter password. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListAdminCredentials(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + public Response RotateVcenterPassword(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var message = CreateListAdminCredentialsRequest(subscriptionId, resourceGroupName, privateCloudName); + using var message = CreateRotateVcenterPasswordRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: - { - AdminCredentials value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AdminCredentials.DeserializeAdminCredentials(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } @@ -746,7 +738,7 @@ public Response RotateNsxtPassword(string subscriptionId, string resourceGroupNa } } - internal RequestUriBuilder CreateRotateVcenterPasswordRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + internal RequestUriBuilder CreateListAdminCredentialsRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -756,12 +748,12 @@ internal RequestUriBuilder CreateRotateVcenterPasswordRequestUri(string subscrip uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); uri.AppendPath(privateCloudName, true); - uri.AppendPath("/rotateVcenterPassword", false); + uri.AppendPath("/listAdminCredentials", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateRotateVcenterPasswordRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListAdminCredentialsRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -774,7 +766,7 @@ internal HttpMessage CreateRotateVcenterPasswordRequest(string subscriptionId, s uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); uri.AppendPath(privateCloudName, true); - uri.AppendPath("/rotateVcenterPassword", false); + uri.AppendPath("/listAdminCredentials", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -782,57 +774,65 @@ internal HttpMessage CreateRotateVcenterPasswordRequest(string subscriptionId, s return message; } - /// Rotate the vCenter password. + /// List the admin credentials for the private cloud. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task RotateVcenterPasswordAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + public async Task> ListAdminCredentialsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var message = CreateRotateVcenterPasswordRequest(subscriptionId, resourceGroupName, privateCloudName); + using var message = CreateListAdminCredentialsRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 202: - case 204: - return message.Response; + case 200: + { + AdminCredentials value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AdminCredentials.DeserializeAdminCredentials(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Rotate the vCenter password. + /// List the admin credentials for the private cloud. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response RotateVcenterPassword(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + public Response ListAdminCredentials(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var message = CreateRotateVcenterPasswordRequest(subscriptionId, resourceGroupName, privateCloudName); + using var message = CreateListAdminCredentialsRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 202: - case 204: - return message.Response; + case 200: + { + AdminCredentials value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AdminCredentials.DeserializeAdminCredentials(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListInSubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -840,7 +840,7 @@ internal RequestUriBuilder CreateListInSubscriptionNextPageRequestUri(string nex return uri; } - internal HttpMessage CreateListInSubscriptionNextPageRequest(string nextLink, string subscriptionId) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -854,18 +854,20 @@ internal HttpMessage CreateListInSubscriptionNextPageRequest(string nextLink, st return message; } - /// List PrivateCloud resources by subscription ID. + /// List PrivateCloud resources by resource group. /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListInSubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListInSubscriptionNextPageRequest(nextLink, subscriptionId); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -881,18 +883,20 @@ public async Task> ListInSubscriptionNextPageAsync(st } } - /// List PrivateCloud resources by subscription ID. + /// List PrivateCloud resources by resource group. /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListInSubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListInSubscriptionNextPageRequest(nextLink, subscriptionId); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -908,7 +912,7 @@ public Response ListInSubscriptionNextPage(string nextLink, st } } - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + internal RequestUriBuilder CreateListInSubscriptionNextPageRequestUri(string nextLink, string subscriptionId) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -916,7 +920,7 @@ internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string return uri; } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + internal HttpMessage CreateListInSubscriptionNextPageRequest(string nextLink, string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -930,20 +934,18 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript return message; } - /// List PrivateCloud resources by resource group. + /// List PrivateCloud resources by subscription ID. /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListInSubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName); + using var message = CreateListInSubscriptionNextPageRequest(nextLink, subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -959,20 +961,18 @@ public async Task> ListNextPageAsync(string nextLink, } } - /// List PrivateCloud resources by resource group. + /// List PrivateCloud resources by subscription ID. /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListInSubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName); + using var message = CreateListInSubscriptionNextPageRequest(nextLink, subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ProvisionedNetworksRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ProvisionedNetworksRestOperations.cs new file mode 100644 index 000000000000..5dd1282b375d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ProvisionedNetworksRestOperations.cs @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class ProvisionedNetworksRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProvisionedNetworksRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public ProvisionedNetworksRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/provisionedNetworks", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/provisionedNetworks", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List ProvisionedNetwork resources by PrivateCloud. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProvisionedNetworkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ProvisionedNetworkListResult.DeserializeProvisionedNetworkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List ProvisionedNetwork resources by PrivateCloud. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProvisionedNetworkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ProvisionedNetworkListResult.DeserializeProvisionedNetworkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string provisionedNetworkName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/provisionedNetworks/", false); + uri.AppendPath(provisionedNetworkName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string provisionedNetworkName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/provisionedNetworks/", false); + uri.AppendPath(provisionedNetworkName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a ProvisionedNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cloud link. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string provisionedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(provisionedNetworkName, nameof(provisionedNetworkName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, provisionedNetworkName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProvisionedNetworkData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ProvisionedNetworkData.DeserializeProvisionedNetworkData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProvisionedNetworkData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a ProvisionedNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cloud link. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string provisionedNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(provisionedNetworkName, nameof(provisionedNetworkName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, provisionedNetworkName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProvisionedNetworkData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ProvisionedNetworkData.DeserializeProvisionedNetworkData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProvisionedNetworkData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List ProvisionedNetwork resources by PrivateCloud. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProvisionedNetworkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ProvisionedNetworkListResult.DeserializeProvisionedNetworkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List ProvisionedNetwork resources by PrivateCloud. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProvisionedNetworkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ProvisionedNetworkListResult.DeserializeProvisionedNetworkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PureStoragePoliciesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PureStoragePoliciesRestOperations.cs new file mode 100644 index 000000000000..2d7e26d95147 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PureStoragePoliciesRestOperations.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class PureStoragePoliciesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PureStoragePoliciesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public PureStoragePoliciesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/pureStoragePolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/pureStoragePolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List PureStoragePolicy resources by PrivateCloud. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PureStoragePolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = PureStoragePolicyListResult.DeserializePureStoragePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List PureStoragePolicy resources by PrivateCloud. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PureStoragePolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = PureStoragePolicyListResult.DeserializePureStoragePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/pureStoragePolicies/", false); + uri.AppendPath(storagePolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/pureStoragePolicies/", false); + uri.AppendPath(storagePolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a PureStoragePolicy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the storage policy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, storagePolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PureStoragePolicyData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = PureStoragePolicyData.DeserializePureStoragePolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PureStoragePolicyData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a PureStoragePolicy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the storage policy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, storagePolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PureStoragePolicyData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = PureStoragePolicyData.DeserializePureStoragePolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PureStoragePolicyData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName, PureStoragePolicyData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/pureStoragePolicies/", false); + uri.AppendPath(storagePolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName, PureStoragePolicyData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/pureStoragePolicies/", false); + uri.AppendPath(storagePolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a PureStoragePolicy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the storage policy. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName, PureStoragePolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, storagePolicyName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a PureStoragePolicy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the storage policy. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName, PureStoragePolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, storagePolicyName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/pureStoragePolicies/", false); + uri.AppendPath(storagePolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/pureStoragePolicies/", false); + uri.AppendPath(storagePolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a PureStoragePolicy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the storage policy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, storagePolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a PureStoragePolicy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the storage policy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string storagePolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(storagePolicyName, nameof(storagePolicyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, storagePolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List PureStoragePolicy resources by PrivateCloud. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PureStoragePolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = PureStoragePolicyListResult.DeserializePureStoragePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List PureStoragePolicy resources by PrivateCloud. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PureStoragePolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = PureStoragePolicyListResult.DeserializePureStoragePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs index b20fb9bde3f9..8bd9601c08bd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs @@ -25,14 +25,14 @@ internal partial class ScriptCmdletsRestOperations /// Initializes a new instance of ScriptCmdletsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public ScriptCmdletsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs index 1e9bf93bfda7..86946df8726e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs @@ -26,14 +26,14 @@ internal partial class ScriptExecutionsRestOperations /// Initializes a new instance of ScriptExecutionsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public ScriptExecutionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs index 99b43768e634..f3981c1b15f6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs @@ -25,14 +25,14 @@ internal partial class ScriptPackagesRestOperations /// Initializes a new instance of ScriptPackagesRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public ScriptPackagesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/SkusRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/SkusRestOperations.cs new file mode 100644 index 000000000000..c5b340c806c0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/SkusRestOperations.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class SkusRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SkusRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public SkusRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.AVS/skus", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.AVS/skus", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// A list of SKUs. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PagedResourceSku value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = PagedResourceSku.DeserializePagedResourceSku(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// A list of SKUs. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PagedResourceSku value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = PagedResourceSku.DeserializePagedResourceSku(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// A list of SKUs. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PagedResourceSku value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = PagedResourceSku.DeserializePagedResourceSku(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// A list of SKUs. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PagedResourceSku value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = PagedResourceSku.DeserializePagedResourceSku(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs index 29175dcee745..b12cc935f33f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs @@ -25,14 +25,14 @@ internal partial class VirtualMachinesRestOperations /// Initializes a new instance of VirtualMachinesRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public VirtualMachinesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -189,7 +189,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -203,13 +203,13 @@ public async Task> GetAsync(s { case 200: { - AvsPrivateCloudClusterVirtualMachineData value = default; + VirtualMachineData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AvsPrivateCloudClusterVirtualMachineData.DeserializeAvsPrivateCloudClusterVirtualMachineData(document.RootElement); + value = VirtualMachineData.DeserializeVirtualMachineData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsPrivateCloudClusterVirtualMachineData)null, message.Response); + return Response.FromValue((VirtualMachineData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -224,7 +224,7 @@ public async Task> GetAsync(s /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -238,19 +238,19 @@ public Response Get(string subscriptio { case 200: { - AvsPrivateCloudClusterVirtualMachineData value = default; + VirtualMachineData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AvsPrivateCloudClusterVirtualMachineData.DeserializeAvsPrivateCloudClusterVirtualMachineData(document.RootElement); + value = VirtualMachineData.DeserializeVirtualMachineData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AvsPrivateCloudClusterVirtualMachineData)null, message.Response); + return Response.FromValue((VirtualMachineData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateRestrictMovementRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, AvsPrivateCloudClusterVirtualMachineRestrictMovement restrictMovement) + internal RequestUriBuilder CreateRestrictMovementRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -269,7 +269,7 @@ internal RequestUriBuilder CreateRestrictMovementRequestUri(string subscriptionI return uri; } - internal HttpMessage CreateRestrictMovementRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, AvsPrivateCloudClusterVirtualMachineRestrictMovement restrictMovement) + internal HttpMessage CreateRestrictMovementRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -304,11 +304,11 @@ internal HttpMessage CreateRestrictMovementRequest(string subscriptionId, string /// Name of the private cloud. /// Name of the cluster. /// ID of the virtual machine. - /// The body type of the operation request. + /// The content of the action request. /// The cancellation token to use. /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task RestrictMovementAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, AvsPrivateCloudClusterVirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) + public async Task RestrictMovementAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -334,11 +334,11 @@ public async Task RestrictMovementAsync(string subscriptionId, string /// Name of the private cloud. /// Name of the cluster. /// ID of the virtual machine. - /// The body type of the operation request. + /// The content of the action request. /// The cancellation token to use. /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response RestrictMovement(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, AvsPrivateCloudClusterVirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) + public Response RestrictMovement(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkDhcpConfigurationsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkDhcpConfigurationsRestOperations.cs new file mode 100644 index 000000000000..a53a98b78a3e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkDhcpConfigurationsRestOperations.cs @@ -0,0 +1,611 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class WorkloadNetworkDhcpConfigurationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadNetworkDhcpConfigurationsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public WorkloadNetworkDhcpConfigurationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkDhcp resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcpList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkDhcp resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcpList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string dhcpId, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string dhcpId, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadNetworkDhcp. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The ID of the DHCP configuration. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string dhcpId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, dhcpId, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcp value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadNetworkDhcp. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The ID of the DHCP configuration. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string dhcpId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, dhcpId, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcp value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDhcp, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a WorkloadNetworkDhcp. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the DHCP configuration. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + Argument.AssertNotNull(workloadNetworkDhcp, nameof(workloadNetworkDhcp)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a WorkloadNetworkDhcp. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the DHCP configuration. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + Argument.AssertNotNull(workloadNetworkDhcp, nameof(workloadNetworkDhcp)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDhcp, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a WorkloadNetworkDhcp. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the DHCP configuration. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + Argument.AssertNotNull(workloadNetworkDhcp, nameof(workloadNetworkDhcp)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a WorkloadNetworkDhcp. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the DHCP configuration. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + Argument.AssertNotNull(workloadNetworkDhcp, nameof(workloadNetworkDhcp)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a WorkloadNetworkDhcp. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the DHCP configuration. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a WorkloadNetworkDhcp. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the DHCP configuration. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkDhcp resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcpList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkDhcp resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcpList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkDnsServicesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkDnsServicesRestOperations.cs new file mode 100644 index 000000000000..5a60be239515 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkDnsServicesRestOperations.cs @@ -0,0 +1,611 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class WorkloadNetworkDnsServicesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadNetworkDnsServicesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public WorkloadNetworkDnsServicesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkDnsService resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsServicesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkDnsService resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsServicesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadNetworkDnsService. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS service. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsService value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadNetworkDnsService. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS service. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsService value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDnsService, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a WorkloadNetworkDnsService. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS service. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + Argument.AssertNotNull(workloadNetworkDnsService, nameof(workloadNetworkDnsService)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a WorkloadNetworkDnsService. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS service. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + Argument.AssertNotNull(workloadNetworkDnsService, nameof(workloadNetworkDnsService)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDnsService, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a WorkloadNetworkDnsService. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS service. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + Argument.AssertNotNull(workloadNetworkDnsService, nameof(workloadNetworkDnsService)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a WorkloadNetworkDnsService. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS service. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + Argument.AssertNotNull(workloadNetworkDnsService, nameof(workloadNetworkDnsService)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string dnsServiceId, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string dnsServiceId, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a WorkloadNetworkDnsService. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// ID of the DNS service. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string dnsServiceId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsServiceId, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a WorkloadNetworkDnsService. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// ID of the DNS service. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string dnsServiceId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsServiceId, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkDnsService resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsServicesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkDnsService resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsServicesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkDnsZonesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkDnsZonesRestOperations.cs new file mode 100644 index 000000000000..bce88141b089 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkDnsZonesRestOperations.cs @@ -0,0 +1,611 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class WorkloadNetworkDnsZonesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadNetworkDnsZonesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public WorkloadNetworkDnsZonesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkDnsZone resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZonesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkDnsZone resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZonesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadNetworkDnsZone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS zone. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZone value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadNetworkDnsZone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS zone. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZone value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDnsZone, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a WorkloadNetworkDnsZone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS zone. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + Argument.AssertNotNull(workloadNetworkDnsZone, nameof(workloadNetworkDnsZone)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a WorkloadNetworkDnsZone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS zone. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + Argument.AssertNotNull(workloadNetworkDnsZone, nameof(workloadNetworkDnsZone)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDnsZone, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a WorkloadNetworkDnsZone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS zone. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + Argument.AssertNotNull(workloadNetworkDnsZone, nameof(workloadNetworkDnsZone)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a WorkloadNetworkDnsZone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS zone. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + Argument.AssertNotNull(workloadNetworkDnsZone, nameof(workloadNetworkDnsZone)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string dnsZoneId, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string dnsZoneId, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a WorkloadNetworkDnsZone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// ID of the DNS zone. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string dnsZoneId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsZoneId, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a WorkloadNetworkDnsZone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// ID of the DNS zone. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string dnsZoneId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsZoneId, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkDnsZone resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZonesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkDnsZone resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZonesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkGatewaysRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkGatewaysRestOperations.cs new file mode 100644 index 000000000000..abf6be643516 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkGatewaysRestOperations.cs @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class WorkloadNetworkGatewaysRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadNetworkGatewaysRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public WorkloadNetworkGatewaysRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/gateways", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/gateways", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkGateway resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGatewayList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkGateway resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGatewayList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/gateways/", false); + uri.AppendPath(gatewayId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/gateways/", false); + uri.AppendPath(gatewayId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadNetworkGateway. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the NSX Gateway. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, gatewayId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGatewayData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadNetworkGatewayData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadNetworkGateway. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the NSX Gateway. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, gatewayId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGatewayData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadNetworkGatewayData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkGateway resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGatewayList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkGateway resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGatewayList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkPortMirroringProfilesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkPortMirroringProfilesRestOperations.cs new file mode 100644 index 000000000000..a41f179a53e3 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkPortMirroringProfilesRestOperations.cs @@ -0,0 +1,611 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class WorkloadNetworkPortMirroringProfilesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadNetworkPortMirroringProfilesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public WorkloadNetworkPortMirroringProfilesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroringList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroringList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadNetworkPortMirroring. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the NSX port mirroring profile. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroring value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadNetworkPortMirroring. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the NSX port mirroring profile. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroring value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkPortMirroring, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a WorkloadNetworkPortMirroring. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the NSX port mirroring profile. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + Argument.AssertNotNull(workloadNetworkPortMirroring, nameof(workloadNetworkPortMirroring)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a WorkloadNetworkPortMirroring. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the NSX port mirroring profile. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + Argument.AssertNotNull(workloadNetworkPortMirroring, nameof(workloadNetworkPortMirroring)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkPortMirroring, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a WorkloadNetworkPortMirroring. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the NSX port mirroring profile. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + Argument.AssertNotNull(workloadNetworkPortMirroring, nameof(workloadNetworkPortMirroring)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a WorkloadNetworkPortMirroring. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the NSX port mirroring profile. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + Argument.AssertNotNull(workloadNetworkPortMirroring, nameof(workloadNetworkPortMirroring)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string portMirroringId, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string portMirroringId, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a WorkloadNetworkPortMirroring. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// ID of the NSX port mirroring profile. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string portMirroringId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, portMirroringId, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a WorkloadNetworkPortMirroring. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// ID of the NSX port mirroring profile. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string portMirroringId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, portMirroringId, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroringList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroringList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkPublicIpsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkPublicIpsRestOperations.cs new file mode 100644 index 000000000000..8e4ee3d36767 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkPublicIpsRestOperations.cs @@ -0,0 +1,511 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class WorkloadNetworkPublicIpsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadNetworkPublicIpsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public WorkloadNetworkPublicIpsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkPublicIP resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIPsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkPublicIP resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIPsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs/", false); + uri.AppendPath(publicIPId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs/", false); + uri.AppendPath(publicIPId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadNetworkPublicIP. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS zone. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIP value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadNetworkPublicIP. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS zone. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIP value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs/", false); + uri.AppendPath(publicIPId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs/", false); + uri.AppendPath(publicIPId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkPublicIP, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a WorkloadNetworkPublicIP. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS zone. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + Argument.AssertNotNull(workloadNetworkPublicIP, nameof(workloadNetworkPublicIP)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId, workloadNetworkPublicIP); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a WorkloadNetworkPublicIP. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the DNS zone. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + Argument.AssertNotNull(workloadNetworkPublicIP, nameof(workloadNetworkPublicIP)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId, workloadNetworkPublicIP); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string publicIPId, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs/", false); + uri.AppendPath(publicIPId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publicIPId, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs/", false); + uri.AppendPath(publicIPId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a WorkloadNetworkPublicIP. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// ID of the DNS zone. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string publicIPId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publicIPId, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a WorkloadNetworkPublicIP. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// ID of the DNS zone. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string publicIPId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publicIPId, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkPublicIP resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIPsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkPublicIP resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIPsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkSegmentsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkSegmentsRestOperations.cs new file mode 100644 index 000000000000..0a89ece0c4fc --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkSegmentsRestOperations.cs @@ -0,0 +1,615 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class WorkloadNetworkSegmentsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadNetworkSegmentsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public WorkloadNetworkSegmentsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkSegment resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkSegment resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadNetworkSegment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the NSX Segment. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadNetworkSegmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadNetworkSegment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the NSX Segment. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadNetworkSegmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a WorkloadNetworkSegment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the NSX Segment. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a WorkloadNetworkSegment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the NSX Segment. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a WorkloadNetworkSegment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the NSX Segment. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a WorkloadNetworkSegment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the NSX Segment. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteSegmentRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteSegmentRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a WorkloadNetworkSegment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the NSX Segment. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteSegmentAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); + + using var message = CreateDeleteSegmentRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a WorkloadNetworkSegment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The ID of the NSX Segment. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response DeleteSegment(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); + + using var message = CreateDeleteSegmentRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkSegment resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkSegment resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkVirtualMachinesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkVirtualMachinesRestOperations.cs new file mode 100644 index 000000000000..91da5cfef7bf --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkVirtualMachinesRestOperations.cs @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class WorkloadNetworkVirtualMachinesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadNetworkVirtualMachinesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public WorkloadNetworkVirtualMachinesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/virtualMachines", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/virtualMachines", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkVirtualMachine resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachinesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkVirtualMachine resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachinesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/virtualMachines/", false); + uri.AppendPath(virtualMachineId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/virtualMachines/", false); + uri.AppendPath(virtualMachineId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadNetworkVirtualMachine. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the virtual machine. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, virtualMachineId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachineData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadNetworkVirtualMachineData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadNetworkVirtualMachine. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the virtual machine. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, virtualMachineId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachineData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadNetworkVirtualMachineData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkVirtualMachine resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachinesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkVirtualMachine resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachinesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkVmGroupsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkVmGroupsRestOperations.cs new file mode 100644 index 000000000000..8c71c9582cfc --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworkVmGroupsRestOperations.cs @@ -0,0 +1,611 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + internal partial class WorkloadNetworkVmGroupsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadNetworkVmGroupsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public WorkloadNetworkVmGroupsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkVMGroup resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVmGroupsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVmGroupsList.DeserializeWorkloadNetworkVmGroupsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkVMGroup resources by WorkloadNetwork. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVmGroupsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkVmGroupsList.DeserializeWorkloadNetworkVmGroupsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadNetworkVMGroup. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the VM group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVmGroup value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVmGroup.DeserializeWorkloadNetworkVmGroup(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadNetworkVMGroup. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the VM group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVmGroup value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkVmGroup.DeserializeWorkloadNetworkVmGroup(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkVmGroup, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a WorkloadNetworkVMGroup. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the VM group. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + Argument.AssertNotNull(workloadNetworkVmGroup, nameof(workloadNetworkVmGroup)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVmGroup); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a WorkloadNetworkVMGroup. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the VM group. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + Argument.AssertNotNull(workloadNetworkVmGroup, nameof(workloadNetworkVmGroup)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVmGroup); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkVmGroup, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a WorkloadNetworkVMGroup. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the VM group. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + Argument.AssertNotNull(workloadNetworkVmGroup, nameof(workloadNetworkVmGroup)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVmGroup); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a WorkloadNetworkVMGroup. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// ID of the VM group. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + Argument.AssertNotNull(workloadNetworkVmGroup, nameof(workloadNetworkVmGroup)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVmGroup); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string vmGroupId, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string vmGroupId, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a WorkloadNetworkVMGroup. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// ID of the VM group. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string vmGroupId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vmGroupId, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a WorkloadNetworkVMGroup. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// ID of the VM group. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string vmGroupId, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vmGroupId, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadNetworkVMGroup resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVmGroupsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVmGroupsList.DeserializeWorkloadNetworkVmGroupsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadNetworkVMGroup resources by WorkloadNetwork. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVmGroupsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WorkloadNetworkVmGroupsList.DeserializeWorkloadNetworkVmGroupsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs index d516edef033c..638a3ad313b0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs @@ -25,111 +25,17 @@ internal partial class WorkloadNetworksRestOperations /// Initializes a new instance of WorkloadNetworksRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public WorkloadNetworksRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-09-01"; + _apiVersion = apiVersion ?? "2024-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetwork resources by PrivateCloud. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkList.DeserializeWorkloadNetworkList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetwork resources by PrivateCloud. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkList.DeserializeWorkloadNetworkList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) { var uri = new RawRequestUriBuilder(); @@ -228,7 +134,7 @@ public Response Get(string subscriptionId, string resourceG } } - internal RequestUriBuilder CreateListDhcpRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -238,12 +144,12 @@ internal RequestUriBuilder CreateListDhcpRequestUri(string subscriptionId, strin uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dhcpConfigurations", false); + uri.AppendPath("/workloadNetworks", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListDhcpRequest(string subscriptionId, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -256,7 +162,7 @@ internal HttpMessage CreateListDhcpRequest(string subscriptionId, string resourc uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dhcpConfigurations", false); + uri.AppendPath("/workloadNetworks", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -264,28 +170,28 @@ internal HttpMessage CreateListDhcpRequest(string subscriptionId, string resourc return message; } - /// List WorkloadNetworkDhcp resources by WorkloadNetwork. + /// List WorkloadNetwork resources by PrivateCloud. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListDhcpAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var message = CreateListDhcpRequest(subscriptionId, resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkDhcpList value = default; + WorkloadNetworkList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); + value = WorkloadNetworkList.DeserializeWorkloadNetworkList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -293,28 +199,28 @@ public async Task> ListDhcpAsync(string subscr } } - /// List WorkloadNetworkDhcp resources by WorkloadNetwork. + /// List WorkloadNetwork resources by PrivateCloud. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListDhcp(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - using var message = CreateListDhcpRequest(subscriptionId, resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkDhcpList value = default; + WorkloadNetworkList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); + value = WorkloadNetworkList.DeserializeWorkloadNetworkList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -322,4485 +228,83 @@ public Response ListDhcp(string subscriptionId, string } } - internal RequestUriBuilder CreateGetDhcpRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); - uri.AppendPath(dhcpId, true); - uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendRawNextLink(nextLink, false); return uri; } - internal HttpMessage CreateGetDhcpRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); - uri.AppendPath(dhcpId, true); - uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get a WorkloadNetworkDhcp. + /// List WorkloadNetwork resources by PrivateCloud. + /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. - /// The ID of the DHCP configuration. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetDhcpAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - using var message = CreateGetDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkDhcpData value = default; + WorkloadNetworkList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(document.RootElement); + value = WorkloadNetworkList.DeserializeWorkloadNetworkList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((WorkloadNetworkDhcpData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a WorkloadNetworkDhcp. + /// List WorkloadNetwork resources by PrivateCloud. + /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. - /// The ID of the DHCP configuration. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetDhcp(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - using var message = CreateGetDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkDhcpData value = default; + WorkloadNetworkList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkDhcpData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateDhcpRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); - uri.AppendPath(dhcpId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateDhcpRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); - uri.AppendPath(dhcpId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create a WorkloadNetworkDhcp. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the DHCP configuration. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateDhcpAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a WorkloadNetworkDhcp. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the DHCP configuration. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreateDhcp(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateDhcpRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); - uri.AppendPath(dhcpId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateDhcpRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); - uri.AppendPath(dhcpId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update a WorkloadNetworkDhcp. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the DHCP configuration. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateDhcpAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a WorkloadNetworkDhcp. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the DHCP configuration. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UpdateDhcp(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteDhcpRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); - uri.AppendPath(dhcpId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteDhcpRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); - uri.AppendPath(dhcpId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete a WorkloadNetworkDhcp. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the DHCP configuration. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteDhcpAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - - using var message = CreateDeleteDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a WorkloadNetworkDhcp. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the DHCP configuration. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DeleteDhcp(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - - using var message = CreateDeleteDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDnsServicesRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsServices", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListDnsServicesRequest(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsServices", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkDnsService resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListDnsServicesAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListDnsServicesRequest(subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsServicesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkDnsService resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListDnsServices(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListDnsServicesRequest(subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsServicesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetDnsServiceRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsServices/", false); - uri.AppendPath(dnsServiceId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetDnsServiceRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsServices/", false); - uri.AppendPath(dnsServiceId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get a WorkloadNetworkDnsService. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS service. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetDnsServiceAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - - using var message = CreateGetDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsServiceData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkDnsServiceData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a WorkloadNetworkDnsService. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS service. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetDnsService(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - - using var message = CreateGetDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsServiceData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkDnsServiceData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateDnsServiceRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsServices/", false); - uri.AppendPath(dnsServiceId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateDnsServiceRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsServices/", false); - uri.AppendPath(dnsServiceId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create a WorkloadNetworkDnsService. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS service. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateDnsServiceAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a WorkloadNetworkDnsService. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS service. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreateDnsService(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateDnsServiceRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsServices/", false); - uri.AppendPath(dnsServiceId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateDnsServiceRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsServices/", false); - uri.AppendPath(dnsServiceId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update a WorkloadNetworkDnsService. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS service. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateDnsServiceAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a WorkloadNetworkDnsService. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS service. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UpdateDnsService(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteDnsServiceRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsServices/", false); - uri.AppendPath(dnsServiceId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteDnsServiceRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsServices/", false); - uri.AppendPath(dnsServiceId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete a WorkloadNetworkDnsService. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS service. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteDnsServiceAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - - using var message = CreateDeleteDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a WorkloadNetworkDnsService. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS service. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DeleteDnsService(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - - using var message = CreateDeleteDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDnsZonesRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsZones", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListDnsZonesRequest(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsZones", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkDnsZone resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListDnsZonesAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListDnsZonesRequest(subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsZonesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkDnsZone resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListDnsZones(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListDnsZonesRequest(subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsZonesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetDnsZoneRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsZones/", false); - uri.AppendPath(dnsZoneId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetDnsZoneRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsZones/", false); - uri.AppendPath(dnsZoneId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get a WorkloadNetworkDnsZone. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetDnsZoneAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - - using var message = CreateGetDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsZoneData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkDnsZoneData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a WorkloadNetworkDnsZone. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetDnsZone(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - - using var message = CreateGetDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsZoneData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkDnsZoneData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateDnsZoneRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsZones/", false); - uri.AppendPath(dnsZoneId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateDnsZoneRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsZones/", false); - uri.AppendPath(dnsZoneId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create a WorkloadNetworkDnsZone. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateDnsZoneAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a WorkloadNetworkDnsZone. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreateDnsZone(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateDnsZoneRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsZones/", false); - uri.AppendPath(dnsZoneId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateDnsZoneRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsZones/", false); - uri.AppendPath(dnsZoneId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update a WorkloadNetworkDnsZone. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateDnsZoneAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a WorkloadNetworkDnsZone. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UpdateDnsZone(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteDnsZoneRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsZones/", false); - uri.AppendPath(dnsZoneId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteDnsZoneRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/dnsZones/", false); - uri.AppendPath(dnsZoneId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete a WorkloadNetworkDnsZone. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteDnsZoneAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - - using var message = CreateDeleteDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a WorkloadNetworkDnsZone. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DeleteDnsZone(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - - using var message = CreateDeleteDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListGatewaysRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/gateways", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListGatewaysRequest(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/gateways", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkGateway resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListGatewaysAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListGatewaysRequest(subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkGatewayList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkGateway resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListGateways(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListGatewaysRequest(subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkGatewayList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetGatewayRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/gateways/", false); - uri.AppendPath(gatewayId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetGatewayRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/gateways/", false); - uri.AppendPath(gatewayId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get a WorkloadNetworkGateway. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the NSX Gateway. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetGatewayAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); - - using var message = CreateGetGatewayRequest(subscriptionId, resourceGroupName, privateCloudName, gatewayId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkGatewayData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkGatewayData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a WorkloadNetworkGateway. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the NSX Gateway. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetGateway(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); - - using var message = CreateGetGatewayRequest(subscriptionId, resourceGroupName, privateCloudName, gatewayId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkGatewayData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkGatewayData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListPortMirroringRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/portMirroringProfiles", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListPortMirroringRequest(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/portMirroringProfiles", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListPortMirroringAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListPortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPortMirroringList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListPortMirroring(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListPortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPortMirroringList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetPortMirroringRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); - uri.AppendPath(portMirroringId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetPortMirroringRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); - uri.AppendPath(portMirroringId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get a WorkloadNetworkPortMirroring. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the NSX port mirroring profile. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetPortMirroringAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - - using var message = CreateGetPortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPortMirroringProfileData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkPortMirroringProfileData.DeserializeWorkloadNetworkPortMirroringProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkPortMirroringProfileData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a WorkloadNetworkPortMirroring. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the NSX port mirroring profile. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetPortMirroring(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - - using var message = CreateGetPortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPortMirroringProfileData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkPortMirroringProfileData.DeserializeWorkloadNetworkPortMirroringProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkPortMirroringProfileData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreatePortMirroringRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringProfileData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); - uri.AppendPath(portMirroringId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreatePortMirroringRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringProfileData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); - uri.AppendPath(portMirroringId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create a WorkloadNetworkPortMirroring. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the NSX port mirroring profile. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreatePortMirroringAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringProfileData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreatePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a WorkloadNetworkPortMirroring. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the NSX port mirroring profile. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreatePortMirroring(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringProfileData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreatePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdatePortMirroringRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringProfileData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); - uri.AppendPath(portMirroringId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdatePortMirroringRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringProfileData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); - uri.AppendPath(portMirroringId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update a WorkloadNetworkPortMirroring. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the NSX port mirroring profile. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdatePortMirroringAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringProfileData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdatePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a WorkloadNetworkPortMirroring. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the NSX port mirroring profile. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UpdatePortMirroring(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringProfileData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdatePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeletePortMirroringRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); - uri.AppendPath(portMirroringId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeletePortMirroringRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); - uri.AppendPath(portMirroringId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete a WorkloadNetworkPortMirroring. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the NSX port mirroring profile. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeletePortMirroringAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - - using var message = CreateDeletePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a WorkloadNetworkPortMirroring. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the NSX port mirroring profile. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DeletePortMirroring(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - - using var message = CreateDeletePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListPublicIPsRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/publicIPs", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListPublicIPsRequest(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/publicIPs", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkPublicIP resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListPublicIPsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListPublicIPsRequest(subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPublicIPsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkPublicIP resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListPublicIPs(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListPublicIPsRequest(subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPublicIPsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetPublicIPRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/publicIPs/", false); - uri.AppendPath(publicIPId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetPublicIPRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/publicIPs/", false); - uri.AppendPath(publicIPId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get a WorkloadNetworkPublicIP. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetPublicIPAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - - using var message = CreateGetPublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPublicIPData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkPublicIPData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a WorkloadNetworkPublicIP. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetPublicIP(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - - using var message = CreateGetPublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPublicIPData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkPublicIPData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreatePublicIPRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIPData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/publicIPs/", false); - uri.AppendPath(publicIPId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreatePublicIPRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIPData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/publicIPs/", false); - uri.AppendPath(publicIPId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create a WorkloadNetworkPublicIP. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreatePublicIPAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIPData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreatePublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a WorkloadNetworkPublicIP. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreatePublicIP(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIPData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreatePublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeletePublicIPRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/publicIPs/", false); - uri.AppendPath(publicIPId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeletePublicIPRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/publicIPs/", false); - uri.AppendPath(publicIPId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete a WorkloadNetworkPublicIP. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeletePublicIPAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - - using var message = CreateDeletePublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a WorkloadNetworkPublicIP. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the DNS zone. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DeletePublicIP(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - - using var message = CreateDeletePublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListSegmentsRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/segments", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListSegmentsRequest(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/segments", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkSegment resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListSegmentsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkSegmentsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkSegment resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListSegments(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkSegmentsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetSegmentRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/segments/", false); - uri.AppendPath(segmentId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetSegmentRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/segments/", false); - uri.AppendPath(segmentId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get a WorkloadNetworkSegment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the NSX Segment. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetSegmentAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - - using var message = CreateGetSegmentRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkSegmentData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkSegmentData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a WorkloadNetworkSegment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the NSX Segment. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetSegment(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - - using var message = CreateGetSegmentRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkSegmentData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkSegmentData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateSegmentsRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/segments/", false); - uri.AppendPath(segmentId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateSegmentsRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/segments/", false); - uri.AppendPath(segmentId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create a WorkloadNetworkSegment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the NSX Segment. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateSegmentsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a WorkloadNetworkSegment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the NSX Segment. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreateSegments(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateSegmentsRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/segments/", false); - uri.AppendPath(segmentId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateSegmentsRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/segments/", false); - uri.AppendPath(segmentId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update a WorkloadNetworkSegment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the NSX Segment. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateSegmentsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a WorkloadNetworkSegment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the NSX Segment. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UpdateSegments(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteSegmentRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/segments/", false); - uri.AppendPath(segmentId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteSegmentRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/segments/", false); - uri.AppendPath(segmentId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete a WorkloadNetworkSegment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the NSX Segment. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteSegmentAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - - using var message = CreateDeleteSegmentRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a WorkloadNetworkSegment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The ID of the NSX Segment. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DeleteSegment(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - - using var message = CreateDeleteSegmentRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListVirtualMachinesRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/virtualMachines", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListVirtualMachinesRequest(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/virtualMachines", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkVirtualMachine resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListVirtualMachinesAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListVirtualMachinesRequest(subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVirtualMachinesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkVirtualMachine resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListVirtualMachines(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListVirtualMachinesRequest(subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVirtualMachinesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetVirtualMachineRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/virtualMachines/", false); - uri.AppendPath(virtualMachineId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetVirtualMachineRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/virtualMachines/", false); - uri.AppendPath(virtualMachineId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get a WorkloadNetworkVirtualMachine. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetVirtualMachineAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - - using var message = CreateGetVirtualMachineRequest(subscriptionId, resourceGroupName, privateCloudName, virtualMachineId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVirtualMachineData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkVirtualMachineData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a WorkloadNetworkVirtualMachine. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetVirtualMachine(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - - using var message = CreateGetVirtualMachineRequest(subscriptionId, resourceGroupName, privateCloudName, virtualMachineId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVirtualMachineData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkVirtualMachineData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListVmGroupsRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/vmGroups", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListVmGroupsRequest(string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/vmGroups", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkVMGroup resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListVmGroupsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListVmGroupsRequest(subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVmGroupsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkVmGroupsList.DeserializeWorkloadNetworkVmGroupsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkVMGroup resources by WorkloadNetwork. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListVmGroups(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListVmGroupsRequest(subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVmGroupsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkVmGroupsList.DeserializeWorkloadNetworkVmGroupsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetVmGroupRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/vmGroups/", false); - uri.AppendPath(vmGroupId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetVmGroupRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/vmGroups/", false); - uri.AppendPath(vmGroupId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get a WorkloadNetworkVMGroup. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the VM group. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetVmGroupAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - - using var message = CreateGetVmGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVmGroupData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkVmGroupData.DeserializeWorkloadNetworkVmGroupData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkVmGroupData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a WorkloadNetworkVMGroup. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the VM group. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetVmGroup(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - - using var message = CreateGetVmGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVmGroupData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkVmGroupData.DeserializeWorkloadNetworkVmGroupData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((WorkloadNetworkVmGroupData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateVmGroupRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroupData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/vmGroups/", false); - uri.AppendPath(vmGroupId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateVmGroupRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroupData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/vmGroups/", false); - uri.AppendPath(vmGroupId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create a WorkloadNetworkVMGroup. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the VM group. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateVmGroupAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateVmGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a WorkloadNetworkVMGroup. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the VM group. - /// Resource create parameters. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreateVmGroup(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateVmGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateVmGroupRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroupData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/vmGroups/", false); - uri.AppendPath(vmGroupId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateVmGroupRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroupData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/vmGroups/", false); - uri.AppendPath(vmGroupId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update a WorkloadNetworkVMGroup. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the VM group. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateVmGroupAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateVmGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a WorkloadNetworkVMGroup. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the VM group. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UpdateVmGroup(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVmGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateVmGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteVmGroupRequestUri(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/vmGroups/", false); - uri.AppendPath(vmGroupId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteVmGroupRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); - uri.AppendPath(privateCloudName, true); - uri.AppendPath("/workloadNetworks/default/vmGroups/", false); - uri.AppendPath(vmGroupId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete a WorkloadNetworkVMGroup. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the VM group. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteVmGroupAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - - using var message = CreateDeleteVmGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a WorkloadNetworkVMGroup. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// ID of the VM group. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DeleteVmGroup(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - - using var message = CreateDeleteVmGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetwork resources by PrivateCloud. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkList.DeserializeWorkloadNetworkList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetwork resources by PrivateCloud. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkList.DeserializeWorkloadNetworkList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDhcpNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListDhcpNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkDhcp resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListDhcpNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListDhcpNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDhcpList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkDhcp resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListDhcpNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListDhcpNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDhcpList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDnsServicesNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListDnsServicesNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkDnsService resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListDnsServicesNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListDnsServicesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsServicesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkDnsService resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListDnsServicesNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListDnsServicesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsServicesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDnsZonesNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListDnsZonesNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkDnsZone resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListDnsZonesNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListDnsZonesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsZonesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkDnsZone resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListDnsZonesNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListDnsZonesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkDnsZonesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListGatewaysNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListGatewaysNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkGateway resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListGatewaysNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListGatewaysNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkGatewayList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkGateway resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListGatewaysNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListGatewaysNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkGatewayList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListPortMirroringNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListPortMirroringNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListPortMirroringNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListPortMirroringNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPortMirroringList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListPortMirroringNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListPortMirroringNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPortMirroringList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListPublicIPsNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListPublicIPsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkPublicIP resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListPublicIPsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListPublicIPsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPublicIPsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkPublicIP resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListPublicIPsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListPublicIPsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkPublicIPsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListSegmentsNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListSegmentsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkSegment resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListSegmentsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListSegmentsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkSegmentsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkSegment resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListSegmentsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListSegmentsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkSegmentsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListVirtualMachinesNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListVirtualMachinesNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkVirtualMachine resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListVirtualMachinesNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListVirtualMachinesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVirtualMachinesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkVirtualMachine resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListVirtualMachinesNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListVirtualMachinesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVirtualMachinesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListVmGroupsNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListVmGroupsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List WorkloadNetworkVMGroup resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListVmGroupsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListVmGroupsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVmGroupsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkVmGroupsList.DeserializeWorkloadNetworkVmGroupsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List WorkloadNetworkVMGroup resources by WorkloadNetwork. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the private cloud. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListVmGroupsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(privateCloudName, nameof(privateCloudName)); - - using var message = CreateListVmGroupsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - WorkloadNetworkVmGroupsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkloadNetworkVmGroupsList.DeserializeWorkloadNetworkVmGroupsList(document.RootElement); + value = WorkloadNetworkList.DeserializeWorkloadNetworkList(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs index 029db5de2e65..044957153729 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs @@ -60,11 +60,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// ScriptCmdlets_Get + /// ScriptCmdlet_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -105,11 +105,11 @@ public virtual async Task> GetAsync(string script /// /// /// Operation Id - /// ScriptCmdlets_Get + /// ScriptCmdlet_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -150,11 +150,11 @@ public virtual Response Get(string scriptCmdletName, Cance /// /// /// Operation Id - /// ScriptCmdlets_List + /// ScriptCmdlet_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -180,11 +180,11 @@ public virtual AsyncPageable GetAllAsync(CancellationToken /// /// /// Operation Id - /// ScriptCmdlets_List + /// ScriptCmdlet_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -210,11 +210,11 @@ public virtual Pageable GetAll(CancellationToken cancellat /// /// /// Operation Id - /// ScriptCmdlets_Get + /// ScriptCmdlet_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -253,11 +253,11 @@ public virtual async Task> ExistsAsync(string scriptCmdletName, C /// /// /// Operation Id - /// ScriptCmdlets_Get + /// ScriptCmdlet_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -296,11 +296,11 @@ public virtual Response Exists(string scriptCmdletName, CancellationToken /// /// /// Operation Id - /// ScriptCmdlets_Get + /// ScriptCmdlet_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -341,11 +341,11 @@ public virtual async Task> GetIfExistsAsy /// /// /// Operation Id - /// ScriptCmdlets_Get + /// ScriptCmdlet_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.Serialization.cs index c8da69c59c28..e456b301d83e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.Serialization.cs @@ -37,39 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (options.Format != "W" && Optional.IsDefined(Timeout)) - { - writer.WritePropertyName("timeout"u8); - writer.WriteStringValue(Timeout.Value, "P"); - } - if (options.Format != "W" && Optional.IsDefined(Audience)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("audience"u8); - writer.WriteStringValue(Audience.Value.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsCollectionDefined(Parameters)) - { - writer.WritePropertyName("parameters"u8); - writer.WriteStartArray(); - foreach (var item in Parameters) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); } ScriptCmdletData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -92,19 +64,24 @@ internal static ScriptCmdletData DeserializeScriptCmdletData(JsonElement element { return null; } + ScriptCmdletProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - ScriptCmdletProvisioningState? provisioningState = default; - string description = default; - TimeSpan? timeout = default; - ScriptCmdletAudience? audience = default; - IReadOnlyList parameters = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ScriptCmdletProperties.DeserializeScriptCmdletProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -129,64 +106,6 @@ internal static ScriptCmdletData DeserializeScriptCmdletData(JsonElement element systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new ScriptCmdletProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("timeout"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - timeout = property0.Value.GetTimeSpan("P"); - continue; - } - if (property0.NameEquals("audience"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - audience = new ScriptCmdletAudience(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("parameters"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ScriptParameter.DeserializeScriptParameter(item, options)); - } - parameters = array; - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -198,11 +117,7 @@ internal static ScriptCmdletData DeserializeScriptCmdletData(JsonElement element name, type, systemData, - provisioningState, - description, - timeout, - audience, - parameters ?? new ChangeTrackingList(), + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs index c8c267ca6684..8864cd4f171c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs @@ -52,9 +52,8 @@ public partial class ScriptCmdletData : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public ScriptCmdletData() + internal ScriptCmdletData() { - Parameters = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -62,31 +61,15 @@ public ScriptCmdletData() /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. - /// Description of the scripts functionality. - /// Recommended time limit for execution. - /// Specifies whether a script cmdlet is intended to be invoked only through automation or visible to customers. - /// Parameters the script will accept. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal ScriptCmdletData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ScriptCmdletProvisioningState? provisioningState, string description, TimeSpan? timeout, ScriptCmdletAudience? audience, IReadOnlyList parameters, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ScriptCmdletData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ScriptCmdletProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - ProvisioningState = provisioningState; - Description = description; - Timeout = timeout; - Audience = audience; - Parameters = parameters; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The provisioning state of the resource. - public ScriptCmdletProvisioningState? ProvisioningState { get; } - /// Description of the scripts functionality. - public string Description { get; } - /// Recommended time limit for execution. - public TimeSpan? Timeout { get; } - /// Specifies whether a script cmdlet is intended to be invoked only through automation or visible to customers. - public ScriptCmdletAudience? Audience { get; } - /// Parameters the script will accept. - public IReadOnlyList Parameters { get; } + /// The resource-specific properties for this resource. + public ScriptCmdletProperties Properties { get; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletResource.cs index 04f541f294c4..00c114829349 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletResource.cs @@ -98,11 +98,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// ScriptCmdlets_Get + /// ScriptCmdlet_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -138,11 +138,11 @@ public virtual async Task> GetAsync(CancellationT /// /// /// Operation Id - /// ScriptCmdlets_Get + /// ScriptCmdlet_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs index bf1e6f686967..76050d8117ac 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs @@ -19,8 +19,8 @@ namespace Azure.ResourceManager.Avs { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetScriptExecutions method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetScriptExecutions method from an instance of . /// public partial class ScriptExecutionCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -47,8 +47,8 @@ internal ScriptExecutionCollection(ArmClient client, ResourceIdentifier id) : ba internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudResource.ResourceType), nameof(id)); + if (id.ResourceType != PrivateCloudResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloudResource.ResourceType), nameof(id)); } /// @@ -60,11 +60,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// ScriptExecutions_CreateOrUpdate + /// ScriptExecution_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -109,11 +109,11 @@ public virtual async Task> CreateOrUpdateA /// /// /// Operation Id - /// ScriptExecutions_CreateOrUpdate + /// ScriptExecution_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -158,11 +158,11 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa /// /// /// Operation Id - /// ScriptExecutions_Get + /// ScriptExecution_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -203,11 +203,11 @@ public virtual async Task> GetAsync(string scr /// /// /// Operation Id - /// ScriptExecutions_Get + /// ScriptExecution_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -248,11 +248,11 @@ public virtual Response Get(string scriptExecutionName, /// /// /// Operation Id - /// ScriptExecutions_List + /// ScriptExecution_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -278,11 +278,11 @@ public virtual AsyncPageable GetAllAsync(CancellationTo /// /// /// Operation Id - /// ScriptExecutions_List + /// ScriptExecution_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -308,11 +308,11 @@ public virtual Pageable GetAll(CancellationToken cancel /// /// /// Operation Id - /// ScriptExecutions_Get + /// ScriptExecution_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -351,11 +351,11 @@ public virtual async Task> ExistsAsync(string scriptExecutionName /// /// /// Operation Id - /// ScriptExecutions_Get + /// ScriptExecution_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -394,11 +394,11 @@ public virtual Response Exists(string scriptExecutionName, CancellationTok /// /// /// Operation Id - /// ScriptExecutions_Get + /// ScriptExecution_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -439,11 +439,11 @@ public virtual async Task> GetIfExists /// /// /// Operation Id - /// ScriptExecutions_Get + /// ScriptExecution_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.Serialization.cs index a520038e8d49..0c18aa0314ed 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.Serialization.cs @@ -37,121 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(ScriptCmdletId)) - { - writer.WritePropertyName("scriptCmdletId"u8); - writer.WriteStringValue(ScriptCmdletId); - } - if (Optional.IsCollectionDefined(Parameters)) - { - writer.WritePropertyName("parameters"u8); - writer.WriteStartArray(); - foreach (var item in Parameters) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(HiddenParameters)) - { - writer.WritePropertyName("hiddenParameters"u8); - writer.WriteStartArray(); - foreach (var item in HiddenParameters) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(FailureReason)) - { - writer.WritePropertyName("failureReason"u8); - writer.WriteStringValue(FailureReason); - } - if (Optional.IsDefined(Timeout)) - { - writer.WritePropertyName("timeout"u8); - writer.WriteStringValue(Timeout); - } - if (Optional.IsDefined(Retention)) - { - writer.WritePropertyName("retention"u8); - writer.WriteStringValue(Retention); - } - if (options.Format != "W" && Optional.IsDefined(SubmittedOn)) - { - writer.WritePropertyName("submittedAt"u8); - writer.WriteStringValue(SubmittedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(StartedOn)) - { - writer.WritePropertyName("startedAt"u8); - writer.WriteStringValue(StartedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(FinishedOn)) - { - writer.WritePropertyName("finishedAt"u8); - writer.WriteStringValue(FinishedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsCollectionDefined(Output)) - { - writer.WritePropertyName("output"u8); - writer.WriteStartArray(); - foreach (var item in Output) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(NamedOutputs)) - { - writer.WritePropertyName("namedOutputs"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(NamedOutputs); -#else - using (JsonDocument document = JsonDocument.Parse(NamedOutputs, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - if (options.Format != "W" && Optional.IsCollectionDefined(Information)) - { - writer.WritePropertyName("information"u8); - writer.WriteStartArray(); - foreach (var item in Information) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(Warnings)) - { - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(Errors)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } ScriptExecutionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -174,29 +64,24 @@ internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement e { return null; } + ScriptExecutionProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - ResourceIdentifier scriptCmdletId = default; - IList parameters = default; - IList hiddenParameters = default; - string failureReason = default; - string timeout = default; - string retention = default; - DateTimeOffset? submittedAt = default; - DateTimeOffset? startedAt = default; - DateTimeOffset? finishedAt = default; - ScriptExecutionProvisioningState? provisioningState = default; - IList output = default; - BinaryData namedOutputs = default; - IReadOnlyList information = default; - IReadOnlyList warnings = default; - IReadOnlyList errors = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ScriptExecutionProperties.DeserializeScriptExecutionProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -221,171 +106,6 @@ internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("scriptCmdletId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scriptCmdletId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("parameters"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ScriptExecutionParameterDetails.DeserializeScriptExecutionParameterDetails(item, options)); - } - parameters = array; - continue; - } - if (property0.NameEquals("hiddenParameters"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ScriptExecutionParameterDetails.DeserializeScriptExecutionParameterDetails(item, options)); - } - hiddenParameters = array; - continue; - } - if (property0.NameEquals("failureReason"u8)) - { - failureReason = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("timeout"u8)) - { - timeout = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("retention"u8)) - { - retention = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("submittedAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - submittedAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("startedAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - startedAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("finishedAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - finishedAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new ScriptExecutionProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("output"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - output = array; - continue; - } - if (property0.NameEquals("namedOutputs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - namedOutputs = BinaryData.FromString(property0.Value.GetRawText()); - continue; - } - if (property0.NameEquals("information"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - information = array; - continue; - } - if (property0.NameEquals("warnings"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - warnings = array; - continue; - } - if (property0.NameEquals("errors"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - errors = array; - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -397,21 +117,7 @@ internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement e name, type, systemData, - scriptCmdletId, - parameters ?? new ChangeTrackingList(), - hiddenParameters ?? new ChangeTrackingList(), - failureReason, - timeout, - retention, - submittedAt, - startedAt, - finishedAt, - provisioningState, - output ?? new ChangeTrackingList(), - namedOutputs, - information ?? new ChangeTrackingList(), - warnings ?? new ChangeTrackingList(), - errors ?? new ChangeTrackingList(), + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs index d79e13669bd7..184714278591 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs @@ -54,12 +54,6 @@ public partial class ScriptExecutionData : ResourceData /// Initializes a new instance of . public ScriptExecutionData() { - Parameters = new ChangeTrackingList(); - HiddenParameters = new ChangeTrackingList(); - Output = new ChangeTrackingList(); - Information = new ChangeTrackingList(); - Warnings = new ChangeTrackingList(); - Errors = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -67,124 +61,15 @@ public ScriptExecutionData() /// The name. /// The resourceType. /// The systemData. - /// A reference to the script cmdlet resource if user is running a AVS script. - /// - /// Parameters the script will accept - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - /// - /// Parameters that will be hidden/not visible to ARM, such as passwords and - /// credentials - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - /// - /// Error message if the script was able to run, but if the script itself had - /// errors or powershell threw an exception - /// - /// Time limit for execution. - /// Time to live for the resource. If not provided, will be available for 60 days. - /// Time the script execution was submitted. - /// Time the script execution was started. - /// Time the script execution was finished. - /// The state of the script execution resource. - /// Standard output stream from the powershell execution. - /// User-defined dictionary. - /// Standard information out stream from the powershell execution. - /// Standard warning out stream from the powershell execution. - /// Standard error output stream from the powershell execution. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal ScriptExecutionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier scriptCmdletId, IList parameters, IList hiddenParameters, string failureReason, string timeout, string retention, DateTimeOffset? submittedOn, DateTimeOffset? startedOn, DateTimeOffset? finishedOn, ScriptExecutionProvisioningState? provisioningState, IList output, BinaryData namedOutputs, IReadOnlyList information, IReadOnlyList warnings, IReadOnlyList errors, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ScriptExecutionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ScriptExecutionProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - ScriptCmdletId = scriptCmdletId; - Parameters = parameters; - HiddenParameters = hiddenParameters; - FailureReason = failureReason; - Timeout = timeout; - Retention = retention; - SubmittedOn = submittedOn; - StartedOn = startedOn; - FinishedOn = finishedOn; - ProvisioningState = provisioningState; - Output = output; - NamedOutputs = namedOutputs; - Information = information; - Warnings = warnings; - Errors = errors; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// A reference to the script cmdlet resource if user is running a AVS script. - public ResourceIdentifier ScriptCmdletId { get; set; } - /// - /// Parameters the script will accept - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - public IList Parameters { get; } - /// - /// Parameters that will be hidden/not visible to ARM, such as passwords and - /// credentials - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - public IList HiddenParameters { get; } - /// - /// Error message if the script was able to run, but if the script itself had - /// errors or powershell threw an exception - /// - public string FailureReason { get; set; } - /// Time limit for execution. - public string Timeout { get; set; } - /// Time to live for the resource. If not provided, will be available for 60 days. - public string Retention { get; set; } - /// Time the script execution was submitted. - public DateTimeOffset? SubmittedOn { get; } - /// Time the script execution was started. - public DateTimeOffset? StartedOn { get; } - /// Time the script execution was finished. - public DateTimeOffset? FinishedOn { get; } - /// The state of the script execution resource. - public ScriptExecutionProvisioningState? ProvisioningState { get; } - /// Standard output stream from the powershell execution. - public IList Output { get; } - /// - /// User-defined dictionary. - /// - /// To assign an object to 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" }. - /// - /// - /// - /// - public BinaryData NamedOutputs { get; set; } - /// Standard information out stream from the powershell execution. - public IReadOnlyList Information { get; } - /// Standard warning out stream from the powershell execution. - public IReadOnlyList Warnings { get; } - /// Standard error output stream from the powershell execution. - public IReadOnlyList Errors { get; } + /// The resource-specific properties for this resource. + public ScriptExecutionProperties Properties { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionResource.cs index b4f3e1847312..963c27e4d293 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionResource.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.Avs /// A Class representing a ScriptExecution along with the instance operations that can be performed on it. /// If you have a you can construct a /// from an instance of using the GetScriptExecutionResource method. - /// Otherwise you can get one from its parent resource using the GetScriptExecution method. + /// Otherwise you can get one from its parent resource using the GetScriptExecution method. /// public partial class ScriptExecutionResource : ArmResource { @@ -99,11 +99,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// ScriptExecutions_Get + /// ScriptExecution_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -139,11 +139,11 @@ public virtual async Task> GetAsync(Cancellati /// /// /// Operation Id - /// ScriptExecutions_Get + /// ScriptExecution_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -179,11 +179,11 @@ public virtual Response Get(CancellationToken cancellat /// /// /// Operation Id - /// ScriptExecutions_Delete + /// ScriptExecution_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -221,11 +221,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// ScriptExecutions_Delete + /// ScriptExecution_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -263,11 +263,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// ScriptExecutions_CreateOrUpdate + /// ScriptExecution_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -309,11 +309,11 @@ public virtual async Task> UpdateAsync(Wai /// /// /// Operation Id - /// ScriptExecutions_CreateOrUpdate + /// ScriptExecution_CreateOrUpdate /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -359,7 +359,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -398,7 +398,7 @@ public virtual async Task> GetExecutionLogsAsy /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs index 54962a641d31..f59b22c1f76c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs @@ -19,8 +19,8 @@ namespace Azure.ResourceManager.Avs { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetScriptPackages method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetScriptPackages method from an instance of . /// public partial class ScriptPackageCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -47,8 +47,8 @@ internal ScriptPackageCollection(ArmClient client, ResourceIdentifier id) : base internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudResource.ResourceType), nameof(id)); + if (id.ResourceType != PrivateCloudResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloudResource.ResourceType), nameof(id)); } /// @@ -60,11 +60,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// ScriptPackages_Get + /// ScriptPackage_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -105,11 +105,11 @@ public virtual async Task> GetAsync(string scrip /// /// /// Operation Id - /// ScriptPackages_Get + /// ScriptPackage_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -150,11 +150,11 @@ public virtual Response Get(string scriptPackageName, Can /// /// /// Operation Id - /// ScriptPackages_List + /// ScriptPackage_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -180,11 +180,11 @@ public virtual AsyncPageable GetAllAsync(CancellationToke /// /// /// Operation Id - /// ScriptPackages_List + /// ScriptPackage_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -210,11 +210,11 @@ public virtual Pageable GetAll(CancellationToken cancella /// /// /// Operation Id - /// ScriptPackages_Get + /// ScriptPackage_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -253,11 +253,11 @@ public virtual async Task> ExistsAsync(string scriptPackageName, /// /// /// Operation Id - /// ScriptPackages_Get + /// ScriptPackage_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -296,11 +296,11 @@ public virtual Response Exists(string scriptPackageName, CancellationToken /// /// /// Operation Id - /// ScriptPackages_Get + /// ScriptPackage_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -341,11 +341,11 @@ public virtual async Task> GetIfExistsAs /// /// /// Operation Id - /// ScriptPackages_Get + /// ScriptPackage_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.Serialization.cs index 2790ba1500ce..0aefeb5e740a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.Serialization.cs @@ -37,34 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (options.Format != "W" && Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteStringValue(Version); - } - if (options.Format != "W" && Optional.IsDefined(Company)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("company"u8); - writer.WriteStringValue(Company); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsDefined(Uri)) - { - writer.WritePropertyName("uri"u8); - writer.WriteStringValue(Uri.AbsoluteUri); - } - writer.WriteEndObject(); } ScriptPackageData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -87,19 +64,24 @@ internal static ScriptPackageData DeserializeScriptPackageData(JsonElement eleme { return null; } + ScriptPackageProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - ScriptPackageProvisioningState? provisioningState = default; - string description = default; - string version = default; - string company = default; - Uri uri = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ScriptPackageProperties.DeserializeScriptPackageProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -124,51 +106,6 @@ internal static ScriptPackageData DeserializeScriptPackageData(JsonElement eleme systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new ScriptPackageProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("version"u8)) - { - version = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("company"u8)) - { - company = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uri"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uri = new Uri(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -180,11 +117,7 @@ internal static ScriptPackageData DeserializeScriptPackageData(JsonElement eleme name, type, systemData, - provisioningState, - description, - version, - company, - uri, + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs index 821bec8c8a46..42b811965206 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs @@ -52,7 +52,7 @@ public partial class ScriptPackageData : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public ScriptPackageData() + internal ScriptPackageData() { } @@ -61,31 +61,15 @@ public ScriptPackageData() /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. - /// User friendly description of the package. - /// Module version. - /// Company that created and supports the package. - /// Link to support by the package vendor. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal ScriptPackageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ScriptPackageProvisioningState? provisioningState, string description, string version, string company, Uri uri, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ScriptPackageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ScriptPackageProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - ProvisioningState = provisioningState; - Description = description; - Version = version; - Company = company; - Uri = uri; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The provisioning state of the resource. - public ScriptPackageProvisioningState? ProvisioningState { get; } - /// User friendly description of the package. - public string Description { get; } - /// Module version. - public string Version { get; } - /// Company that created and supports the package. - public string Company { get; } - /// Link to support by the package vendor. - public Uri Uri { get; } + /// The resource-specific properties for this resource. + public ScriptPackageProperties Properties { get; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs index b286d5a1870d..de469c4979e4 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs @@ -18,7 +18,7 @@ namespace Azure.ResourceManager.Avs /// A Class representing a ScriptPackage along with the instance operations that can be performed on it. /// If you have a you can construct a /// from an instance of using the GetScriptPackageResource method. - /// Otherwise you can get one from its parent resource using the GetScriptPackage method. + /// Otherwise you can get one from its parent resource using the GetScriptPackage method. /// public partial class ScriptPackageResource : ArmResource { @@ -104,11 +104,11 @@ public virtual ScriptCmdletCollection GetScriptCmdlets() /// /// /// Operation Id - /// ScriptCmdlets_Get + /// ScriptCmdlet_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -135,11 +135,11 @@ public virtual async Task> GetScriptCmdletAsync(s /// /// /// Operation Id - /// ScriptCmdlets_Get + /// ScriptCmdlet_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -166,11 +166,11 @@ public virtual Response GetScriptCmdlet(string scriptCmdle /// /// /// Operation Id - /// ScriptPackages_Get + /// ScriptPackage_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -206,11 +206,11 @@ public virtual async Task> GetAsync(Cancellation /// /// /// Operation Id - /// ScriptPackages_Get + /// ScriptPackage_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineCollection.cs similarity index 55% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineCollection.cs index 4e8ab0fbb6ab..549763191cda 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineCollection.cs @@ -18,28 +18,28 @@ namespace Azure.ResourceManager.Avs { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetAvsPrivateCloudClusterVirtualMachines method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetVirtualMachines method from an instance of . /// - public partial class AvsPrivateCloudClusterVirtualMachineCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class VirtualMachineCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics; - private readonly VirtualMachinesRestOperations _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient; + private readonly ClientDiagnostics _virtualMachineClientDiagnostics; + private readonly VirtualMachinesRestOperations _virtualMachineRestClient; - /// Initializes a new instance of the class for mocking. - protected AvsPrivateCloudClusterVirtualMachineCollection() + /// Initializes a new instance of the class for mocking. + protected VirtualMachineCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal AvsPrivateCloudClusterVirtualMachineCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal VirtualMachineCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", AvsPrivateCloudClusterVirtualMachineResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(AvsPrivateCloudClusterVirtualMachineResource.ResourceType, out string avsPrivateCloudClusterVirtualMachineVirtualMachinesApiVersion); - _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient = new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsPrivateCloudClusterVirtualMachineVirtualMachinesApiVersion); + _virtualMachineClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", VirtualMachineResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(VirtualMachineResource.ResourceType, out string virtualMachineApiVersion); + _virtualMachineRestClient = new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, virtualMachineApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -47,8 +47,8 @@ internal AvsPrivateCloudClusterVirtualMachineCollection(ArmClient client, Resour internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != AvsPrivateCloudClusterResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AvsPrivateCloudClusterResource.ResourceType), nameof(id)); + if (id.ResourceType != ClusterResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ClusterResource.ResourceType), nameof(id)); } /// @@ -60,15 +60,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// VirtualMachines_Get + /// VirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -76,18 +76,18 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string virtualMachineId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string virtualMachineId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineCollection.Get"); + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.Get"); scope.Start(); try { - var response = await _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken).ConfigureAwait(false); + var response = await _virtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -105,15 +105,15 @@ public virtual async Task /// /// /// Operation Id - /// VirtualMachines_Get + /// VirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -121,18 +121,18 @@ public virtual async Task /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string virtualMachineId, CancellationToken cancellationToken = default) + public virtual Response Get(string virtualMachineId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineCollection.Get"); + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.Get"); scope.Start(); try { - var response = _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken); + var response = _virtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -150,25 +150,25 @@ public virtual Response Get(string /// /// /// Operation Id - /// VirtualMachines_List + /// VirtualMachine_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudClusterVirtualMachineResource(Client, AvsPrivateCloudClusterVirtualMachineData.DeserializeAvsPrivateCloudClusterVirtualMachineData(e)), _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "AvsPrivateCloudClusterVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), _virtualMachineClientDiagnostics, Pipeline, "VirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -180,25 +180,25 @@ public virtual AsyncPageable GetAl /// /// /// Operation Id - /// VirtualMachines_List + /// VirtualMachine_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudClusterVirtualMachineResource(Client, AvsPrivateCloudClusterVirtualMachineData.DeserializeAvsPrivateCloudClusterVirtualMachineData(e)), _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "AvsPrivateCloudClusterVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _virtualMachineRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _virtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), _virtualMachineClientDiagnostics, Pipeline, "VirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -210,15 +210,15 @@ public virtual Pageable GetAll(Can /// /// /// Operation Id - /// VirtualMachines_Get + /// VirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -230,11 +230,11 @@ public virtual async Task> ExistsAsync(string virtualMachineId, C { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineCollection.Exists"); + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.Exists"); scope.Start(); try { - var response = await _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _virtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -253,15 +253,15 @@ public virtual async Task> ExistsAsync(string virtualMachineId, C /// /// /// Operation Id - /// VirtualMachines_Get + /// VirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -273,11 +273,11 @@ public virtual Response Exists(string virtualMachineId, CancellationToken { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineCollection.Exists"); + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.Exists"); scope.Start(); try { - var response = _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken); + var response = _virtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -296,15 +296,15 @@ public virtual Response Exists(string virtualMachineId, CancellationToken /// /// /// Operation Id - /// VirtualMachines_Get + /// VirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -312,18 +312,18 @@ public virtual Response Exists(string virtualMachineId, CancellationToken /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string virtualMachineId, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string virtualMachineId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineCollection.GetIfExists"); + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.GetIfExists"); scope.Start(); try { - var response = await _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _virtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -341,15 +341,15 @@ public virtual async Task /// /// Operation Id - /// VirtualMachines_Get + /// VirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// @@ -357,18 +357,18 @@ public virtual async Task The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string virtualMachineId, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string virtualMachineId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineCollection.GetIfExists"); + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineCollection.GetIfExists"); scope.Start(); try { - var response = _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken); + var response = _virtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -377,7 +377,7 @@ public virtual NullableResponse Ge } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -387,7 +387,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineData.Serialization.cs new file mode 100644 index 000000000000..19b04d972e91 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineData.Serialization.cs @@ -0,0 +1,155 @@ +// 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; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class VirtualMachineData : 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 override 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(VirtualMachineData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + VirtualMachineData 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(VirtualMachineData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualMachineData(document.RootElement, options); + } + + internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VirtualMachineProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = VirtualMachineProperties.DeserializeVirtualMachineProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VirtualMachineData( + id, + name, + type, + systemData, + properties, + 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); + default: + throw new FormatException($"The model {nameof(VirtualMachineData)} does not support writing '{options.Format}' format."); + } + } + + VirtualMachineData 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 DeserializeVirtualMachineData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VirtualMachineData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineData.cs new file mode 100644 index 000000000000..3576dcdea438 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// + /// A class representing the VirtualMachine data model. + /// Virtual Machine + /// + public partial class VirtualMachineData : ResourceData + { + /// + /// 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 . + internal VirtualMachineData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, VirtualMachineProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public VirtualMachineProperties Properties { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineResource.Serialization.cs new file mode 100644 index 000000000000..854a7f399420 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Avs +{ + public partial class VirtualMachineResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + VirtualMachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + VirtualMachineData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineResource.cs similarity index 60% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineResource.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineResource.cs index 577485c2b272..21aae487bcad 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.Avs { /// - /// A Class representing an AvsPrivateCloudClusterVirtualMachine along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetAvsPrivateCloudClusterVirtualMachineResource method. - /// Otherwise you can get one from its parent resource using the GetAvsPrivateCloudClusterVirtualMachine method. + /// A Class representing a VirtualMachine along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetVirtualMachineResource method. + /// Otherwise you can get one from its parent resource using the GetVirtualMachine method. /// - public partial class AvsPrivateCloudClusterVirtualMachineResource : ArmResource + public partial class VirtualMachineResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The privateCloudName. @@ -35,35 +35,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics; - private readonly VirtualMachinesRestOperations _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient; - private readonly AvsPrivateCloudClusterVirtualMachineData _data; + private readonly ClientDiagnostics _virtualMachineClientDiagnostics; + private readonly VirtualMachinesRestOperations _virtualMachineRestClient; + private readonly VirtualMachineData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters/virtualMachines"; - /// Initializes a new instance of the class for mocking. - protected AvsPrivateCloudClusterVirtualMachineResource() + /// Initializes a new instance of the class for mocking. + protected VirtualMachineResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal AvsPrivateCloudClusterVirtualMachineResource(ArmClient client, AvsPrivateCloudClusterVirtualMachineData data) : this(client, data.Id) + internal VirtualMachineResource(ArmClient client, VirtualMachineData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal AvsPrivateCloudClusterVirtualMachineResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal VirtualMachineResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string avsPrivateCloudClusterVirtualMachineVirtualMachinesApiVersion); - _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient = new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, avsPrivateCloudClusterVirtualMachineVirtualMachinesApiVersion); + _virtualMachineClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string virtualMachineApiVersion); + _virtualMachineRestClient = new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, virtualMachineApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -74,7 +74,7 @@ internal AvsPrivateCloudClusterVirtualMachineResource(ArmClient client, Resource /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual AvsPrivateCloudClusterVirtualMachineData Data + public virtual VirtualMachineData Data { get { @@ -99,29 +99,29 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// VirtualMachines_Get + /// VirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineResource.Get"); + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineResource.Get"); scope.Start(); try { - var response = await _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _virtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -139,29 +139,29 @@ public virtual async Task /// /// /// Operation Id - /// VirtualMachines_Get + /// VirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineResource.Get"); + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineResource.Get"); scope.Start(); try { - var response = _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _virtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AvsPrivateCloudClusterVirtualMachineResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -183,28 +183,28 @@ public virtual Response Get(Cancel /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The body type of the operation request. + /// The content of the action request. /// The cancellation token to use. /// is null. - public virtual async Task RestrictMovementAsync(WaitUntil waitUntil, AvsPrivateCloudClusterVirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) + public virtual async Task RestrictMovementAsync(WaitUntil waitUntil, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) { Argument.AssertNotNull(restrictMovement, nameof(restrictMovement)); - using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineResource.RestrictMovement"); + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineResource.RestrictMovement"); scope.Start(); try { - var response = await _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.RestrictMovementAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.CreateRestrictMovementRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement).Request, response, OperationFinalStateVia.Location); + var response = await _virtualMachineRestClient.RestrictMovementAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_virtualMachineClientDiagnostics, Pipeline, _virtualMachineRestClient.CreateRestrictMovementRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -229,28 +229,28 @@ public virtual async Task RestrictMovementAsync(WaitUntil waitUnti /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The body type of the operation request. + /// The content of the action request. /// The cancellation token to use. /// is null. - public virtual ArmOperation RestrictMovement(WaitUntil waitUntil, AvsPrivateCloudClusterVirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) + public virtual ArmOperation RestrictMovement(WaitUntil waitUntil, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) { Argument.AssertNotNull(restrictMovement, nameof(restrictMovement)); - using var scope = _avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics.CreateScope("AvsPrivateCloudClusterVirtualMachineResource.RestrictMovement"); + using var scope = _virtualMachineClientDiagnostics.CreateScope("VirtualMachineResource.RestrictMovement"); scope.Start(); try { - var response = _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.RestrictMovement(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement, cancellationToken); - var operation = new AvsArmOperation(_avsPrivateCloudClusterVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, _avsPrivateCloudClusterVirtualMachineVirtualMachinesRestClient.CreateRestrictMovementRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement).Request, response, OperationFinalStateVia.Location); + var response = _virtualMachineRestClient.RestrictMovement(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement, cancellationToken); + var operation = new AvsArmOperation(_virtualMachineClientDiagnostics, Pipeline, _virtualMachineRestClient.CreateRestrictMovementRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.Serialization.cs index fd331eb68bab..3c2769acb826 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.Serialization.cs @@ -37,14 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } WorkloadNetworkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -67,15 +64,24 @@ internal static WorkloadNetworkData DeserializeWorkloadNetworkData(JsonElement e { return null; } + WorkloadNetworkProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - WorkloadNetworkProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WorkloadNetworkProperties.DeserializeWorkloadNetworkProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -100,27 +106,6 @@ internal static WorkloadNetworkData DeserializeWorkloadNetworkData(JsonElement e systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new WorkloadNetworkProvisioningState(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -132,7 +117,7 @@ internal static WorkloadNetworkData DeserializeWorkloadNetworkData(JsonElement e name, type, systemData, - provisioningState, + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.cs index e3f690f0b28e..26db0c62414c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkData.cs @@ -52,7 +52,7 @@ public partial class WorkloadNetworkData : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public WorkloadNetworkData() + internal WorkloadNetworkData() { } @@ -61,15 +61,20 @@ public WorkloadNetworkData() /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal WorkloadNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - ProvisioningState = provisioningState; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// The resource-specific properties for this resource. + internal WorkloadNetworkProperties Properties { get; } /// The provisioning state of the resource. - public WorkloadNetworkProvisioningState? ProvisioningState { get; } + public WorkloadNetworkProvisioningState? WorkloadNetworkProvisioningState + { + get => Properties?.ProvisioningState; + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs deleted file mode 100644 index d1568897514a..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetWorkloadNetworkDhcps method from an instance of . - /// - public partial class WorkloadNetworkDhcpCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _workloadNetworkDhcpWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkDhcpWorkloadNetworksRestClient; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkDhcpCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal WorkloadNetworkDhcpCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkDhcpWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkDhcpResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(WorkloadNetworkDhcpResource.ResourceType, out string workloadNetworkDhcpWorkloadNetworksApiVersion); - _workloadNetworkDhcpWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkDhcpWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != WorkloadNetworkResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkloadNetworkResource.ResourceType), nameof(id)); - } - - /// - /// Create a WorkloadNetworkDhcp - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreateDhcp - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The ID of the DHCP configuration. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string dhcpId, WorkloadNetworkDhcpData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _workloadNetworkDhcpWorkloadNetworksRestClient.CreateDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkDhcpOperationSource(Client), _workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDhcpWorkloadNetworksRestClient.CreateCreateDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a WorkloadNetworkDhcp - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreateDhcp - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The ID of the DHCP configuration. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string dhcpId, WorkloadNetworkDhcpData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _workloadNetworkDhcpWorkloadNetworksRestClient.CreateDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkDhcpOperationSource(Client), _workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDhcpWorkloadNetworksRestClient.CreateCreateDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkDhcp - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDhcp - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID of the DHCP configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string dhcpId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkDhcpWorkloadNetworksRestClient.GetDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDhcpResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkDhcp - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDhcp - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID of the DHCP configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string dhcpId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.Get"); - scope.Start(); - try - { - var response = _workloadNetworkDhcpWorkloadNetworksRestClient.GetDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDhcpResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List WorkloadNetworkDhcp resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations - /// - /// - /// Operation Id - /// WorkloadNetworks_ListDhcp - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDhcpWorkloadNetworksRestClient.CreateListDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDhcpWorkloadNetworksRestClient.CreateListDhcpNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDhcpResource(Client, WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(e)), _workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDhcpCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// List WorkloadNetworkDhcp resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations - /// - /// - /// Operation Id - /// WorkloadNetworks_ListDhcp - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDhcpWorkloadNetworksRestClient.CreateListDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDhcpWorkloadNetworksRestClient.CreateListDhcpNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDhcpResource(Client, WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(e)), _workloadNetworkDhcpWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDhcpCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDhcp - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID of the DHCP configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string dhcpId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.Exists"); - scope.Start(); - try - { - var response = await _workloadNetworkDhcpWorkloadNetworksRestClient.GetDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDhcp - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID of the DHCP configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string dhcpId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.Exists"); - scope.Start(); - try - { - var response = _workloadNetworkDhcpWorkloadNetworksRestClient.GetDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDhcp - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID of the DHCP configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string dhcpId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _workloadNetworkDhcpWorkloadNetworksRestClient.GetDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDhcpResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDhcp - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID of the DHCP configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string dhcpId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - - using var scope = _workloadNetworkDhcpWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.GetIfExists"); - scope.Start(); - try - { - var response = _workloadNetworkDhcpWorkloadNetworksRestClient.GetDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDhcpResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpResource.Serialization.cs deleted file mode 100644 index 520f02097999..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkDhcpResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - WorkloadNetworkDhcpData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - WorkloadNetworkDhcpData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs deleted file mode 100644 index b8a66464490d..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetWorkloadNetworkDnsServices method from an instance of . - /// - public partial class WorkloadNetworkDnsServiceCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkDnsServiceWorkloadNetworksRestClient; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkDnsServiceCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal WorkloadNetworkDnsServiceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkDnsServiceResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(WorkloadNetworkDnsServiceResource.ResourceType, out string workloadNetworkDnsServiceWorkloadNetworksApiVersion); - _workloadNetworkDnsServiceWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkDnsServiceWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != WorkloadNetworkResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkloadNetworkResource.ResourceType), nameof(id)); - } - - /// - /// Create a WorkloadNetworkDnsService - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreateDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// ID of the DNS service. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string dnsServiceId, WorkloadNetworkDnsServiceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkDnsServiceOperationSource(Client), _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateCreateDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a WorkloadNetworkDnsService - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreateDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// ID of the DNS service. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string dnsServiceId, WorkloadNetworkDnsServiceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkDnsServiceOperationSource(Client), _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateCreateDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkDnsService - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS service. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string dnsServiceId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsServiceWorkloadNetworksRestClient.GetDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsServiceResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkDnsService - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS service. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string dnsServiceId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.Get"); - scope.Start(); - try - { - var response = _workloadNetworkDnsServiceWorkloadNetworksRestClient.GetDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsServiceResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List WorkloadNetworkDnsService resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices - /// - /// - /// Operation Id - /// WorkloadNetworks_ListDnsServices - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateListDnsServicesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateListDnsServicesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDnsServiceResource(Client, WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(e)), _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsServiceCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// List WorkloadNetworkDnsService resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices - /// - /// - /// Operation Id - /// WorkloadNetworks_ListDnsServices - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateListDnsServicesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateListDnsServicesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDnsServiceResource(Client, WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(e)), _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsServiceCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS service. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string dnsServiceId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.Exists"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsServiceWorkloadNetworksRestClient.GetDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS service. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string dnsServiceId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.Exists"); - scope.Start(); - try - { - var response = _workloadNetworkDnsServiceWorkloadNetworksRestClient.GetDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS service. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string dnsServiceId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsServiceWorkloadNetworksRestClient.GetDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsServiceResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS service. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string dnsServiceId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); - - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.GetIfExists"); - scope.Start(); - try - { - var response = _workloadNetworkDnsServiceWorkloadNetworksRestClient.GetDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsServiceResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.Serialization.cs deleted file mode 100644 index 5975cef2cced..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.Serialization.cs +++ /dev/null @@ -1,285 +0,0 @@ -// 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.Net; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkDnsServiceData : 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 override 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(WorkloadNetworkDnsServiceData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(DnsServiceIP)) - { - writer.WritePropertyName("dnsServiceIp"u8); - writer.WriteStringValue(DnsServiceIP.ToString()); - } - if (Optional.IsDefined(DefaultDnsZone)) - { - writer.WritePropertyName("defaultDnsZone"u8); - writer.WriteStringValue(DefaultDnsZone); - } - if (Optional.IsCollectionDefined(FqdnZones)) - { - writer.WritePropertyName("fqdnZones"u8); - writer.WriteStartArray(); - foreach (var item in FqdnZones) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(LogLevel)) - { - writer.WritePropertyName("logLevel"u8); - writer.WriteStringValue(LogLevel.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(Revision)) - { - writer.WritePropertyName("revision"u8); - writer.WriteNumberValue(Revision.Value); - } - writer.WriteEndObject(); - } - - WorkloadNetworkDnsServiceData 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(WorkloadNetworkDnsServiceData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWorkloadNetworkDnsServiceData(document.RootElement, options); - } - - internal static WorkloadNetworkDnsServiceData DeserializeWorkloadNetworkDnsServiceData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string displayName = default; - IPAddress dnsServiceIP = default; - string defaultDnsZone = default; - IList fqdnZones = default; - DnsServiceLogLevel? logLevel = default; - DnsServiceStatus? status = default; - WorkloadNetworkDnsServiceProvisioningState? provisioningState = default; - long? revision = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("dnsServiceIp"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dnsServiceIP = IPAddress.Parse(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("defaultDnsZone"u8)) - { - defaultDnsZone = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("fqdnZones"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - fqdnZones = array; - continue; - } - if (property0.NameEquals("logLevel"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - logLevel = new DnsServiceLogLevel(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new DnsServiceStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new WorkloadNetworkDnsServiceProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("revision"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - revision = property0.Value.GetInt64(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WorkloadNetworkDnsServiceData( - id, - name, - type, - systemData, - displayName, - dnsServiceIP, - defaultDnsZone, - fqdnZones ?? new ChangeTrackingList(), - logLevel, - status, - provisioningState, - revision, - 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); - default: - throw new FormatException($"The model {nameof(WorkloadNetworkDnsServiceData)} does not support writing '{options.Format}' format."); - } - } - - WorkloadNetworkDnsServiceData 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 DeserializeWorkloadNetworkDnsServiceData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WorkloadNetworkDnsServiceData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceResource.Serialization.cs deleted file mode 100644 index 68a8965ece1a..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkDnsServiceResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - WorkloadNetworkDnsServiceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - WorkloadNetworkDnsServiceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceResource.cs deleted file mode 100644 index fc324de77ca5..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceResource.cs +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A Class representing a WorkloadNetworkDnsService along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetWorkloadNetworkDnsServiceResource method. - /// Otherwise you can get one from its parent resource using the GetWorkloadNetworkDnsService method. - /// - public partial class WorkloadNetworkDnsServiceResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The privateCloudName. - /// The dnsServiceId. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkDnsServiceWorkloadNetworksRestClient; - private readonly WorkloadNetworkDnsServiceData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/dnsServices"; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkDnsServiceResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal WorkloadNetworkDnsServiceResource(ArmClient client, WorkloadNetworkDnsServiceData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal WorkloadNetworkDnsServiceResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string workloadNetworkDnsServiceWorkloadNetworksApiVersion); - _workloadNetworkDnsServiceWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkDnsServiceWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual WorkloadNetworkDnsServiceData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get a WorkloadNetworkDnsService - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceResource.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsServiceWorkloadNetworksRestClient.GetDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsServiceResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkDnsService - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceResource.Get"); - scope.Start(); - try - { - var response = _workloadNetworkDnsServiceWorkloadNetworksRestClient.GetDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsServiceResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a WorkloadNetworkDnsService - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_DeleteDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceResource.Delete"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsServiceWorkloadNetworksRestClient.DeleteDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateDeleteDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a WorkloadNetworkDnsService - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_DeleteDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceResource.Delete"); - scope.Start(); - try - { - var response = _workloadNetworkDnsServiceWorkloadNetworksRestClient.DeleteDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateDeleteDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update a WorkloadNetworkDnsService - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_UpdateDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, WorkloadNetworkDnsServiceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceResource.Update"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsServiceWorkloadNetworksRestClient.UpdateDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkDnsServiceOperationSource(Client), _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateUpdateDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update a WorkloadNetworkDnsService - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} - /// - /// - /// Operation Id - /// WorkloadNetworks_UpdateDnsService - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, WorkloadNetworkDnsServiceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsServiceResource.Update"); - scope.Start(); - try - { - var response = _workloadNetworkDnsServiceWorkloadNetworksRestClient.UpdateDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkDnsServiceOperationSource(Client), _workloadNetworkDnsServiceWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsServiceWorkloadNetworksRestClient.CreateUpdateDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs deleted file mode 100644 index e097d71a9480..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetWorkloadNetworkDnsZones method from an instance of . - /// - public partial class WorkloadNetworkDnsZoneCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkDnsZoneWorkloadNetworksRestClient; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkDnsZoneCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal WorkloadNetworkDnsZoneCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkDnsZoneResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(WorkloadNetworkDnsZoneResource.ResourceType, out string workloadNetworkDnsZoneWorkloadNetworksApiVersion); - _workloadNetworkDnsZoneWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkDnsZoneWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != WorkloadNetworkResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkloadNetworkResource.ResourceType), nameof(id)); - } - - /// - /// Create a WorkloadNetworkDnsZone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreateDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// ID of the DNS zone. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string dnsZoneId, WorkloadNetworkDnsZoneData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkDnsZoneOperationSource(Client), _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateCreateDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a WorkloadNetworkDnsZone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreateDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// ID of the DNS zone. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string dnsZoneId, WorkloadNetworkDnsZoneData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkDnsZoneOperationSource(Client), _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateCreateDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkDnsZone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string dnsZoneId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsZoneWorkloadNetworksRestClient.GetDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsZoneResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkDnsZone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string dnsZoneId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.Get"); - scope.Start(); - try - { - var response = _workloadNetworkDnsZoneWorkloadNetworksRestClient.GetDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsZoneResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List WorkloadNetworkDnsZone resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones - /// - /// - /// Operation Id - /// WorkloadNetworks_ListDnsZones - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateListDnsZonesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateListDnsZonesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDnsZoneResource(Client, WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(e)), _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsZoneCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// List WorkloadNetworkDnsZone resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones - /// - /// - /// Operation Id - /// WorkloadNetworks_ListDnsZones - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateListDnsZonesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateListDnsZonesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkDnsZoneResource(Client, WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(e)), _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkDnsZoneCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string dnsZoneId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.Exists"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsZoneWorkloadNetworksRestClient.GetDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string dnsZoneId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.Exists"); - scope.Start(); - try - { - var response = _workloadNetworkDnsZoneWorkloadNetworksRestClient.GetDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string dnsZoneId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsZoneWorkloadNetworksRestClient.GetDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsZoneResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string dnsZoneId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); - - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.GetIfExists"); - scope.Start(); - try - { - var response = _workloadNetworkDnsZoneWorkloadNetworksRestClient.GetDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsZoneResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.Serialization.cs deleted file mode 100644 index ba18cba42801..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.Serialization.cs +++ /dev/null @@ -1,295 +0,0 @@ -// 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.Net; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkDnsZoneData : 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 override 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(WorkloadNetworkDnsZoneData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsCollectionDefined(Domain)) - { - writer.WritePropertyName("domain"u8); - writer.WriteStartArray(); - foreach (var item in Domain) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(DnsServerIPs)) - { - writer.WritePropertyName("dnsServerIps"u8); - writer.WriteStartArray(); - foreach (var item in DnsServerIPs) - { - if (item == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteStringValue(item.ToString()); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(SourceIP)) - { - writer.WritePropertyName("sourceIp"u8); - writer.WriteStringValue(SourceIP.ToString()); - } - if (Optional.IsDefined(DnsServices)) - { - writer.WritePropertyName("dnsServices"u8); - writer.WriteNumberValue(DnsServices.Value); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(Revision)) - { - writer.WritePropertyName("revision"u8); - writer.WriteNumberValue(Revision.Value); - } - writer.WriteEndObject(); - } - - WorkloadNetworkDnsZoneData 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(WorkloadNetworkDnsZoneData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWorkloadNetworkDnsZoneData(document.RootElement, options); - } - - internal static WorkloadNetworkDnsZoneData DeserializeWorkloadNetworkDnsZoneData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string displayName = default; - IList domain = default; - IList dnsServerIPs = default; - IPAddress sourceIP = default; - long? dnsServices = default; - WorkloadNetworkDnsZoneProvisioningState? provisioningState = default; - long? revision = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("domain"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - domain = array; - continue; - } - if (property0.NameEquals("dnsServerIps"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(IPAddress.Parse(item.GetString())); - } - } - dnsServerIPs = array; - continue; - } - if (property0.NameEquals("sourceIp"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sourceIP = IPAddress.Parse(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("dnsServices"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dnsServices = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new WorkloadNetworkDnsZoneProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("revision"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - revision = property0.Value.GetInt64(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WorkloadNetworkDnsZoneData( - id, - name, - type, - systemData, - displayName, - domain ?? new ChangeTrackingList(), - dnsServerIPs ?? new ChangeTrackingList(), - sourceIP, - dnsServices, - provisioningState, - revision, - 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); - default: - throw new FormatException($"The model {nameof(WorkloadNetworkDnsZoneData)} does not support writing '{options.Format}' format."); - } - } - - WorkloadNetworkDnsZoneData 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 DeserializeWorkloadNetworkDnsZoneData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WorkloadNetworkDnsZoneData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneResource.Serialization.cs deleted file mode 100644 index 28df093b40c8..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkDnsZoneResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - WorkloadNetworkDnsZoneData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - WorkloadNetworkDnsZoneData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneResource.cs deleted file mode 100644 index de14d200e374..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneResource.cs +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A Class representing a WorkloadNetworkDnsZone along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetWorkloadNetworkDnsZoneResource method. - /// Otherwise you can get one from its parent resource using the GetWorkloadNetworkDnsZone method. - /// - public partial class WorkloadNetworkDnsZoneResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The privateCloudName. - /// The dnsZoneId. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkDnsZoneWorkloadNetworksRestClient; - private readonly WorkloadNetworkDnsZoneData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/dnsZones"; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkDnsZoneResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal WorkloadNetworkDnsZoneResource(ArmClient client, WorkloadNetworkDnsZoneData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal WorkloadNetworkDnsZoneResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string workloadNetworkDnsZoneWorkloadNetworksApiVersion); - _workloadNetworkDnsZoneWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkDnsZoneWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual WorkloadNetworkDnsZoneData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get a WorkloadNetworkDnsZone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneResource.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsZoneWorkloadNetworksRestClient.GetDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsZoneResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkDnsZone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneResource.Get"); - scope.Start(); - try - { - var response = _workloadNetworkDnsZoneWorkloadNetworksRestClient.GetDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkDnsZoneResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a WorkloadNetworkDnsZone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_DeleteDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneResource.Delete"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsZoneWorkloadNetworksRestClient.DeleteDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateDeleteDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a WorkloadNetworkDnsZone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_DeleteDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneResource.Delete"); - scope.Start(); - try - { - var response = _workloadNetworkDnsZoneWorkloadNetworksRestClient.DeleteDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateDeleteDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update a WorkloadNetworkDnsZone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_UpdateDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, WorkloadNetworkDnsZoneData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneResource.Update"); - scope.Start(); - try - { - var response = await _workloadNetworkDnsZoneWorkloadNetworksRestClient.UpdateDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkDnsZoneOperationSource(Client), _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateUpdateDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update a WorkloadNetworkDnsZone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} - /// - /// - /// Operation Id - /// WorkloadNetworks_UpdateDnsZone - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, WorkloadNetworkDnsZoneData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkDnsZoneResource.Update"); - scope.Start(); - try - { - var response = _workloadNetworkDnsZoneWorkloadNetworksRestClient.UpdateDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkDnsZoneOperationSource(Client), _workloadNetworkDnsZoneWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkDnsZoneWorkloadNetworksRestClient.CreateUpdateDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs index a4538dd74618..9ab8a1ac55f1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs @@ -24,8 +24,8 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkGatewayCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _workloadNetworkGatewayWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkGatewayWorkloadNetworksRestClient; + private readonly ClientDiagnostics _workloadNetworkGatewayClientDiagnostics; + private readonly WorkloadNetworkGatewaysRestOperations _workloadNetworkGatewayRestClient; /// Initializes a new instance of the class for mocking. protected WorkloadNetworkGatewayCollection() @@ -37,9 +37,9 @@ protected WorkloadNetworkGatewayCollection() /// The identifier of the parent resource that is the target of operations. internal WorkloadNetworkGatewayCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _workloadNetworkGatewayWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkGatewayResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(WorkloadNetworkGatewayResource.ResourceType, out string workloadNetworkGatewayWorkloadNetworksApiVersion); - _workloadNetworkGatewayWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkGatewayWorkloadNetworksApiVersion); + _workloadNetworkGatewayClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkGatewayResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(WorkloadNetworkGatewayResource.ResourceType, out string workloadNetworkGatewayApiVersion); + _workloadNetworkGatewayRestClient = new WorkloadNetworkGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkGatewayApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -60,11 +60,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// WorkloadNetworks_GetGateway + /// WorkloadNetworkGateway_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -80,11 +80,11 @@ public virtual async Task> GetAsync(str { Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); - using var scope = _workloadNetworkGatewayWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Get"); + using var scope = _workloadNetworkGatewayClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Get"); scope.Start(); try { - var response = await _workloadNetworkGatewayWorkloadNetworksRestClient.GetGatewayAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkGatewayResource(Client, response.Value), response.GetRawResponse()); @@ -105,11 +105,11 @@ public virtual async Task> GetAsync(str /// /// /// Operation Id - /// WorkloadNetworks_GetGateway + /// WorkloadNetworkGateway_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -125,11 +125,11 @@ public virtual Response Get(string gatewayId, Ca { Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); - using var scope = _workloadNetworkGatewayWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Get"); + using var scope = _workloadNetworkGatewayClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Get"); scope.Start(); try { - var response = _workloadNetworkGatewayWorkloadNetworksRestClient.GetGateway(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken); + var response = _workloadNetworkGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkGatewayResource(Client, response.Value), response.GetRawResponse()); @@ -150,11 +150,11 @@ public virtual Response Get(string gatewayId, Ca /// /// /// Operation Id - /// WorkloadNetworks_ListGateways + /// WorkloadNetworkGateway_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -166,9 +166,9 @@ public virtual Response Get(string gatewayId, Ca /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkGatewayWorkloadNetworksRestClient.CreateListGatewaysRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkGatewayWorkloadNetworksRestClient.CreateListGatewaysNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkGatewayResource(Client, WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(e)), _workloadNetworkGatewayWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkGatewayCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkGatewayRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkGatewayRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkGatewayResource(Client, WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(e)), _workloadNetworkGatewayClientDiagnostics, Pipeline, "WorkloadNetworkGatewayCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -180,11 +180,11 @@ public virtual AsyncPageable GetAllAsync(Cancell /// /// /// Operation Id - /// WorkloadNetworks_ListGateways + /// WorkloadNetworkGateway_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -196,9 +196,9 @@ public virtual AsyncPageable GetAllAsync(Cancell /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkGatewayWorkloadNetworksRestClient.CreateListGatewaysRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkGatewayWorkloadNetworksRestClient.CreateListGatewaysNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkGatewayResource(Client, WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(e)), _workloadNetworkGatewayWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkGatewayCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkGatewayRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkGatewayRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkGatewayResource(Client, WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(e)), _workloadNetworkGatewayClientDiagnostics, Pipeline, "WorkloadNetworkGatewayCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -210,11 +210,11 @@ public virtual Pageable GetAll(CancellationToken /// /// /// Operation Id - /// WorkloadNetworks_GetGateway + /// WorkloadNetworkGateway_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -230,11 +230,11 @@ public virtual async Task> ExistsAsync(string gatewayId, Cancella { Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); - using var scope = _workloadNetworkGatewayWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Exists"); + using var scope = _workloadNetworkGatewayClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Exists"); scope.Start(); try { - var response = await _workloadNetworkGatewayWorkloadNetworksRestClient.GetGatewayAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -253,11 +253,11 @@ public virtual async Task> ExistsAsync(string gatewayId, Cancella /// /// /// Operation Id - /// WorkloadNetworks_GetGateway + /// WorkloadNetworkGateway_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -273,11 +273,11 @@ public virtual Response Exists(string gatewayId, CancellationToken cancell { Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); - using var scope = _workloadNetworkGatewayWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Exists"); + using var scope = _workloadNetworkGatewayClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Exists"); scope.Start(); try { - var response = _workloadNetworkGatewayWorkloadNetworksRestClient.GetGateway(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken: cancellationToken); + var response = _workloadNetworkGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -296,11 +296,11 @@ public virtual Response Exists(string gatewayId, CancellationToken cancell /// /// /// Operation Id - /// WorkloadNetworks_GetGateway + /// WorkloadNetworkGateway_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -316,11 +316,11 @@ public virtual async Task> GetI { Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); - using var scope = _workloadNetworkGatewayWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetIfExists"); + using var scope = _workloadNetworkGatewayClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetIfExists"); scope.Start(); try { - var response = await _workloadNetworkGatewayWorkloadNetworksRestClient.GetGatewayAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkGatewayResource(Client, response.Value), response.GetRawResponse()); @@ -341,11 +341,11 @@ public virtual async Task> GetI /// /// /// Operation Id - /// WorkloadNetworks_GetGateway + /// WorkloadNetworkGateway_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -361,11 +361,11 @@ public virtual NullableResponse GetIfExists(stri { Argument.AssertNotNullOrEmpty(gatewayId, nameof(gatewayId)); - using var scope = _workloadNetworkGatewayWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetIfExists"); + using var scope = _workloadNetworkGatewayClientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetIfExists"); scope.Start(); try { - var response = _workloadNetworkGatewayWorkloadNetworksRestClient.GetGateway(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken: cancellationToken); + var response = _workloadNetworkGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, gatewayId, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkGatewayResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.Serialization.cs index adc57fa8dea3..0eedfbe832a5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.Serialization.cs @@ -37,24 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(DisplayName)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsDefined(Path)) - { - writer.WritePropertyName("path"u8); - writer.WriteStringValue(Path); - } - writer.WriteEndObject(); } WorkloadNetworkGatewayData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -77,17 +64,24 @@ internal static WorkloadNetworkGatewayData DeserializeWorkloadNetworkGatewayData { return null; } + WorkloadNetworkGatewayProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - WorkloadNetworkProvisioningState? provisioningState = default; - string displayName = default; - string path = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WorkloadNetworkGatewayProperties.DeserializeWorkloadNetworkGatewayProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -112,37 +106,6 @@ internal static WorkloadNetworkGatewayData DeserializeWorkloadNetworkGatewayData systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new WorkloadNetworkProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("path"u8)) - { - path = property0.Value.GetString(); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -154,9 +117,7 @@ internal static WorkloadNetworkGatewayData DeserializeWorkloadNetworkGatewayData name, type, systemData, - provisioningState, - displayName, - path, + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs index 0fc7f4b046f7..1a257481f245 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs @@ -52,7 +52,7 @@ public partial class WorkloadNetworkGatewayData : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public WorkloadNetworkGatewayData() + internal WorkloadNetworkGatewayData() { } @@ -61,23 +61,15 @@ public WorkloadNetworkGatewayData() /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. - /// Display name of the DHCP entity. - /// NSX Gateway Path. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkGatewayData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkProvisioningState? provisioningState, string displayName, string path, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal WorkloadNetworkGatewayData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkGatewayProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - ProvisioningState = provisioningState; - DisplayName = displayName; - Path = path; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The provisioning state of the resource. - public WorkloadNetworkProvisioningState? ProvisioningState { get; } - /// Display name of the DHCP entity. - public string DisplayName { get; set; } - /// NSX Gateway Path. - public string Path { get; } + /// The resource-specific properties for this resource. + public WorkloadNetworkGatewayProperties Properties { get; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayResource.cs index 4934766c2503..c4b94cbb9d43 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayResource.cs @@ -33,8 +33,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _workloadNetworkGatewayWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkGatewayWorkloadNetworksRestClient; + private readonly ClientDiagnostics _workloadNetworkGatewayClientDiagnostics; + private readonly WorkloadNetworkGatewaysRestOperations _workloadNetworkGatewayRestClient; private readonly WorkloadNetworkGatewayData _data; /// Gets the resource type for the operations. @@ -59,9 +59,9 @@ internal WorkloadNetworkGatewayResource(ArmClient client, WorkloadNetworkGateway /// The identifier of the resource that is the target of operations. internal WorkloadNetworkGatewayResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _workloadNetworkGatewayWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string workloadNetworkGatewayWorkloadNetworksApiVersion); - _workloadNetworkGatewayWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkGatewayWorkloadNetworksApiVersion); + _workloadNetworkGatewayClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string workloadNetworkGatewayApiVersion); + _workloadNetworkGatewayRestClient = new WorkloadNetworkGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkGatewayApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -97,11 +97,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// WorkloadNetworks_GetGateway + /// WorkloadNetworkGateway_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -112,11 +112,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkGatewayWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkGatewayResource.Get"); + using var scope = _workloadNetworkGatewayClientDiagnostics.CreateScope("WorkloadNetworkGatewayResource.Get"); scope.Start(); try { - var response = await _workloadNetworkGatewayWorkloadNetworksRestClient.GetGatewayAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkGatewayRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkGatewayResource(Client, response.Value), response.GetRawResponse()); @@ -137,11 +137,11 @@ public virtual async Task> GetAsync(Can /// /// /// Operation Id - /// WorkloadNetworks_GetGateway + /// WorkloadNetworkGateway_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -152,11 +152,11 @@ public virtual async Task> GetAsync(Can /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkGatewayWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkGatewayResource.Get"); + using var scope = _workloadNetworkGatewayClientDiagnostics.CreateScope("WorkloadNetworkGatewayResource.Get"); scope.Start(); try { - var response = _workloadNetworkGatewayWorkloadNetworksRestClient.GetGateway(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var response = _workloadNetworkGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkGatewayResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs deleted file mode 100644 index 338c3c2d043a..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetWorkloadNetworkPortMirroringProfiles method from an instance of . - /// - public partial class WorkloadNetworkPortMirroringProfileCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkPortMirroringProfileCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal WorkloadNetworkPortMirroringProfileCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkPortMirroringProfileResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(WorkloadNetworkPortMirroringProfileResource.ResourceType, out string workloadNetworkPortMirroringProfileWorkloadNetworksApiVersion); - _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkPortMirroringProfileWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != WorkloadNetworkResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkloadNetworkResource.ResourceType), nameof(id)); - } - - /// - /// Create a WorkloadNetworkPortMirroring - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreatePortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// ID of the NSX port mirroring profile. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string portMirroringId, WorkloadNetworkPortMirroringProfileData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreatePortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkPortMirroringProfileOperationSource(Client), _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateCreatePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a WorkloadNetworkPortMirroring - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreatePortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// ID of the NSX port mirroring profile. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string portMirroringId, WorkloadNetworkPortMirroringProfileData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreatePortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkPortMirroringProfileOperationSource(Client), _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateCreatePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkPortMirroring - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the NSX port mirroring profile. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string portMirroringId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileCollection.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.GetPortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPortMirroringProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkPortMirroring - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the NSX port mirroring profile. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string portMirroringId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileCollection.Get"); - scope.Start(); - try - { - var response = _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.GetPortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPortMirroringProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles - /// - /// - /// Operation Id - /// WorkloadNetworks_ListPortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateListPortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateListPortMirroringNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkPortMirroringProfileResource(Client, WorkloadNetworkPortMirroringProfileData.DeserializeWorkloadNetworkPortMirroringProfileData(e)), _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPortMirroringProfileCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles - /// - /// - /// Operation Id - /// WorkloadNetworks_ListPortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateListPortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateListPortMirroringNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkPortMirroringProfileResource(Client, WorkloadNetworkPortMirroringProfileData.DeserializeWorkloadNetworkPortMirroringProfileData(e)), _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPortMirroringProfileCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the NSX port mirroring profile. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string portMirroringId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileCollection.Exists"); - scope.Start(); - try - { - var response = await _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.GetPortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the NSX port mirroring profile. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string portMirroringId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileCollection.Exists"); - scope.Start(); - try - { - var response = _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.GetPortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the NSX port mirroring profile. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string portMirroringId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.GetPortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPortMirroringProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the NSX port mirroring profile. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string portMirroringId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); - - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileCollection.GetIfExists"); - scope.Start(); - try - { - var response = _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.GetPortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPortMirroringProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileData.Serialization.cs deleted file mode 100644 index a6061aea7c62..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileData.Serialization.cs +++ /dev/null @@ -1,254 +0,0 @@ -// 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; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkPortMirroringProfileData : 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 override 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(WorkloadNetworkPortMirroringProfileData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(Direction)) - { - writer.WritePropertyName("direction"u8); - writer.WriteStringValue(Direction.Value.ToString()); - } - if (Optional.IsDefined(Source)) - { - writer.WritePropertyName("source"u8); - writer.WriteStringValue(Source); - } - if (Optional.IsDefined(Destination)) - { - writer.WritePropertyName("destination"u8); - writer.WriteStringValue(Destination); - } - if (options.Format != "W" && Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(Revision)) - { - writer.WritePropertyName("revision"u8); - writer.WriteNumberValue(Revision.Value); - } - writer.WriteEndObject(); - } - - WorkloadNetworkPortMirroringProfileData 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(WorkloadNetworkPortMirroringProfileData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWorkloadNetworkPortMirroringProfileData(document.RootElement, options); - } - - internal static WorkloadNetworkPortMirroringProfileData DeserializeWorkloadNetworkPortMirroringProfileData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string displayName = default; - PortMirroringProfileDirection? direction = default; - string source = default; - string destination = default; - PortMirroringProfileStatus? status = default; - WorkloadNetworkPortMirroringProfileProvisioningState? provisioningState = default; - long? revision = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("direction"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - direction = new PortMirroringProfileDirection(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("source"u8)) - { - source = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("destination"u8)) - { - destination = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new PortMirroringProfileStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new WorkloadNetworkPortMirroringProfileProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("revision"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - revision = property0.Value.GetInt64(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WorkloadNetworkPortMirroringProfileData( - id, - name, - type, - systemData, - displayName, - direction, - source, - destination, - status, - provisioningState, - revision, - 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); - default: - throw new FormatException($"The model {nameof(WorkloadNetworkPortMirroringProfileData)} does not support writing '{options.Format}' format."); - } - } - - WorkloadNetworkPortMirroringProfileData 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 DeserializeWorkloadNetworkPortMirroringProfileData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WorkloadNetworkPortMirroringProfileData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileResource.Serialization.cs deleted file mode 100644 index 8e2b23296930..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkPortMirroringProfileResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - WorkloadNetworkPortMirroringProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - WorkloadNetworkPortMirroringProfileData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileResource.cs deleted file mode 100644 index 328efe9cb522..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileResource.cs +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A Class representing a WorkloadNetworkPortMirroringProfile along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetWorkloadNetworkPortMirroringProfileResource method. - /// Otherwise you can get one from its parent resource using the GetWorkloadNetworkPortMirroringProfile method. - /// - public partial class WorkloadNetworkPortMirroringProfileResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The privateCloudName. - /// The portMirroringId. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient; - private readonly WorkloadNetworkPortMirroringProfileData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/portMirroringProfiles"; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkPortMirroringProfileResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal WorkloadNetworkPortMirroringProfileResource(ArmClient client, WorkloadNetworkPortMirroringProfileData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal WorkloadNetworkPortMirroringProfileResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string workloadNetworkPortMirroringProfileWorkloadNetworksApiVersion); - _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkPortMirroringProfileWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual WorkloadNetworkPortMirroringProfileData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get a WorkloadNetworkPortMirroring - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileResource.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.GetPortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPortMirroringProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkPortMirroring - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileResource.Get"); - scope.Start(); - try - { - var response = _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.GetPortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPortMirroringProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a WorkloadNetworkPortMirroring - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_DeletePortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileResource.Delete"); - scope.Start(); - try - { - var response = await _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.DeletePortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateDeletePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a WorkloadNetworkPortMirroring - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_DeletePortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileResource.Delete"); - scope.Start(); - try - { - var response = _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.DeletePortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateDeletePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update a WorkloadNetworkPortMirroring - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_UpdatePortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, WorkloadNetworkPortMirroringProfileData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileResource.Update"); - scope.Start(); - try - { - var response = await _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.UpdatePortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkPortMirroringProfileOperationSource(Client), _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateUpdatePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update a WorkloadNetworkPortMirroring - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} - /// - /// - /// Operation Id - /// WorkloadNetworks_UpdatePortMirroring - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, WorkloadNetworkPortMirroringProfileData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPortMirroringProfileResource.Update"); - scope.Start(); - try - { - var response = _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.UpdatePortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkPortMirroringProfileOperationSource(Client), _workloadNetworkPortMirroringProfileWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfileWorkloadNetworksRestClient.CreateUpdatePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs deleted file mode 100644 index b93d183dc952..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetWorkloadNetworkPublicIPs method from an instance of . - /// - public partial class WorkloadNetworkPublicIPCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkPublicIPWorkloadNetworksRestClient; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkPublicIPCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal WorkloadNetworkPublicIPCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkPublicIPResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(WorkloadNetworkPublicIPResource.ResourceType, out string workloadNetworkPublicIPWorkloadNetworksApiVersion); - _workloadNetworkPublicIPWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkPublicIPWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != WorkloadNetworkResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkloadNetworkResource.ResourceType), nameof(id)); - } - - /// - /// Create a WorkloadNetworkPublicIP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreatePublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// ID of the DNS zone. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string publicIPId, WorkloadNetworkPublicIPData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _workloadNetworkPublicIPWorkloadNetworksRestClient.CreatePublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkPublicIPOperationSource(Client), _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateCreatePublicIPRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a WorkloadNetworkPublicIP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreatePublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// ID of the DNS zone. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string publicIPId, WorkloadNetworkPublicIPData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _workloadNetworkPublicIPWorkloadNetworksRestClient.CreatePublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkPublicIPOperationSource(Client), _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateCreatePublicIPRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkPublicIP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string publicIPId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkPublicIPWorkloadNetworksRestClient.GetPublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPublicIPResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkPublicIP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string publicIPId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.Get"); - scope.Start(); - try - { - var response = _workloadNetworkPublicIPWorkloadNetworksRestClient.GetPublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPublicIPResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List WorkloadNetworkPublicIP resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs - /// - /// - /// Operation Id - /// WorkloadNetworks_ListPublicIPs - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateListPublicIPsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateListPublicIPsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkPublicIPResource(Client, WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(e)), _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPublicIPCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// List WorkloadNetworkPublicIP resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs - /// - /// - /// Operation Id - /// WorkloadNetworks_ListPublicIPs - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateListPublicIPsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateListPublicIPsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkPublicIPResource(Client, WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(e)), _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkPublicIPCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string publicIPId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.Exists"); - scope.Start(); - try - { - var response = await _workloadNetworkPublicIPWorkloadNetworksRestClient.GetPublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string publicIPId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.Exists"); - scope.Start(); - try - { - var response = _workloadNetworkPublicIPWorkloadNetworksRestClient.GetPublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string publicIPId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _workloadNetworkPublicIPWorkloadNetworksRestClient.GetPublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPublicIPResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the DNS zone. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string publicIPId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.GetIfExists"); - scope.Start(); - try - { - var response = _workloadNetworkPublicIPWorkloadNetworksRestClient.GetPublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPublicIPResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.Serialization.cs deleted file mode 100644 index 163faababefb..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.Serialization.cs +++ /dev/null @@ -1,210 +0,0 @@ -// 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; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkPublicIPData : 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 override 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(WorkloadNetworkPublicIPData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(NumberOfPublicIPs)) - { - writer.WritePropertyName("numberOfPublicIPs"u8); - writer.WriteNumberValue(NumberOfPublicIPs.Value); - } - if (options.Format != "W" && Optional.IsDefined(PublicIPBlock)) - { - writer.WritePropertyName("publicIPBlock"u8); - writer.WriteStringValue(PublicIPBlock); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - writer.WriteEndObject(); - } - - WorkloadNetworkPublicIPData 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(WorkloadNetworkPublicIPData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWorkloadNetworkPublicIPData(document.RootElement, options); - } - - internal static WorkloadNetworkPublicIPData DeserializeWorkloadNetworkPublicIPData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string displayName = default; - long? numberOfPublicIPs = default; - string publicIPBlock = default; - WorkloadNetworkPublicIPProvisioningState? provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("numberOfPublicIPs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - numberOfPublicIPs = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("publicIPBlock"u8)) - { - publicIPBlock = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new WorkloadNetworkPublicIPProvisioningState(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WorkloadNetworkPublicIPData( - id, - name, - type, - systemData, - displayName, - numberOfPublicIPs, - publicIPBlock, - provisioningState, - 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); - default: - throw new FormatException($"The model {nameof(WorkloadNetworkPublicIPData)} does not support writing '{options.Format}' format."); - } - } - - WorkloadNetworkPublicIPData 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 DeserializeWorkloadNetworkPublicIPData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WorkloadNetworkPublicIPData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPResource.Serialization.cs deleted file mode 100644 index 59426e80bdcf..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkPublicIPResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - WorkloadNetworkPublicIPData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - WorkloadNetworkPublicIPData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPResource.cs deleted file mode 100644 index 39b6edfcefd1..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPResource.cs +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A Class representing a WorkloadNetworkPublicIP along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetWorkloadNetworkPublicIPResource method. - /// Otherwise you can get one from its parent resource using the GetWorkloadNetworkPublicIP method. - /// - public partial class WorkloadNetworkPublicIPResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The privateCloudName. - /// The publicIPId. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkPublicIPWorkloadNetworksRestClient; - private readonly WorkloadNetworkPublicIPData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/publicIPs"; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkPublicIPResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal WorkloadNetworkPublicIPResource(ArmClient client, WorkloadNetworkPublicIPData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal WorkloadNetworkPublicIPResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string workloadNetworkPublicIPWorkloadNetworksApiVersion); - _workloadNetworkPublicIPWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkPublicIPWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual WorkloadNetworkPublicIPData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get a WorkloadNetworkPublicIP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPResource.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkPublicIPWorkloadNetworksRestClient.GetPublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPublicIPResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkPublicIP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetPublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPResource.Get"); - scope.Start(); - try - { - var response = _workloadNetworkPublicIPWorkloadNetworksRestClient.GetPublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkPublicIPResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a WorkloadNetworkPublicIP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_DeletePublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPResource.Delete"); - scope.Start(); - try - { - var response = await _workloadNetworkPublicIPWorkloadNetworksRestClient.DeletePublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateDeletePublicIPRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a WorkloadNetworkPublicIP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_DeletePublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPResource.Delete"); - scope.Start(); - try - { - var response = _workloadNetworkPublicIPWorkloadNetworksRestClient.DeletePublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateDeletePublicIPRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a WorkloadNetworkPublicIP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreatePublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Resource create parameters. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, WorkloadNetworkPublicIPData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPResource.Update"); - scope.Start(); - try - { - var response = await _workloadNetworkPublicIPWorkloadNetworksRestClient.CreatePublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkPublicIPOperationSource(Client), _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateCreatePublicIPRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a WorkloadNetworkPublicIP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreatePublicIP - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Resource create parameters. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, WorkloadNetworkPublicIPData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkPublicIPResource.Update"); - scope.Start(); - try - { - var response = _workloadNetworkPublicIPWorkloadNetworksRestClient.CreatePublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkPublicIPOperationSource(Client), _workloadNetworkPublicIPWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkPublicIPWorkloadNetworksRestClient.CreateCreatePublicIPRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkResource.cs index c660592ea8b9..157319d952f9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkResource.cs @@ -9,8 +9,10 @@ using System.Globalization; using System.Threading; using System.Threading.Tasks; +using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs { @@ -18,7 +20,7 @@ namespace Azure.ResourceManager.Avs /// A Class representing a WorkloadNetwork along with the instance operations that can be performed on it. /// If you have a you can construct a /// from an instance of using the GetWorkloadNetworkResource method. - /// Otherwise you can get one from its parent resource using the GetWorkloadNetwork method. + /// Otherwise you can get one from its parent resource using the GetWorkloadNetwork method. /// public partial class WorkloadNetworkResource : ArmResource { @@ -34,6 +36,18 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ClientDiagnostics _workloadNetworkClientDiagnostics; private readonly WorkloadNetworksRestOperations _workloadNetworkRestClient; + private readonly ClientDiagnostics _workloadNetworkDhcpConfigurationsClientDiagnostics; + private readonly WorkloadNetworkDhcpConfigurationsRestOperations _workloadNetworkDhcpConfigurationsRestClient; + private readonly ClientDiagnostics _workloadNetworkDnsServicesClientDiagnostics; + private readonly WorkloadNetworkDnsServicesRestOperations _workloadNetworkDnsServicesRestClient; + private readonly ClientDiagnostics _workloadNetworkDnsZonesClientDiagnostics; + private readonly WorkloadNetworkDnsZonesRestOperations _workloadNetworkDnsZonesRestClient; + private readonly ClientDiagnostics _workloadNetworkPortMirroringProfilesClientDiagnostics; + private readonly WorkloadNetworkPortMirroringProfilesRestOperations _workloadNetworkPortMirroringProfilesRestClient; + private readonly ClientDiagnostics _workloadNetworkPublicIPsClientDiagnostics; + private readonly WorkloadNetworkPublicIpsRestOperations _workloadNetworkPublicIPsRestClient; + private readonly ClientDiagnostics _workloadNetworkVmGroupsClientDiagnostics; + private readonly WorkloadNetworkVmGroupsRestOperations _workloadNetworkVmGroupsRestClient; private readonly WorkloadNetworkData _data; /// Gets the resource type for the operations. @@ -61,6 +75,18 @@ internal WorkloadNetworkResource(ArmClient client, ResourceIdentifier id) : base _workloadNetworkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string workloadNetworkApiVersion); _workloadNetworkRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkApiVersion); + _workloadNetworkDhcpConfigurationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workloadNetworkDhcpConfigurationsRestClient = new WorkloadNetworkDhcpConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _workloadNetworkDnsServicesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workloadNetworkDnsServicesRestClient = new WorkloadNetworkDnsServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _workloadNetworkDnsZonesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workloadNetworkDnsZonesRestClient = new WorkloadNetworkDnsZonesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _workloadNetworkPortMirroringProfilesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workloadNetworkPortMirroringProfilesRestClient = new WorkloadNetworkPortMirroringProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _workloadNetworkPublicIPsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workloadNetworkPublicIPsRestClient = new WorkloadNetworkPublicIpsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _workloadNetworkVmGroupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workloadNetworkVmGroupsRestClient = new WorkloadNetworkVmGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -87,563 +113,2233 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of WorkloadNetworkDhcpResources in the WorkloadNetwork. - /// An object representing collection of WorkloadNetworkDhcpResources and their operations over a WorkloadNetworkDhcpResource. - public virtual WorkloadNetworkDhcpCollection GetWorkloadNetworkDhcps() + /// Gets a collection of WorkloadNetworkGatewayResources in the WorkloadNetwork. + /// An object representing collection of WorkloadNetworkGatewayResources and their operations over a WorkloadNetworkGatewayResource. + public virtual WorkloadNetworkGatewayCollection GetWorkloadNetworkGateways() { - return GetCachedClient(client => new WorkloadNetworkDhcpCollection(client, Id)); + return GetCachedClient(client => new WorkloadNetworkGatewayCollection(client, Id)); } /// - /// Get a WorkloadNetworkDhcp + /// Get a WorkloadNetworkGateway /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId} /// /// /// Operation Id - /// WorkloadNetworks_GetDhcp + /// WorkloadNetworkGateway_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// - /// The ID of the DHCP configuration. + /// The ID of the NSX Gateway. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetWorkloadNetworkDhcpAsync(string dhcpId, CancellationToken cancellationToken = default) + public virtual async Task> GetWorkloadNetworkGatewayAsync(string gatewayId, CancellationToken cancellationToken = default) { - return await GetWorkloadNetworkDhcps().GetAsync(dhcpId, cancellationToken).ConfigureAwait(false); + return await GetWorkloadNetworkGateways().GetAsync(gatewayId, cancellationToken).ConfigureAwait(false); } /// - /// Get a WorkloadNetworkDhcp + /// Get a WorkloadNetworkGateway /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId} /// /// /// Operation Id - /// WorkloadNetworks_GetDhcp + /// WorkloadNetworkGateway_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// - /// The ID of the DHCP configuration. + /// The ID of the NSX Gateway. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetWorkloadNetworkDhcp(string dhcpId, CancellationToken cancellationToken = default) + public virtual Response GetWorkloadNetworkGateway(string gatewayId, CancellationToken cancellationToken = default) { - return GetWorkloadNetworkDhcps().Get(dhcpId, cancellationToken); + return GetWorkloadNetworkGateways().Get(gatewayId, cancellationToken); } - /// Gets a collection of WorkloadNetworkDnsServiceResources in the WorkloadNetwork. - /// An object representing collection of WorkloadNetworkDnsServiceResources and their operations over a WorkloadNetworkDnsServiceResource. - public virtual WorkloadNetworkDnsServiceCollection GetWorkloadNetworkDnsServices() + /// Gets a collection of WorkloadNetworkSegmentResources in the WorkloadNetwork. + /// An object representing collection of WorkloadNetworkSegmentResources and their operations over a WorkloadNetworkSegmentResource. + public virtual WorkloadNetworkSegmentCollection GetWorkloadNetworkSegments() { - return GetCachedClient(client => new WorkloadNetworkDnsServiceCollection(client, Id)); + return GetCachedClient(client => new WorkloadNetworkSegmentCollection(client, Id)); } /// - /// Get a WorkloadNetworkDnsService + /// Get a WorkloadNetworkSegment /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId} /// /// /// Operation Id - /// WorkloadNetworks_GetDnsService + /// WorkloadNetworkSegment_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// - /// ID of the DNS service. + /// The ID of the NSX Segment. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetWorkloadNetworkDnsServiceAsync(string dnsServiceId, CancellationToken cancellationToken = default) + public virtual async Task> GetWorkloadNetworkSegmentAsync(string segmentId, CancellationToken cancellationToken = default) { - return await GetWorkloadNetworkDnsServices().GetAsync(dnsServiceId, cancellationToken).ConfigureAwait(false); + return await GetWorkloadNetworkSegments().GetAsync(segmentId, cancellationToken).ConfigureAwait(false); } /// - /// Get a WorkloadNetworkDnsService + /// Get a WorkloadNetworkSegment /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId} /// /// /// Operation Id - /// WorkloadNetworks_GetDnsService + /// WorkloadNetworkSegment_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// - /// ID of the DNS service. + /// The ID of the NSX Segment. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetWorkloadNetworkDnsService(string dnsServiceId, CancellationToken cancellationToken = default) + public virtual Response GetWorkloadNetworkSegment(string segmentId, CancellationToken cancellationToken = default) { - return GetWorkloadNetworkDnsServices().Get(dnsServiceId, cancellationToken); + return GetWorkloadNetworkSegments().Get(segmentId, cancellationToken); } - /// Gets a collection of WorkloadNetworkDnsZoneResources in the WorkloadNetwork. - /// An object representing collection of WorkloadNetworkDnsZoneResources and their operations over a WorkloadNetworkDnsZoneResource. - public virtual WorkloadNetworkDnsZoneCollection GetWorkloadNetworkDnsZones() + /// Gets a collection of WorkloadNetworkVirtualMachineResources in the WorkloadNetwork. + /// An object representing collection of WorkloadNetworkVirtualMachineResources and their operations over a WorkloadNetworkVirtualMachineResource. + public virtual WorkloadNetworkVirtualMachineCollection GetWorkloadNetworkVirtualMachines() { - return GetCachedClient(client => new WorkloadNetworkDnsZoneCollection(client, Id)); + return GetCachedClient(client => new WorkloadNetworkVirtualMachineCollection(client, Id)); } /// - /// Get a WorkloadNetworkDnsZone + /// Get a WorkloadNetworkVirtualMachine /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId} /// /// /// Operation Id - /// WorkloadNetworks_GetDnsZone + /// WorkloadNetworkVirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// - /// ID of the DNS zone. + /// ID of the virtual machine. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetWorkloadNetworkDnsZoneAsync(string dnsZoneId, CancellationToken cancellationToken = default) + public virtual async Task> GetWorkloadNetworkVirtualMachineAsync(string virtualMachineId, CancellationToken cancellationToken = default) { - return await GetWorkloadNetworkDnsZones().GetAsync(dnsZoneId, cancellationToken).ConfigureAwait(false); + return await GetWorkloadNetworkVirtualMachines().GetAsync(virtualMachineId, cancellationToken).ConfigureAwait(false); } /// - /// Get a WorkloadNetworkDnsZone + /// Get a WorkloadNetworkVirtualMachine /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId} /// /// /// Operation Id - /// WorkloadNetworks_GetDnsZone + /// WorkloadNetworkVirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// - /// ID of the DNS zone. + /// ID of the virtual machine. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetWorkloadNetworkDnsZone(string dnsZoneId, CancellationToken cancellationToken = default) - { - return GetWorkloadNetworkDnsZones().Get(dnsZoneId, cancellationToken); - } - - /// Gets a collection of WorkloadNetworkGatewayResources in the WorkloadNetwork. - /// An object representing collection of WorkloadNetworkGatewayResources and their operations over a WorkloadNetworkGatewayResource. - public virtual WorkloadNetworkGatewayCollection GetWorkloadNetworkGateways() + public virtual Response GetWorkloadNetworkVirtualMachine(string virtualMachineId, CancellationToken cancellationToken = default) { - return GetCachedClient(client => new WorkloadNetworkGatewayCollection(client, Id)); + return GetWorkloadNetworkVirtualMachines().Get(virtualMachineId, cancellationToken); } /// - /// Get a WorkloadNetworkGateway + /// Get a WorkloadNetwork /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default /// /// /// Operation Id - /// WorkloadNetworks_GetGateway + /// WorkloadNetwork_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// - /// The ID of the NSX Gateway. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetWorkloadNetworkGatewayAsync(string gatewayId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - return await GetWorkloadNetworkGateways().GetAsync(gatewayId, cancellationToken).ConfigureAwait(false); + using var scope = _workloadNetworkClientDiagnostics.CreateScope("WorkloadNetworkResource.Get"); + scope.Start(); + try + { + var response = await _workloadNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get a WorkloadNetworkGateway + /// Get a WorkloadNetwork /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default /// /// /// Operation Id - /// WorkloadNetworks_GetGateway + /// WorkloadNetwork_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource - /// + /// /// /// /// - /// The ID of the NSX Gateway. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetWorkloadNetworkGateway(string gatewayId, CancellationToken cancellationToken = default) - { - return GetWorkloadNetworkGateways().Get(gatewayId, cancellationToken); - } - - /// Gets a collection of WorkloadNetworkPortMirroringProfileResources in the WorkloadNetwork. - /// An object representing collection of WorkloadNetworkPortMirroringProfileResources and their operations over a WorkloadNetworkPortMirroringProfileResource. - public virtual WorkloadNetworkPortMirroringProfileCollection GetWorkloadNetworkPortMirroringProfiles() + public virtual Response Get(CancellationToken cancellationToken = default) { - return GetCachedClient(client => new WorkloadNetworkPortMirroringProfileCollection(client, Id)); + using var scope = _workloadNetworkClientDiagnostics.CreateScope("WorkloadNetworkResource.Get"); + scope.Start(); + try + { + var response = _workloadNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get a WorkloadNetworkPortMirroring + /// List WorkloadNetworkDhcp resources by WorkloadNetwork /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations /// /// /// Operation Id - /// WorkloadNetworks_GetPortMirroring + /// WorkloadNetworkDhcp_List /// /// /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// + /// 2024-09-01 /// /// /// - /// ID of the NSX port mirroring profile. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetWorkloadNetworkPortMirroringProfileAsync(string portMirroringId, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkDhcpConfigurationsAsync(CancellationToken cancellationToken = default) { - return await GetWorkloadNetworkPortMirroringProfiles().GetAsync(portMirroringId, cancellationToken).ConfigureAwait(false); + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDhcpConfigurationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDhcpConfigurationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(e), _workloadNetworkDhcpConfigurationsClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkDhcpConfigurations", "value", "nextLink", cancellationToken); } /// - /// Get a WorkloadNetworkPortMirroring + /// List WorkloadNetworkDhcp resources by WorkloadNetwork /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations /// /// /// Operation Id - /// WorkloadNetworks_GetPortMirroring + /// WorkloadNetworkDhcp_List /// /// /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// + /// 2024-09-01 /// /// /// - /// ID of the NSX port mirroring profile. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetWorkloadNetworkPortMirroringProfile(string portMirroringId, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkDhcpConfigurations(CancellationToken cancellationToken = default) { - return GetWorkloadNetworkPortMirroringProfiles().Get(portMirroringId, cancellationToken); - } - - /// Gets a collection of WorkloadNetworkPublicIPResources in the WorkloadNetwork. - /// An object representing collection of WorkloadNetworkPublicIPResources and their operations over a WorkloadNetworkPublicIPResource. - public virtual WorkloadNetworkPublicIPCollection GetWorkloadNetworkPublicIPs() - { - return GetCachedClient(client => new WorkloadNetworkPublicIPCollection(client, Id)); + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDhcpConfigurationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDhcpConfigurationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(e), _workloadNetworkDhcpConfigurationsClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkDhcpConfigurations", "value", "nextLink", cancellationToken); } /// - /// Get a WorkloadNetworkPublicIP + /// Get a WorkloadNetworkDhcp /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} /// /// /// Operation Id - /// WorkloadNetworks_GetPublicIP + /// WorkloadNetworkDhcpConfigurations_Get /// /// /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// + /// 2024-09-01 /// /// /// - /// ID of the DNS zone. + /// The ID of the DHCP configuration. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetWorkloadNetworkPublicIPAsync(string publicIPId, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetWorkloadNetworkDhcpConfigurationAsync(string dhcpId, CancellationToken cancellationToken = default) { - return await GetWorkloadNetworkPublicIPs().GetAsync(publicIPId, cancellationToken).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + + using var scope = _workloadNetworkDhcpConfigurationsClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkDhcpConfiguration"); + scope.Start(); + try + { + var response = await _workloadNetworkDhcpConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dhcpId, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get a WorkloadNetworkPublicIP + /// Get a WorkloadNetworkDhcp /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} /// /// /// Operation Id - /// WorkloadNetworks_GetPublicIP + /// WorkloadNetworkDhcpConfigurations_Get /// /// /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// + /// 2024-09-01 /// /// /// - /// ID of the DNS zone. + /// The ID of the DHCP configuration. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetWorkloadNetworkPublicIP(string publicIPId, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetWorkloadNetworkDhcpConfiguration(string dhcpId, CancellationToken cancellationToken = default) { - return GetWorkloadNetworkPublicIPs().Get(publicIPId, cancellationToken); - } + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); - /// Gets a collection of WorkloadNetworkSegmentResources in the WorkloadNetwork. - /// An object representing collection of WorkloadNetworkSegmentResources and their operations over a WorkloadNetworkSegmentResource. - public virtual WorkloadNetworkSegmentCollection GetWorkloadNetworkSegments() - { - return GetCachedClient(client => new WorkloadNetworkSegmentCollection(client, Id)); + using var scope = _workloadNetworkDhcpConfigurationsClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkDhcpConfiguration"); + scope.Start(); + try + { + var response = _workloadNetworkDhcpConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dhcpId, Id.Parent.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get a WorkloadNetworkSegment + /// Create a WorkloadNetworkDhcp /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} /// /// /// Operation Id - /// WorkloadNetworks_GetSegment + /// WorkloadNetworkDhcp_Create /// /// /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// + /// 2024-09-01 /// /// /// - /// The ID of the NSX Segment. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the DHCP configuration. + /// Resource create parameters. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetWorkloadNetworkSegmentAsync(string segmentId, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateWorkloadNetworkDhcpConfigurationAsync(WaitUntil waitUntil, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) { - return await GetWorkloadNetworkSegments().GetAsync(segmentId, cancellationToken).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + Argument.AssertNotNull(workloadNetworkDhcp, nameof(workloadNetworkDhcp)); + + using var scope = _workloadNetworkDhcpConfigurationsClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkDhcpConfiguration"); + scope.Start(); + try + { + var response = await _workloadNetworkDhcpConfigurationsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, workloadNetworkDhcp, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkDhcpOperationSource(), _workloadNetworkDhcpConfigurationsClientDiagnostics, Pipeline, _workloadNetworkDhcpConfigurationsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, workloadNetworkDhcp).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get a WorkloadNetworkSegment + /// Create a WorkloadNetworkDhcp /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} /// /// /// Operation Id - /// WorkloadNetworks_GetSegment + /// WorkloadNetworkDhcp_Create /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the DHCP configuration. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateWorkloadNetworkDhcpConfiguration(WaitUntil waitUntil, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + Argument.AssertNotNull(workloadNetworkDhcp, nameof(workloadNetworkDhcp)); + + using var scope = _workloadNetworkDhcpConfigurationsClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkDhcpConfiguration"); + scope.Start(); + try + { + var response = _workloadNetworkDhcpConfigurationsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, workloadNetworkDhcp, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkDhcpOperationSource(), _workloadNetworkDhcpConfigurationsClientDiagnostics, Pipeline, _workloadNetworkDhcpConfigurationsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, workloadNetworkDhcp).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a WorkloadNetworkDhcp + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// + /// + /// Operation Id + /// WorkloadNetworkDhcp_Update + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the DHCP configuration. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UpdateWorkloadNetworkDhcpConfigurationAsync(WaitUntil waitUntil, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + Argument.AssertNotNull(workloadNetworkDhcp, nameof(workloadNetworkDhcp)); + + using var scope = _workloadNetworkDhcpConfigurationsClientDiagnostics.CreateScope("WorkloadNetworkResource.UpdateWorkloadNetworkDhcpConfiguration"); + scope.Start(); + try + { + var response = await _workloadNetworkDhcpConfigurationsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, workloadNetworkDhcp, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkDhcpOperationSource(), _workloadNetworkDhcpConfigurationsClientDiagnostics, Pipeline, _workloadNetworkDhcpConfigurationsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, workloadNetworkDhcp).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a WorkloadNetworkDhcp + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// + /// + /// Operation Id + /// WorkloadNetworkDhcp_Update + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the DHCP configuration. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation UpdateWorkloadNetworkDhcpConfiguration(WaitUntil waitUntil, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + Argument.AssertNotNull(workloadNetworkDhcp, nameof(workloadNetworkDhcp)); + + using var scope = _workloadNetworkDhcpConfigurationsClientDiagnostics.CreateScope("WorkloadNetworkResource.UpdateWorkloadNetworkDhcpConfiguration"); + scope.Start(); + try + { + var response = _workloadNetworkDhcpConfigurationsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, workloadNetworkDhcp, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkDhcpOperationSource(), _workloadNetworkDhcpConfigurationsClientDiagnostics, Pipeline, _workloadNetworkDhcpConfigurationsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, workloadNetworkDhcp).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadNetworkDhcp + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// + /// + /// Operation Id + /// WorkloadNetworkDhcp_Delete + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the DHCP configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkloadNetworkDhcpConfigurationAsync(WaitUntil waitUntil, string dhcpId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + + using var scope = _workloadNetworkDhcpConfigurationsClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkDhcpConfiguration"); + scope.Start(); + try + { + var response = await _workloadNetworkDhcpConfigurationsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_workloadNetworkDhcpConfigurationsClientDiagnostics, Pipeline, _workloadNetworkDhcpConfigurationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadNetworkDhcp + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId} + /// + /// + /// Operation Id + /// WorkloadNetworkDhcp_Delete + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID of the DHCP configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual ArmOperation DeleteWorkloadNetworkDhcpConfiguration(WaitUntil waitUntil, string dhcpId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dhcpId, nameof(dhcpId)); + + using var scope = _workloadNetworkDhcpConfigurationsClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkDhcpConfiguration"); + scope.Start(); + try + { + var response = _workloadNetworkDhcpConfigurationsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId, cancellationToken); + var operation = new AvsArmOperation(_workloadNetworkDhcpConfigurationsClientDiagnostics, Pipeline, _workloadNetworkDhcpConfigurationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dhcpId).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List WorkloadNetworkDnsService resources by WorkloadNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices + /// + /// + /// Operation Id + /// WorkloadNetworkDnsService_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkDnsServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsServicesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(e), _workloadNetworkDnsServicesClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkDnsServices", "value", "nextLink", cancellationToken); + } + + /// + /// List WorkloadNetworkDnsService resources by WorkloadNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices + /// + /// + /// Operation Id + /// WorkloadNetworkDnsService_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkDnsServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsServicesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(e), _workloadNetworkDnsServicesClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkDnsServices", "value", "nextLink", cancellationToken); + } + + /// + /// Get a WorkloadNetworkDnsService + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsService_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// ID of the DNS service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetWorkloadNetworkDnsServiceAsync(string dnsServiceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + + using var scope = _workloadNetworkDnsServicesClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkDnsService"); + scope.Start(); + try + { + var response = await _workloadNetworkDnsServicesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadNetworkDnsService + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsService_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// ID of the DNS service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetWorkloadNetworkDnsService(string dnsServiceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + + using var scope = _workloadNetworkDnsServicesClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkDnsService"); + scope.Start(); + try + { + var response = _workloadNetworkDnsServicesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadNetworkDnsService + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsService_Create + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS service. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateWorkloadNetworkDnsServiceAsync(WaitUntil waitUntil, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + Argument.AssertNotNull(workloadNetworkDnsService, nameof(workloadNetworkDnsService)); + + using var scope = _workloadNetworkDnsServicesClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkDnsService"); + scope.Start(); + try + { + var response = await _workloadNetworkDnsServicesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, workloadNetworkDnsService, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkDnsServiceOperationSource(), _workloadNetworkDnsServicesClientDiagnostics, Pipeline, _workloadNetworkDnsServicesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, workloadNetworkDnsService).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadNetworkDnsService + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsService_Create + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS service. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateWorkloadNetworkDnsService(WaitUntil waitUntil, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + Argument.AssertNotNull(workloadNetworkDnsService, nameof(workloadNetworkDnsService)); + + using var scope = _workloadNetworkDnsServicesClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkDnsService"); + scope.Start(); + try + { + var response = _workloadNetworkDnsServicesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, workloadNetworkDnsService, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkDnsServiceOperationSource(), _workloadNetworkDnsServicesClientDiagnostics, Pipeline, _workloadNetworkDnsServicesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, workloadNetworkDnsService).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a WorkloadNetworkDnsService + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsService_Update + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS service. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UpdateWorkloadNetworkDnsServiceAsync(WaitUntil waitUntil, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + Argument.AssertNotNull(workloadNetworkDnsService, nameof(workloadNetworkDnsService)); + + using var scope = _workloadNetworkDnsServicesClientDiagnostics.CreateScope("WorkloadNetworkResource.UpdateWorkloadNetworkDnsService"); + scope.Start(); + try + { + var response = await _workloadNetworkDnsServicesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, workloadNetworkDnsService, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkDnsServiceOperationSource(), _workloadNetworkDnsServicesClientDiagnostics, Pipeline, _workloadNetworkDnsServicesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, workloadNetworkDnsService).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a WorkloadNetworkDnsService + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsService_Update + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS service. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation UpdateWorkloadNetworkDnsService(WaitUntil waitUntil, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + Argument.AssertNotNull(workloadNetworkDnsService, nameof(workloadNetworkDnsService)); + + using var scope = _workloadNetworkDnsServicesClientDiagnostics.CreateScope("WorkloadNetworkResource.UpdateWorkloadNetworkDnsService"); + scope.Start(); + try + { + var response = _workloadNetworkDnsServicesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, workloadNetworkDnsService, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkDnsServiceOperationSource(), _workloadNetworkDnsServicesClientDiagnostics, Pipeline, _workloadNetworkDnsServicesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsServiceId, workloadNetworkDnsService).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadNetworkDnsService + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsService_Delete + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkloadNetworkDnsServiceAsync(WaitUntil waitUntil, string dnsServiceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + + using var scope = _workloadNetworkDnsServicesClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkDnsService"); + scope.Start(); + try + { + var response = await _workloadNetworkDnsServicesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsServiceId, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_workloadNetworkDnsServicesClientDiagnostics, Pipeline, _workloadNetworkDnsServicesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, dnsServiceId, Id.Parent.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadNetworkDnsService + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsService_Delete + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual ArmOperation DeleteWorkloadNetworkDnsService(WaitUntil waitUntil, string dnsServiceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsServiceId, nameof(dnsServiceId)); + + using var scope = _workloadNetworkDnsServicesClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkDnsService"); + scope.Start(); + try + { + var response = _workloadNetworkDnsServicesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, dnsServiceId, Id.Parent.Name, cancellationToken); + var operation = new AvsArmOperation(_workloadNetworkDnsServicesClientDiagnostics, Pipeline, _workloadNetworkDnsServicesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, dnsServiceId, Id.Parent.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List WorkloadNetworkDnsZone resources by WorkloadNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones + /// + /// + /// Operation Id + /// WorkloadNetworkDnsZone_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkDnsZonesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsZonesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(e), _workloadNetworkDnsZonesClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkDnsZones", "value", "nextLink", cancellationToken); + } + + /// + /// List WorkloadNetworkDnsZone resources by WorkloadNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones + /// + /// + /// Operation Id + /// WorkloadNetworkDnsZone_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkDnsZones(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkDnsZonesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkDnsZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(e), _workloadNetworkDnsZonesClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkDnsZones", "value", "nextLink", cancellationToken); + } + + /// + /// Get a WorkloadNetworkDnsZone + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsZone_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// ID of the DNS zone. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetWorkloadNetworkDnsZoneAsync(string dnsZoneId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + + using var scope = _workloadNetworkDnsZonesClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkDnsZone"); + scope.Start(); + try + { + var response = await _workloadNetworkDnsZonesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadNetworkDnsZone + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsZone_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// ID of the DNS zone. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetWorkloadNetworkDnsZone(string dnsZoneId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + + using var scope = _workloadNetworkDnsZonesClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkDnsZone"); + scope.Start(); + try + { + var response = _workloadNetworkDnsZonesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadNetworkDnsZone + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsZone_Create + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS zone. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateWorkloadNetworkDnsZoneAsync(WaitUntil waitUntil, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + Argument.AssertNotNull(workloadNetworkDnsZone, nameof(workloadNetworkDnsZone)); + + using var scope = _workloadNetworkDnsZonesClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkDnsZone"); + scope.Start(); + try + { + var response = await _workloadNetworkDnsZonesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, workloadNetworkDnsZone, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkDnsZoneOperationSource(), _workloadNetworkDnsZonesClientDiagnostics, Pipeline, _workloadNetworkDnsZonesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, workloadNetworkDnsZone).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadNetworkDnsZone + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsZone_Create + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS zone. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateWorkloadNetworkDnsZone(WaitUntil waitUntil, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + Argument.AssertNotNull(workloadNetworkDnsZone, nameof(workloadNetworkDnsZone)); + + using var scope = _workloadNetworkDnsZonesClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkDnsZone"); + scope.Start(); + try + { + var response = _workloadNetworkDnsZonesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, workloadNetworkDnsZone, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkDnsZoneOperationSource(), _workloadNetworkDnsZonesClientDiagnostics, Pipeline, _workloadNetworkDnsZonesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, workloadNetworkDnsZone).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a WorkloadNetworkDnsZone + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsZone_Update + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS zone. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UpdateWorkloadNetworkDnsZoneAsync(WaitUntil waitUntil, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + Argument.AssertNotNull(workloadNetworkDnsZone, nameof(workloadNetworkDnsZone)); + + using var scope = _workloadNetworkDnsZonesClientDiagnostics.CreateScope("WorkloadNetworkResource.UpdateWorkloadNetworkDnsZone"); + scope.Start(); + try + { + var response = await _workloadNetworkDnsZonesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, workloadNetworkDnsZone, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkDnsZoneOperationSource(), _workloadNetworkDnsZonesClientDiagnostics, Pipeline, _workloadNetworkDnsZonesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, workloadNetworkDnsZone).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a WorkloadNetworkDnsZone + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsZone_Update + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS zone. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation UpdateWorkloadNetworkDnsZone(WaitUntil waitUntil, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + Argument.AssertNotNull(workloadNetworkDnsZone, nameof(workloadNetworkDnsZone)); + + using var scope = _workloadNetworkDnsZonesClientDiagnostics.CreateScope("WorkloadNetworkResource.UpdateWorkloadNetworkDnsZone"); + scope.Start(); + try + { + var response = _workloadNetworkDnsZonesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, workloadNetworkDnsZone, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkDnsZoneOperationSource(), _workloadNetworkDnsZonesClientDiagnostics, Pipeline, _workloadNetworkDnsZonesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, dnsZoneId, workloadNetworkDnsZone).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadNetworkDnsZone + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsZone_Delete + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS zone. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkloadNetworkDnsZoneAsync(WaitUntil waitUntil, string dnsZoneId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + + using var scope = _workloadNetworkDnsZonesClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkDnsZone"); + scope.Start(); + try + { + var response = await _workloadNetworkDnsZonesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsZoneId, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_workloadNetworkDnsZonesClientDiagnostics, Pipeline, _workloadNetworkDnsZonesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, dnsZoneId, Id.Parent.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadNetworkDnsZone + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId} + /// + /// + /// Operation Id + /// WorkloadNetworkDnsZone_Delete + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS zone. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual ArmOperation DeleteWorkloadNetworkDnsZone(WaitUntil waitUntil, string dnsZoneId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsZoneId, nameof(dnsZoneId)); + + using var scope = _workloadNetworkDnsZonesClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkDnsZone"); + scope.Start(); + try + { + var response = _workloadNetworkDnsZonesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, dnsZoneId, Id.Parent.Name, cancellationToken); + var operation = new AvsArmOperation(_workloadNetworkDnsZonesClientDiagnostics, Pipeline, _workloadNetworkDnsZonesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, dnsZoneId, Id.Parent.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles + /// + /// + /// Operation Id + /// WorkloadNetworkPortMirroring_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkPortMirroringProfilesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPortMirroringProfilesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPortMirroringProfilesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(e), _workloadNetworkPortMirroringProfilesClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkPortMirroringProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// List WorkloadNetworkPortMirroring resources by WorkloadNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles + /// + /// + /// Operation Id + /// WorkloadNetworkPortMirroring_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkPortMirroringProfiles(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPortMirroringProfilesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPortMirroringProfilesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(e), _workloadNetworkPortMirroringProfilesClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkPortMirroringProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// Get a WorkloadNetworkPortMirroring + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// + /// + /// Operation Id + /// WorkloadNetworkPortMirroring_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// ID of the NSX port mirroring profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetWorkloadNetworkPortMirroringProfileAsync(string portMirroringId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + + using var scope = _workloadNetworkPortMirroringProfilesClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkPortMirroringProfile"); + scope.Start(); + try + { + var response = await _workloadNetworkPortMirroringProfilesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadNetworkPortMirroring + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// + /// + /// Operation Id + /// WorkloadNetworkPortMirroring_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// ID of the NSX port mirroring profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetWorkloadNetworkPortMirroringProfile(string portMirroringId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + + using var scope = _workloadNetworkPortMirroringProfilesClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkPortMirroringProfile"); + scope.Start(); + try + { + var response = _workloadNetworkPortMirroringProfilesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadNetworkPortMirroring + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// + /// + /// Operation Id + /// WorkloadNetworkPortMirroring_Create + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the NSX port mirroring profile. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateWorkloadNetworkPortMirroringProfileAsync(WaitUntil waitUntil, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + Argument.AssertNotNull(workloadNetworkPortMirroring, nameof(workloadNetworkPortMirroring)); + + using var scope = _workloadNetworkPortMirroringProfilesClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkPortMirroringProfile"); + scope.Start(); + try + { + var response = await _workloadNetworkPortMirroringProfilesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, workloadNetworkPortMirroring, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkPortMirroringOperationSource(), _workloadNetworkPortMirroringProfilesClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfilesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, workloadNetworkPortMirroring).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadNetworkPortMirroring + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// + /// + /// Operation Id + /// WorkloadNetworkPortMirroring_Create + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the NSX port mirroring profile. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateWorkloadNetworkPortMirroringProfile(WaitUntil waitUntil, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + Argument.AssertNotNull(workloadNetworkPortMirroring, nameof(workloadNetworkPortMirroring)); + + using var scope = _workloadNetworkPortMirroringProfilesClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkPortMirroringProfile"); + scope.Start(); + try + { + var response = _workloadNetworkPortMirroringProfilesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, workloadNetworkPortMirroring, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkPortMirroringOperationSource(), _workloadNetworkPortMirroringProfilesClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfilesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, workloadNetworkPortMirroring).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a WorkloadNetworkPortMirroring + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// + /// + /// Operation Id + /// WorkloadNetworkPortMirroring_Update + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the NSX port mirroring profile. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UpdateWorkloadNetworkPortMirroringProfileAsync(WaitUntil waitUntil, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + Argument.AssertNotNull(workloadNetworkPortMirroring, nameof(workloadNetworkPortMirroring)); + + using var scope = _workloadNetworkPortMirroringProfilesClientDiagnostics.CreateScope("WorkloadNetworkResource.UpdateWorkloadNetworkPortMirroringProfile"); + scope.Start(); + try + { + var response = await _workloadNetworkPortMirroringProfilesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, workloadNetworkPortMirroring, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkPortMirroringOperationSource(), _workloadNetworkPortMirroringProfilesClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfilesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, workloadNetworkPortMirroring).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a WorkloadNetworkPortMirroring + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// + /// + /// Operation Id + /// WorkloadNetworkPortMirroring_Update + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the NSX port mirroring profile. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation UpdateWorkloadNetworkPortMirroringProfile(WaitUntil waitUntil, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + Argument.AssertNotNull(workloadNetworkPortMirroring, nameof(workloadNetworkPortMirroring)); + + using var scope = _workloadNetworkPortMirroringProfilesClientDiagnostics.CreateScope("WorkloadNetworkResource.UpdateWorkloadNetworkPortMirroringProfile"); + scope.Start(); + try + { + var response = _workloadNetworkPortMirroringProfilesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, workloadNetworkPortMirroring, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkPortMirroringOperationSource(), _workloadNetworkPortMirroringProfilesClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfilesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, portMirroringId, workloadNetworkPortMirroring).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadNetworkPortMirroring + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// + /// + /// Operation Id + /// WorkloadNetworkPortMirroring_Delete + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the NSX port mirroring profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkloadNetworkPortMirroringProfileAsync(WaitUntil waitUntil, string portMirroringId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + + using var scope = _workloadNetworkPortMirroringProfilesClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkPortMirroringProfile"); + scope.Start(); + try + { + var response = await _workloadNetworkPortMirroringProfilesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, portMirroringId, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_workloadNetworkPortMirroringProfilesClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfilesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, portMirroringId, Id.Parent.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadNetworkPortMirroring + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId} + /// + /// + /// Operation Id + /// WorkloadNetworkPortMirroring_Delete + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the NSX port mirroring profile. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual ArmOperation DeleteWorkloadNetworkPortMirroringProfile(WaitUntil waitUntil, string portMirroringId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portMirroringId, nameof(portMirroringId)); + + using var scope = _workloadNetworkPortMirroringProfilesClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkPortMirroringProfile"); + scope.Start(); + try + { + var response = _workloadNetworkPortMirroringProfilesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, portMirroringId, Id.Parent.Name, cancellationToken); + var operation = new AvsArmOperation(_workloadNetworkPortMirroringProfilesClientDiagnostics, Pipeline, _workloadNetworkPortMirroringProfilesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, portMirroringId, Id.Parent.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List WorkloadNetworkPublicIP resources by WorkloadNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs + /// + /// + /// Operation Id + /// WorkloadNetworkPublicIP_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkPublicIpsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPublicIPsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPublicIPsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(e), _workloadNetworkPublicIPsClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkPublicIps", "value", "nextLink", cancellationToken); + } + + /// + /// List WorkloadNetworkPublicIP resources by WorkloadNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs + /// + /// + /// Operation Id + /// WorkloadNetworkPublicIP_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkPublicIps(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkPublicIPsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkPublicIPsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(e), _workloadNetworkPublicIPsClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkPublicIps", "value", "nextLink", cancellationToken); + } + + /// + /// Get a WorkloadNetworkPublicIP + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} + /// + /// + /// Operation Id + /// WorkloadNetworkPublicIP_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// ID of the DNS zone. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetWorkloadNetworkPublicIpAsync(string publicIPId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + + using var scope = _workloadNetworkPublicIPsClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkPublicIp"); + scope.Start(); + try + { + var response = await _workloadNetworkPublicIPsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadNetworkPublicIP + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} + /// + /// + /// Operation Id + /// WorkloadNetworkPublicIP_Get + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// ID of the DNS zone. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetWorkloadNetworkPublicIp(string publicIPId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + + using var scope = _workloadNetworkPublicIPsClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkPublicIp"); + scope.Start(); + try + { + var response = _workloadNetworkPublicIPsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadNetworkPublicIP + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} + /// + /// + /// Operation Id + /// WorkloadNetworkPublicIP_Create + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS zone. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateWorkloadNetworkPublicIpAsync(WaitUntil waitUntil, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + Argument.AssertNotNull(workloadNetworkPublicIP, nameof(workloadNetworkPublicIP)); + + using var scope = _workloadNetworkPublicIPsClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkPublicIp"); + scope.Start(); + try + { + var response = await _workloadNetworkPublicIPsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, workloadNetworkPublicIP, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkPublicIPOperationSource(), _workloadNetworkPublicIPsClientDiagnostics, Pipeline, _workloadNetworkPublicIPsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, workloadNetworkPublicIP).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadNetworkPublicIP + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} + /// + /// + /// Operation Id + /// WorkloadNetworkPublicIP_Create + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS zone. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateWorkloadNetworkPublicIp(WaitUntil waitUntil, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + Argument.AssertNotNull(workloadNetworkPublicIP, nameof(workloadNetworkPublicIP)); + + using var scope = _workloadNetworkPublicIPsClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkPublicIp"); + scope.Start(); + try + { + var response = _workloadNetworkPublicIPsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, workloadNetworkPublicIP, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkPublicIPOperationSource(), _workloadNetworkPublicIPsClientDiagnostics, Pipeline, _workloadNetworkPublicIPsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, publicIPId, workloadNetworkPublicIP).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadNetworkPublicIP + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} /// /// - /// Resource - /// + /// Operation Id + /// WorkloadNetworkPublicIP_Delete + /// + /// + /// Default Api Version + /// 2024-09-01 /// /// /// - /// The ID of the NSX Segment. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS zone. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetWorkloadNetworkSegment(string segmentId, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkloadNetworkPublicIpAsync(WaitUntil waitUntil, string publicIPId, CancellationToken cancellationToken = default) { - return GetWorkloadNetworkSegments().Get(segmentId, cancellationToken); - } + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); - /// Gets a collection of WorkloadNetworkVirtualMachineResources in the WorkloadNetwork. - /// An object representing collection of WorkloadNetworkVirtualMachineResources and their operations over a WorkloadNetworkVirtualMachineResource. - public virtual WorkloadNetworkVirtualMachineCollection GetWorkloadNetworkVirtualMachines() - { - return GetCachedClient(client => new WorkloadNetworkVirtualMachineCollection(client, Id)); + using var scope = _workloadNetworkPublicIPsClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkPublicIp"); + scope.Start(); + try + { + var response = await _workloadNetworkPublicIPsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, publicIPId, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_workloadNetworkPublicIPsClientDiagnostics, Pipeline, _workloadNetworkPublicIPsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, publicIPId, Id.Parent.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get a WorkloadNetworkVirtualMachine + /// Delete a WorkloadNetworkPublicIP /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId} /// /// /// Operation Id - /// WorkloadNetworks_GetVirtualMachine + /// WorkloadNetworkPublicIP_Delete /// /// /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// + /// 2024-09-01 /// /// /// - /// ID of the virtual machine. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the DNS zone. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetWorkloadNetworkVirtualMachineAsync(string virtualMachineId, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual ArmOperation DeleteWorkloadNetworkPublicIp(WaitUntil waitUntil, string publicIPId, CancellationToken cancellationToken = default) { - return await GetWorkloadNetworkVirtualMachines().GetAsync(virtualMachineId, cancellationToken).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(publicIPId, nameof(publicIPId)); + + using var scope = _workloadNetworkPublicIPsClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkPublicIp"); + scope.Start(); + try + { + var response = _workloadNetworkPublicIPsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, publicIPId, Id.Parent.Name, cancellationToken); + var operation = new AvsArmOperation(_workloadNetworkPublicIPsClientDiagnostics, Pipeline, _workloadNetworkPublicIPsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, publicIPId, Id.Parent.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get a WorkloadNetworkVirtualMachine + /// List WorkloadNetworkVMGroup resources by WorkloadNetwork /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups /// /// /// Operation Id - /// WorkloadNetworks_GetVirtualMachine + /// WorkloadNetworkVMGroup_List /// /// /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// + /// 2024-09-01 /// /// /// - /// ID of the virtual machine. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetWorkloadNetworkVirtualMachine(string virtualMachineId, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkVmGroupsAsync(CancellationToken cancellationToken = default) { - return GetWorkloadNetworkVirtualMachines().Get(virtualMachineId, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVmGroupsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVmGroupsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkVmGroup.DeserializeWorkloadNetworkVmGroup(e), _workloadNetworkVmGroupsClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkVmGroups", "value", "nextLink", cancellationToken); } - /// Gets a collection of WorkloadNetworkVmGroupResources in the WorkloadNetwork. - /// An object representing collection of WorkloadNetworkVmGroupResources and their operations over a WorkloadNetworkVmGroupResource. - public virtual WorkloadNetworkVmGroupCollection GetWorkloadNetworkVmGroups() + /// + /// List WorkloadNetworkVMGroup resources by WorkloadNetwork + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups + /// + /// + /// Operation Id + /// WorkloadNetworkVMGroup_List + /// + /// + /// Default Api Version + /// 2024-09-01 + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkVmGroups(CancellationToken cancellationToken = default) { - return GetCachedClient(client => new WorkloadNetworkVmGroupCollection(client, Id)); + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVmGroupsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVmGroupsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WorkloadNetworkVmGroup.DeserializeWorkloadNetworkVmGroup(e), _workloadNetworkVmGroupsClientDiagnostics, Pipeline, "WorkloadNetworkResource.GetWorkloadNetworkVmGroups", "value", "nextLink", cancellationToken); } /// @@ -655,30 +2351,77 @@ public virtual WorkloadNetworkVmGroupCollection GetWorkloadNetworkVmGroups() /// /// /// Operation Id - /// WorkloadNetworks_GetVmGroup + /// WorkloadNetworkVMGroup_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 + /// + /// + /// + /// ID of the VM group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetWorkloadNetworkVmGroupAsync(string vmGroupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + + using var scope = _workloadNetworkVmGroupsClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkVmGroup"); + scope.Start(); + try + { + var response = await _workloadNetworkVmGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadNetworkVMGroup + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} /// /// - /// Resource - /// + /// Operation Id + /// WorkloadNetworkVMGroup_Get + /// + /// + /// Default Api Version + /// 2024-09-01 /// /// /// /// ID of the VM group. /// The cancellation token to use. - /// is null. /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetWorkloadNetworkVmGroupAsync(string vmGroupId, CancellationToken cancellationToken = default) + /// is null. + public virtual Response GetWorkloadNetworkVmGroup(string vmGroupId, CancellationToken cancellationToken = default) { - return await GetWorkloadNetworkVmGroups().GetAsync(vmGroupId, cancellationToken).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + + using var scope = _workloadNetworkVmGroupsClientDiagnostics.CreateScope("WorkloadNetworkResource.GetWorkloadNetworkVmGroup"); + scope.Start(); + try + { + var response = _workloadNetworkVmGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get a WorkloadNetworkVMGroup + /// Create a WorkloadNetworkVMGroup /// /// /// Request Path @@ -686,60 +2429,169 @@ public virtual async Task> GetWorkloadN /// /// /// Operation Id - /// WorkloadNetworks_GetVmGroup + /// WorkloadNetworkVMGroup_Create /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the VM group. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateWorkloadNetworkVmGroupAsync(WaitUntil waitUntil, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + Argument.AssertNotNull(workloadNetworkVmGroup, nameof(workloadNetworkVmGroup)); + + using var scope = _workloadNetworkVmGroupsClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkVmGroup"); + scope.Start(); + try + { + var response = await _workloadNetworkVmGroupsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, workloadNetworkVmGroup, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkVmGroupOperationSource(), _workloadNetworkVmGroupsClientDiagnostics, Pipeline, _workloadNetworkVmGroupsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, workloadNetworkVmGroup).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadNetworkVMGroup + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} /// /// - /// Resource - /// + /// Operation Id + /// WorkloadNetworkVMGroup_Create + /// + /// + /// Default Api Version + /// 2024-09-01 /// /// /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// ID of the VM group. + /// Resource create parameters. /// The cancellation token to use. - /// is null. /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetWorkloadNetworkVmGroup(string vmGroupId, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateWorkloadNetworkVmGroup(WaitUntil waitUntil, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup, CancellationToken cancellationToken = default) { - return GetWorkloadNetworkVmGroups().Get(vmGroupId, cancellationToken); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + Argument.AssertNotNull(workloadNetworkVmGroup, nameof(workloadNetworkVmGroup)); + + using var scope = _workloadNetworkVmGroupsClientDiagnostics.CreateScope("WorkloadNetworkResource.CreateWorkloadNetworkVmGroup"); + scope.Start(); + try + { + var response = _workloadNetworkVmGroupsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, workloadNetworkVmGroup, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkVmGroupOperationSource(), _workloadNetworkVmGroupsClientDiagnostics, Pipeline, _workloadNetworkVmGroupsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, workloadNetworkVmGroup).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get a WorkloadNetwork + /// Update a WorkloadNetworkVMGroup /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} /// /// /// Operation Id - /// WorkloadNetworks_Get + /// WorkloadNetworkVMGroup_Update /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the VM group. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UpdateWorkloadNetworkVmGroupAsync(WaitUntil waitUntil, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + Argument.AssertNotNull(workloadNetworkVmGroup, nameof(workloadNetworkVmGroup)); + + using var scope = _workloadNetworkVmGroupsClientDiagnostics.CreateScope("WorkloadNetworkResource.UpdateWorkloadNetworkVmGroup"); + scope.Start(); + try + { + var response = await _workloadNetworkVmGroupsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, workloadNetworkVmGroup, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkVmGroupOperationSource(), _workloadNetworkVmGroupsClientDiagnostics, Pipeline, _workloadNetworkVmGroupsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, workloadNetworkVmGroup).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a WorkloadNetworkVMGroup + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} /// /// - /// Resource - /// + /// Operation Id + /// WorkloadNetworkVMGroup_Update + /// + /// + /// Default Api Version + /// 2024-09-01 /// /// /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the VM group. + /// The resource properties to be updated. /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation UpdateWorkloadNetworkVmGroup(WaitUntil waitUntil, string vmGroupId, WorkloadNetworkVmGroup workloadNetworkVmGroup, CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkClientDiagnostics.CreateScope("WorkloadNetworkResource.Get"); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + Argument.AssertNotNull(workloadNetworkVmGroup, nameof(workloadNetworkVmGroup)); + + using var scope = _workloadNetworkVmGroupsClientDiagnostics.CreateScope("WorkloadNetworkResource.UpdateWorkloadNetworkVmGroup"); scope.Start(); try { - var response = await _workloadNetworkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkResource(Client, response.Value), response.GetRawResponse()); + var response = _workloadNetworkVmGroupsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, workloadNetworkVmGroup, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkVmGroupOperationSource(), _workloadNetworkVmGroupsClientDiagnostics, Pipeline, _workloadNetworkVmGroupsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, workloadNetworkVmGroup).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; } catch (Exception e) { @@ -749,37 +2601,83 @@ public virtual async Task> GetAsync(Cancellati } /// - /// Get a WorkloadNetwork + /// Delete a WorkloadNetworkVMGroup /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} /// /// /// Operation Id - /// WorkloadNetworks_Get + /// WorkloadNetworkVMGroup_Delete /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the VM group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkloadNetworkVmGroupAsync(WaitUntil waitUntil, string vmGroupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + + using var scope = _workloadNetworkVmGroupsClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkVmGroup"); + scope.Start(); + try + { + var response = await _workloadNetworkVmGroupsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, vmGroupId, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_workloadNetworkVmGroupsClientDiagnostics, Pipeline, _workloadNetworkVmGroupsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, vmGroupId, Id.Parent.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadNetworkVMGroup + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} /// /// - /// Resource - /// + /// Operation Id + /// WorkloadNetworkVMGroup_Delete + /// + /// + /// Default Api Version + /// 2024-09-01 /// /// /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ID of the VM group. /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual ArmOperation DeleteWorkloadNetworkVmGroup(WaitUntil waitUntil, string vmGroupId, CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkClientDiagnostics.CreateScope("WorkloadNetworkResource.Get"); + Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); + + using var scope = _workloadNetworkVmGroupsClientDiagnostics.CreateScope("WorkloadNetworkResource.DeleteWorkloadNetworkVmGroup"); scope.Start(); try { - var response = _workloadNetworkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkResource(Client, response.Value), response.GetRawResponse()); + var response = _workloadNetworkVmGroupsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, vmGroupId, Id.Parent.Name, cancellationToken); + var operation = new AvsArmOperation(_workloadNetworkVmGroupsClientDiagnostics, Pipeline, _workloadNetworkVmGroupsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, vmGroupId, Id.Parent.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; } catch (Exception e) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs index 709693035537..8fdeebf61e54 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs @@ -24,8 +24,8 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkSegmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _workloadNetworkSegmentWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkSegmentWorkloadNetworksRestClient; + private readonly ClientDiagnostics _workloadNetworkSegmentClientDiagnostics; + private readonly WorkloadNetworkSegmentsRestOperations _workloadNetworkSegmentRestClient; /// Initializes a new instance of the class for mocking. protected WorkloadNetworkSegmentCollection() @@ -37,9 +37,9 @@ protected WorkloadNetworkSegmentCollection() /// The identifier of the parent resource that is the target of operations. internal WorkloadNetworkSegmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _workloadNetworkSegmentWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkSegmentResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(WorkloadNetworkSegmentResource.ResourceType, out string workloadNetworkSegmentWorkloadNetworksApiVersion); - _workloadNetworkSegmentWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkSegmentWorkloadNetworksApiVersion); + _workloadNetworkSegmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkSegmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(WorkloadNetworkSegmentResource.ResourceType, out string workloadNetworkSegmentApiVersion); + _workloadNetworkSegmentRestClient = new WorkloadNetworkSegmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkSegmentApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -60,11 +60,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// WorkloadNetworks_CreateSegments + /// WorkloadNetworkSegment_Create /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -83,12 +83,12 @@ public virtual async Task> CreateOr Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CreateOrUpdate"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _workloadNetworkSegmentWorkloadNetworksRestClient.CreateSegmentsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkSegmentOperationSource(Client), _workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkSegmentWorkloadNetworksRestClient.CreateCreateSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _workloadNetworkSegmentRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkSegmentOperationSource(Client), _workloadNetworkSegmentClientDiagnostics, Pipeline, _workloadNetworkSegmentRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -109,11 +109,11 @@ public virtual async Task> CreateOr /// /// /// Operation Id - /// WorkloadNetworks_CreateSegments + /// WorkloadNetworkSegment_Create /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -132,12 +132,12 @@ public virtual ArmOperation CreateOrUpdate(WaitU Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CreateOrUpdate"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CreateOrUpdate"); scope.Start(); try { - var response = _workloadNetworkSegmentWorkloadNetworksRestClient.CreateSegments(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkSegmentOperationSource(Client), _workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkSegmentWorkloadNetworksRestClient.CreateCreateSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _workloadNetworkSegmentRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, data, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkSegmentOperationSource(Client), _workloadNetworkSegmentClientDiagnostics, Pipeline, _workloadNetworkSegmentRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -158,11 +158,11 @@ public virtual ArmOperation CreateOrUpdate(WaitU /// /// /// Operation Id - /// WorkloadNetworks_GetSegment + /// WorkloadNetworkSegment_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -178,11 +178,11 @@ public virtual async Task> GetAsync(str { Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Get"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Get"); scope.Start(); try { - var response = await _workloadNetworkSegmentWorkloadNetworksRestClient.GetSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkSegmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkSegmentResource(Client, response.Value), response.GetRawResponse()); @@ -203,11 +203,11 @@ public virtual async Task> GetAsync(str /// /// /// Operation Id - /// WorkloadNetworks_GetSegment + /// WorkloadNetworkSegment_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -223,11 +223,11 @@ public virtual Response Get(string segmentId, Ca { Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Get"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Get"); scope.Start(); try { - var response = _workloadNetworkSegmentWorkloadNetworksRestClient.GetSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken); + var response = _workloadNetworkSegmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkSegmentResource(Client, response.Value), response.GetRawResponse()); @@ -248,11 +248,11 @@ public virtual Response Get(string segmentId, Ca /// /// /// Operation Id - /// WorkloadNetworks_ListSegments + /// WorkloadNetworkSegment_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -264,9 +264,9 @@ public virtual Response Get(string segmentId, Ca /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkSegmentWorkloadNetworksRestClient.CreateListSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkSegmentWorkloadNetworksRestClient.CreateListSegmentsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkSegmentResource(Client, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(e)), _workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkSegmentCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkSegmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkSegmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkSegmentResource(Client, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(e)), _workloadNetworkSegmentClientDiagnostics, Pipeline, "WorkloadNetworkSegmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -278,11 +278,11 @@ public virtual AsyncPageable GetAllAsync(Cancell /// /// /// Operation Id - /// WorkloadNetworks_ListSegments + /// WorkloadNetworkSegment_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -294,9 +294,9 @@ public virtual AsyncPageable GetAllAsync(Cancell /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkSegmentWorkloadNetworksRestClient.CreateListSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkSegmentWorkloadNetworksRestClient.CreateListSegmentsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkSegmentResource(Client, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(e)), _workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkSegmentCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkSegmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkSegmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkSegmentResource(Client, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(e)), _workloadNetworkSegmentClientDiagnostics, Pipeline, "WorkloadNetworkSegmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -308,11 +308,11 @@ public virtual Pageable GetAll(CancellationToken /// /// /// Operation Id - /// WorkloadNetworks_GetSegment + /// WorkloadNetworkSegment_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -328,11 +328,11 @@ public virtual async Task> ExistsAsync(string segmentId, Cancella { Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Exists"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Exists"); scope.Start(); try { - var response = await _workloadNetworkSegmentWorkloadNetworksRestClient.GetSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkSegmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -351,11 +351,11 @@ public virtual async Task> ExistsAsync(string segmentId, Cancella /// /// /// Operation Id - /// WorkloadNetworks_GetSegment + /// WorkloadNetworkSegment_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -371,11 +371,11 @@ public virtual Response Exists(string segmentId, CancellationToken cancell { Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Exists"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Exists"); scope.Start(); try { - var response = _workloadNetworkSegmentWorkloadNetworksRestClient.GetSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken: cancellationToken); + var response = _workloadNetworkSegmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -394,11 +394,11 @@ public virtual Response Exists(string segmentId, CancellationToken cancell /// /// /// Operation Id - /// WorkloadNetworks_GetSegment + /// WorkloadNetworkSegment_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -414,11 +414,11 @@ public virtual async Task> GetI { Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); scope.Start(); try { - var response = await _workloadNetworkSegmentWorkloadNetworksRestClient.GetSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkSegmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkSegmentResource(Client, response.Value), response.GetRawResponse()); @@ -439,11 +439,11 @@ public virtual async Task> GetI /// /// /// Operation Id - /// WorkloadNetworks_GetSegment + /// WorkloadNetworkSegment_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -459,11 +459,11 @@ public virtual NullableResponse GetIfExists(stri { Argument.AssertNotNullOrEmpty(segmentId, nameof(segmentId)); - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); scope.Start(); try { - var response = _workloadNetworkSegmentWorkloadNetworksRestClient.GetSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken: cancellationToken); + var response = _workloadNetworkSegmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, segmentId, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkSegmentResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.Serialization.cs index 1439064a4327..39610c034afb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.Serialization.cs @@ -37,49 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(ConnectedGateway)) - { - writer.WritePropertyName("connectedGateway"u8); - writer.WriteStringValue(ConnectedGateway); - } - if (Optional.IsDefined(Subnet)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("subnet"u8); - writer.WriteObjectValue(Subnet, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(PortVif)) - { - writer.WritePropertyName("portVif"u8); - writer.WriteStartArray(); - foreach (var item in PortVif) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(Revision)) - { - writer.WritePropertyName("revision"u8); - writer.WriteNumberValue(Revision.Value); - } - writer.WriteEndObject(); } WorkloadNetworkSegmentData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -102,21 +64,24 @@ internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData { return null; } + WorkloadNetworkSegmentProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - string displayName = default; - string connectedGateway = default; - WorkloadNetworkSegmentSubnet subnet = default; - IReadOnlyList portVif = default; - WorkloadNetworkSegmentStatus? status = default; - WorkloadNetworkSegmentProvisioningState? provisioningState = default; - long? revision = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WorkloadNetworkSegmentProperties.DeserializeWorkloadNetworkSegmentProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -141,78 +106,6 @@ internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("connectedGateway"u8)) - { - connectedGateway = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("subnet"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - subnet = WorkloadNetworkSegmentSubnet.DeserializeWorkloadNetworkSegmentSubnet(property0.Value, options); - continue; - } - if (property0.NameEquals("portVif"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(WorkloadNetworkSegmentPortVif.DeserializeWorkloadNetworkSegmentPortVif(item, options)); - } - portVif = array; - continue; - } - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new WorkloadNetworkSegmentStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new WorkloadNetworkSegmentProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("revision"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - revision = property0.Value.GetInt64(); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -224,13 +117,7 @@ internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData name, type, systemData, - displayName, - connectedGateway, - subnet, - portVif ?? new ChangeTrackingList(), - status, - provisioningState, - revision, + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs index af36a373aa72..b2587129891d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs @@ -54,7 +54,6 @@ public partial class WorkloadNetworkSegmentData : ResourceData /// Initializes a new instance of . public WorkloadNetworkSegmentData() { - PortVif = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -62,39 +61,15 @@ public WorkloadNetworkSegmentData() /// The name. /// The resourceType. /// The systemData. - /// Display name of the segment. - /// Gateway which to connect segment to. - /// Subnet which to connect segment to. - /// Port Vif which segment is associated with. - /// Segment status. - /// The provisioning state. - /// NSX revision number. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkSegmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string connectedGateway, WorkloadNetworkSegmentSubnet subnet, IReadOnlyList portVif, WorkloadNetworkSegmentStatus? status, WorkloadNetworkSegmentProvisioningState? provisioningState, long? revision, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal WorkloadNetworkSegmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkSegmentProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - DisplayName = displayName; - ConnectedGateway = connectedGateway; - Subnet = subnet; - PortVif = portVif; - Status = status; - ProvisioningState = provisioningState; - Revision = revision; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Display name of the segment. - public string DisplayName { get; set; } - /// Gateway which to connect segment to. - public string ConnectedGateway { get; set; } - /// Subnet which to connect segment to. - public WorkloadNetworkSegmentSubnet Subnet { get; set; } - /// Port Vif which segment is associated with. - public IReadOnlyList PortVif { get; } - /// Segment status. - public WorkloadNetworkSegmentStatus? Status { get; } - /// The provisioning state. - public WorkloadNetworkSegmentProvisioningState? ProvisioningState { get; } - /// NSX revision number. - public long? Revision { get; set; } + /// The resource-specific properties for this resource. + public WorkloadNetworkSegmentProperties Properties { get; set; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentResource.cs index 3c08f7004840..4da672e62227 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentResource.cs @@ -33,8 +33,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _workloadNetworkSegmentWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkSegmentWorkloadNetworksRestClient; + private readonly ClientDiagnostics _workloadNetworkSegmentClientDiagnostics; + private readonly WorkloadNetworkSegmentsRestOperations _workloadNetworkSegmentRestClient; private readonly WorkloadNetworkSegmentData _data; /// Gets the resource type for the operations. @@ -59,9 +59,9 @@ internal WorkloadNetworkSegmentResource(ArmClient client, WorkloadNetworkSegment /// The identifier of the resource that is the target of operations. internal WorkloadNetworkSegmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _workloadNetworkSegmentWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string workloadNetworkSegmentWorkloadNetworksApiVersion); - _workloadNetworkSegmentWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkSegmentWorkloadNetworksApiVersion); + _workloadNetworkSegmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string workloadNetworkSegmentApiVersion); + _workloadNetworkSegmentRestClient = new WorkloadNetworkSegmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkSegmentApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -97,11 +97,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// WorkloadNetworks_GetSegment + /// WorkloadNetworkSegment_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -112,11 +112,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Get"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Get"); scope.Start(); try { - var response = await _workloadNetworkSegmentWorkloadNetworksRestClient.GetSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkSegmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkSegmentResource(Client, response.Value), response.GetRawResponse()); @@ -137,11 +137,11 @@ public virtual async Task> GetAsync(Can /// /// /// Operation Id - /// WorkloadNetworks_GetSegment + /// WorkloadNetworkSegment_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -152,11 +152,11 @@ public virtual async Task> GetAsync(Can /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Get"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Get"); scope.Start(); try { - var response = _workloadNetworkSegmentWorkloadNetworksRestClient.GetSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var response = _workloadNetworkSegmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkSegmentResource(Client, response.Value), response.GetRawResponse()); @@ -177,11 +177,11 @@ public virtual Response Get(CancellationToken ca /// /// /// Operation Id - /// WorkloadNetworks_DeleteSegment + /// WorkloadNetworkSegment_DeleteSegment /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -193,12 +193,12 @@ public virtual Response Get(CancellationToken ca /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Delete"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Delete"); scope.Start(); try { - var response = await _workloadNetworkSegmentWorkloadNetworksRestClient.DeleteSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkSegmentWorkloadNetworksRestClient.CreateDeleteSegmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _workloadNetworkSegmentRestClient.DeleteSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(_workloadNetworkSegmentClientDiagnostics, Pipeline, _workloadNetworkSegmentRestClient.CreateDeleteSegmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -219,11 +219,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// WorkloadNetworks_DeleteSegment + /// WorkloadNetworkSegment_DeleteSegment /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -235,12 +235,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Delete"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Delete"); scope.Start(); try { - var response = _workloadNetworkSegmentWorkloadNetworksRestClient.DeleteSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkSegmentWorkloadNetworksRestClient.CreateDeleteSegmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _workloadNetworkSegmentRestClient.DeleteSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var operation = new AvsArmOperation(_workloadNetworkSegmentClientDiagnostics, Pipeline, _workloadNetworkSegmentRestClient.CreateDeleteSegmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -261,11 +261,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// WorkloadNetworks_UpdateSegments + /// WorkloadNetworkSegment_Update /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -281,12 +281,12 @@ public virtual async Task> UpdateAs { Argument.AssertNotNull(data, nameof(data)); - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Update"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Update"); scope.Start(); try { - var response = await _workloadNetworkSegmentWorkloadNetworksRestClient.UpdateSegmentsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkSegmentOperationSource(Client), _workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkSegmentWorkloadNetworksRestClient.CreateUpdateSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = await _workloadNetworkSegmentRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new AvsArmOperation(new WorkloadNetworkSegmentOperationSource(Client), _workloadNetworkSegmentClientDiagnostics, Pipeline, _workloadNetworkSegmentRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -307,11 +307,11 @@ public virtual async Task> UpdateAs /// /// /// Operation Id - /// WorkloadNetworks_UpdateSegments + /// WorkloadNetworkSegment_Update /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -327,12 +327,12 @@ public virtual ArmOperation Update(WaitUntil wai { Argument.AssertNotNull(data, nameof(data)); - using var scope = _workloadNetworkSegmentWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Update"); + using var scope = _workloadNetworkSegmentClientDiagnostics.CreateScope("WorkloadNetworkSegmentResource.Update"); scope.Start(); try { - var response = _workloadNetworkSegmentWorkloadNetworksRestClient.UpdateSegments(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkSegmentOperationSource(Client), _workloadNetworkSegmentWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkSegmentWorkloadNetworksRestClient.CreateUpdateSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = _workloadNetworkSegmentRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken); + var operation = new AvsArmOperation(new WorkloadNetworkSegmentOperationSource(Client), _workloadNetworkSegmentClientDiagnostics, Pipeline, _workloadNetworkSegmentRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs index 9f56d645ced8..860b5a64ddf1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs @@ -24,8 +24,8 @@ namespace Azure.ResourceManager.Avs /// public partial class WorkloadNetworkVirtualMachineCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkVirtualMachineWorkloadNetworksRestClient; + private readonly ClientDiagnostics _workloadNetworkVirtualMachineClientDiagnostics; + private readonly WorkloadNetworkVirtualMachinesRestOperations _workloadNetworkVirtualMachineRestClient; /// Initializes a new instance of the class for mocking. protected WorkloadNetworkVirtualMachineCollection() @@ -37,9 +37,9 @@ protected WorkloadNetworkVirtualMachineCollection() /// The identifier of the parent resource that is the target of operations. internal WorkloadNetworkVirtualMachineCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkVirtualMachineResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(WorkloadNetworkVirtualMachineResource.ResourceType, out string workloadNetworkVirtualMachineWorkloadNetworksApiVersion); - _workloadNetworkVirtualMachineWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkVirtualMachineWorkloadNetworksApiVersion); + _workloadNetworkVirtualMachineClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkVirtualMachineResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(WorkloadNetworkVirtualMachineResource.ResourceType, out string workloadNetworkVirtualMachineApiVersion); + _workloadNetworkVirtualMachineRestClient = new WorkloadNetworkVirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkVirtualMachineApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -60,11 +60,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// WorkloadNetworks_GetVirtualMachine + /// WorkloadNetworkVirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -80,11 +80,11 @@ public virtual async Task> GetAs { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Get"); + using var scope = _workloadNetworkVirtualMachineClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Get"); scope.Start(); try { - var response = await _workloadNetworkVirtualMachineWorkloadNetworksRestClient.GetVirtualMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, virtualMachineId, cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkVirtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, virtualMachineId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkVirtualMachineResource(Client, response.Value), response.GetRawResponse()); @@ -105,11 +105,11 @@ public virtual async Task> GetAs /// /// /// Operation Id - /// WorkloadNetworks_GetVirtualMachine + /// WorkloadNetworkVirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -125,11 +125,11 @@ public virtual Response Get(string virtua { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Get"); + using var scope = _workloadNetworkVirtualMachineClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Get"); scope.Start(); try { - var response = _workloadNetworkVirtualMachineWorkloadNetworksRestClient.GetVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, virtualMachineId, cancellationToken); + var response = _workloadNetworkVirtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, virtualMachineId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkVirtualMachineResource(Client, response.Value), response.GetRawResponse()); @@ -150,11 +150,11 @@ public virtual Response Get(string virtua /// /// /// Operation Id - /// WorkloadNetworks_ListVirtualMachines + /// WorkloadNetworkVirtualMachine_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -166,9 +166,9 @@ public virtual Response Get(string virtua /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVirtualMachineWorkloadNetworksRestClient.CreateListVirtualMachinesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVirtualMachineWorkloadNetworksRestClient.CreateListVirtualMachinesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkVirtualMachineResource(Client, WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(e)), _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVirtualMachineRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVirtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkVirtualMachineResource(Client, WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(e)), _workloadNetworkVirtualMachineClientDiagnostics, Pipeline, "WorkloadNetworkVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -180,11 +180,11 @@ public virtual AsyncPageable GetAllAsync( /// /// /// Operation Id - /// WorkloadNetworks_ListVirtualMachines + /// WorkloadNetworkVirtualMachine_List /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -196,9 +196,9 @@ public virtual AsyncPageable GetAllAsync( /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVirtualMachineWorkloadNetworksRestClient.CreateListVirtualMachinesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVirtualMachineWorkloadNetworksRestClient.CreateListVirtualMachinesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkVirtualMachineResource(Client, WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(e)), _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVirtualMachineRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVirtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkVirtualMachineResource(Client, WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(e)), _workloadNetworkVirtualMachineClientDiagnostics, Pipeline, "WorkloadNetworkVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -210,11 +210,11 @@ public virtual Pageable GetAll(Cancellati /// /// /// Operation Id - /// WorkloadNetworks_GetVirtualMachine + /// WorkloadNetworkVirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -230,11 +230,11 @@ public virtual async Task> ExistsAsync(string virtualMachineId, C { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Exists"); + using var scope = _workloadNetworkVirtualMachineClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Exists"); scope.Start(); try { - var response = await _workloadNetworkVirtualMachineWorkloadNetworksRestClient.GetVirtualMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkVirtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -253,11 +253,11 @@ public virtual async Task> ExistsAsync(string virtualMachineId, C /// /// /// Operation Id - /// WorkloadNetworks_GetVirtualMachine + /// WorkloadNetworkVirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -273,11 +273,11 @@ public virtual Response Exists(string virtualMachineId, CancellationToken { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Exists"); + using var scope = _workloadNetworkVirtualMachineClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Exists"); scope.Start(); try { - var response = _workloadNetworkVirtualMachineWorkloadNetworksRestClient.GetVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, virtualMachineId, cancellationToken: cancellationToken); + var response = _workloadNetworkVirtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, virtualMachineId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -296,11 +296,11 @@ public virtual Response Exists(string virtualMachineId, CancellationToken /// /// /// Operation Id - /// WorkloadNetworks_GetVirtualMachine + /// WorkloadNetworkVirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -316,11 +316,11 @@ public virtual async Task(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkVirtualMachineResource(Client, response.Value), response.GetRawResponse()); @@ -341,11 +341,11 @@ public virtual async Task /// /// Operation Id - /// WorkloadNetworks_GetVirtualMachine + /// WorkloadNetworkVirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -361,11 +361,11 @@ public virtual NullableResponse GetIfExis { Argument.AssertNotNullOrEmpty(virtualMachineId, nameof(virtualMachineId)); - using var scope = _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.GetIfExists"); + using var scope = _workloadNetworkVirtualMachineClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.GetIfExists"); scope.Start(); try { - var response = _workloadNetworkVirtualMachineWorkloadNetworksRestClient.GetVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, virtualMachineId, cancellationToken: cancellationToken); + var response = _workloadNetworkVirtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, virtualMachineId, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkVirtualMachineResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.Serialization.cs index 80074ea597be..0318079c49c8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.Serialization.cs @@ -37,24 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(DisplayName)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsDefined(VmType)) - { - writer.WritePropertyName("vmType"u8); - writer.WriteStringValue(VmType.Value.ToString()); - } - writer.WriteEndObject(); } WorkloadNetworkVirtualMachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -77,17 +64,24 @@ internal static WorkloadNetworkVirtualMachineData DeserializeWorkloadNetworkVirt { return null; } + WorkloadNetworkVirtualMachineProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - WorkloadNetworkProvisioningState? provisioningState = default; - string displayName = default; - WorkloadNetworkVmType? vmType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WorkloadNetworkVirtualMachineProperties.DeserializeWorkloadNetworkVirtualMachineProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -112,41 +106,6 @@ internal static WorkloadNetworkVirtualMachineData DeserializeWorkloadNetworkVirt systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new WorkloadNetworkProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("vmType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vmType = new WorkloadNetworkVmType(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -158,9 +117,7 @@ internal static WorkloadNetworkVirtualMachineData DeserializeWorkloadNetworkVirt name, type, systemData, - provisioningState, - displayName, - vmType, + properties, serializedAdditionalRawData); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs index a5d4048fab6c..9cb589d5b31c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs @@ -52,7 +52,7 @@ public partial class WorkloadNetworkVirtualMachineData : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public WorkloadNetworkVirtualMachineData() + internal WorkloadNetworkVirtualMachineData() { } @@ -61,23 +61,15 @@ public WorkloadNetworkVirtualMachineData() /// The name. /// The resourceType. /// The systemData. - /// The provisioning state of the resource. - /// Display name of the VM. - /// Virtual machine type. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal WorkloadNetworkVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkProvisioningState? provisioningState, string displayName, WorkloadNetworkVmType? vmType, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal WorkloadNetworkVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadNetworkVirtualMachineProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - ProvisioningState = provisioningState; - DisplayName = displayName; - VmType = vmType; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The provisioning state of the resource. - public WorkloadNetworkProvisioningState? ProvisioningState { get; } - /// Display name of the VM. - public string DisplayName { get; set; } - /// Virtual machine type. - public WorkloadNetworkVmType? VmType { get; } + /// The resource-specific properties for this resource. + public WorkloadNetworkVirtualMachineProperties Properties { get; } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineResource.cs index 7415445af749..8ebafafc5367 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineResource.cs @@ -33,8 +33,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkVirtualMachineWorkloadNetworksRestClient; + private readonly ClientDiagnostics _workloadNetworkVirtualMachineClientDiagnostics; + private readonly WorkloadNetworkVirtualMachinesRestOperations _workloadNetworkVirtualMachineRestClient; private readonly WorkloadNetworkVirtualMachineData _data; /// Gets the resource type for the operations. @@ -59,9 +59,9 @@ internal WorkloadNetworkVirtualMachineResource(ArmClient client, WorkloadNetwork /// The identifier of the resource that is the target of operations. internal WorkloadNetworkVirtualMachineResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string workloadNetworkVirtualMachineWorkloadNetworksApiVersion); - _workloadNetworkVirtualMachineWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkVirtualMachineWorkloadNetworksApiVersion); + _workloadNetworkVirtualMachineClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string workloadNetworkVirtualMachineApiVersion); + _workloadNetworkVirtualMachineRestClient = new WorkloadNetworkVirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkVirtualMachineApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -97,11 +97,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// WorkloadNetworks_GetVirtualMachine + /// WorkloadNetworkVirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -112,11 +112,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineResource.Get"); + using var scope = _workloadNetworkVirtualMachineClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineResource.Get"); scope.Start(); try { - var response = await _workloadNetworkVirtualMachineWorkloadNetworksRestClient.GetVirtualMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _workloadNetworkVirtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkVirtualMachineResource(Client, response.Value), response.GetRawResponse()); @@ -137,11 +137,11 @@ public virtual async Task> GetAs /// /// /// Operation Id - /// WorkloadNetworks_GetVirtualMachine + /// WorkloadNetworkVirtualMachine_Get /// /// /// Default Api Version - /// 2023-09-01 + /// 2024-09-01 /// /// /// Resource @@ -152,11 +152,11 @@ public virtual async Task> GetAs /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _workloadNetworkVirtualMachineWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineResource.Get"); + using var scope = _workloadNetworkVirtualMachineClientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineResource.Get"); scope.Start(); try { - var response = _workloadNetworkVirtualMachineWorkloadNetworksRestClient.GetVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var response = _workloadNetworkVirtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new WorkloadNetworkVirtualMachineResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs deleted file mode 100644 index 314428342cb9..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetWorkloadNetworkVmGroups method from an instance of . - /// - public partial class WorkloadNetworkVmGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkVmGroupWorkloadNetworksRestClient; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkVmGroupCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal WorkloadNetworkVmGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", WorkloadNetworkVmGroupResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(WorkloadNetworkVmGroupResource.ResourceType, out string workloadNetworkVmGroupWorkloadNetworksApiVersion); - _workloadNetworkVmGroupWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkVmGroupWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != WorkloadNetworkResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkloadNetworkResource.ResourceType), nameof(id)); - } - - /// - /// Create a WorkloadNetworkVMGroup - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreateVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// ID of the VM group. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string vmGroupId, WorkloadNetworkVmGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateVmGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkVmGroupOperationSource(Client), _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateCreateVmGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a WorkloadNetworkVMGroup - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_CreateVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// ID of the VM group. - /// Resource create parameters. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string vmGroupId, WorkloadNetworkVmGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateVmGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkVmGroupOperationSource(Client), _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateCreateVmGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkVMGroup - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the VM group. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string vmGroupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupCollection.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkVmGroupWorkloadNetworksRestClient.GetVmGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkVmGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkVMGroup - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the VM group. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string vmGroupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupCollection.Get"); - scope.Start(); - try - { - var response = _workloadNetworkVmGroupWorkloadNetworksRestClient.GetVmGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkVmGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List WorkloadNetworkVMGroup resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups - /// - /// - /// Operation Id - /// WorkloadNetworks_ListVmGroups - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateListVmGroupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateListVmGroupsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkVmGroupResource(Client, WorkloadNetworkVmGroupData.DeserializeWorkloadNetworkVmGroupData(e)), _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVmGroupCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// List WorkloadNetworkVMGroup resources by WorkloadNetwork - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups - /// - /// - /// Operation Id - /// WorkloadNetworks_ListVmGroups - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateListVmGroupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateListVmGroupsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadNetworkVmGroupResource(Client, WorkloadNetworkVmGroupData.DeserializeWorkloadNetworkVmGroupData(e)), _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, "WorkloadNetworkVmGroupCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the VM group. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string vmGroupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupCollection.Exists"); - scope.Start(); - try - { - var response = await _workloadNetworkVmGroupWorkloadNetworksRestClient.GetVmGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the VM group. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string vmGroupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupCollection.Exists"); - scope.Start(); - try - { - var response = _workloadNetworkVmGroupWorkloadNetworksRestClient.GetVmGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the VM group. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string vmGroupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _workloadNetworkVmGroupWorkloadNetworksRestClient.GetVmGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkVmGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// ID of the VM group. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string vmGroupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vmGroupId, nameof(vmGroupId)); - - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupCollection.GetIfExists"); - scope.Start(); - try - { - var response = _workloadNetworkVmGroupWorkloadNetworksRestClient.GetVmGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, vmGroupId, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkVmGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupData.Serialization.cs deleted file mode 100644 index 03c9386c3ca7..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupData.Serialization.cs +++ /dev/null @@ -1,240 +0,0 @@ -// 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; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkVmGroupData : 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 override 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(WorkloadNetworkVmGroupData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsCollectionDefined(Members)) - { - writer.WritePropertyName("members"u8); - writer.WriteStartArray(); - foreach (var item in Members) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(Revision)) - { - writer.WritePropertyName("revision"u8); - writer.WriteNumberValue(Revision.Value); - } - writer.WriteEndObject(); - } - - WorkloadNetworkVmGroupData 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(WorkloadNetworkVmGroupData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWorkloadNetworkVmGroupData(document.RootElement, options); - } - - internal static WorkloadNetworkVmGroupData DeserializeWorkloadNetworkVmGroupData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string displayName = default; - IList members = default; - WorkloadNetworkVmGroupStatus? status = default; - WorkloadNetworkVmGroupProvisioningState? provisioningState = default; - long? revision = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("members"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - members = array; - continue; - } - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new WorkloadNetworkVmGroupStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new WorkloadNetworkVmGroupProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("revision"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - revision = property0.Value.GetInt64(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WorkloadNetworkVmGroupData( - id, - name, - type, - systemData, - displayName, - members ?? new ChangeTrackingList(), - status, - provisioningState, - revision, - 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); - default: - throw new FormatException($"The model {nameof(WorkloadNetworkVmGroupData)} does not support writing '{options.Format}' format."); - } - } - - WorkloadNetworkVmGroupData 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 DeserializeWorkloadNetworkVmGroupData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WorkloadNetworkVmGroupData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupResource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupResource.Serialization.cs deleted file mode 100644 index adff21943285..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Avs -{ - public partial class WorkloadNetworkVmGroupResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - WorkloadNetworkVmGroupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - WorkloadNetworkVmGroupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupResource.cs deleted file mode 100644 index 33a3c394eae2..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupResource.cs +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Avs -{ - /// - /// A Class representing a WorkloadNetworkVmGroup along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetWorkloadNetworkVmGroupResource method. - /// Otherwise you can get one from its parent resource using the GetWorkloadNetworkVmGroup method. - /// - public partial class WorkloadNetworkVmGroupResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The privateCloudName. - /// The vmGroupId. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics; - private readonly WorkloadNetworksRestOperations _workloadNetworkVmGroupWorkloadNetworksRestClient; - private readonly WorkloadNetworkVmGroupData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/vmGroups"; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkVmGroupResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal WorkloadNetworkVmGroupResource(ArmClient client, WorkloadNetworkVmGroupData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal WorkloadNetworkVmGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Avs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string workloadNetworkVmGroupWorkloadNetworksApiVersion); - _workloadNetworkVmGroupWorkloadNetworksRestClient = new WorkloadNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadNetworkVmGroupWorkloadNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual WorkloadNetworkVmGroupData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get a WorkloadNetworkVMGroup - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupResource.Get"); - scope.Start(); - try - { - var response = await _workloadNetworkVmGroupWorkloadNetworksRestClient.GetVmGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkVmGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a WorkloadNetworkVMGroup - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_GetVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupResource.Get"); - scope.Start(); - try - { - var response = _workloadNetworkVmGroupWorkloadNetworksRestClient.GetVmGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkVmGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a WorkloadNetworkVMGroup - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_DeleteVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupResource.Delete"); - scope.Start(); - try - { - var response = await _workloadNetworkVmGroupWorkloadNetworksRestClient.DeleteVmGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(_workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateDeleteVmGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a WorkloadNetworkVMGroup - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_DeleteVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupResource.Delete"); - scope.Start(); - try - { - var response = _workloadNetworkVmGroupWorkloadNetworksRestClient.DeleteVmGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); - var operation = new AvsArmOperation(_workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateDeleteVmGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update a WorkloadNetworkVMGroup - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_UpdateVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, WorkloadNetworkVmGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupResource.Update"); - scope.Start(); - try - { - var response = await _workloadNetworkVmGroupWorkloadNetworksRestClient.UpdateVmGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new AvsArmOperation(new WorkloadNetworkVmGroupOperationSource(Client), _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateUpdateVmGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update a WorkloadNetworkVMGroup - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId} - /// - /// - /// Operation Id - /// WorkloadNetworks_UpdateVmGroup - /// - /// - /// Default Api Version - /// 2023-09-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, WorkloadNetworkVmGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics.CreateScope("WorkloadNetworkVmGroupResource.Update"); - scope.Start(); - try - { - var response = _workloadNetworkVmGroupWorkloadNetworksRestClient.UpdateVmGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data, cancellationToken); - var operation = new AvsArmOperation(new WorkloadNetworkVmGroupOperationSource(Client), _workloadNetworkVmGroupWorkloadNetworksClientDiagnostics, Pipeline, _workloadNetworkVmGroupWorkloadNetworksRestClient.CreateUpdateVmGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md b/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md deleted file mode 100644 index 25f5dd861b2c..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md +++ /dev/null @@ -1,150 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml - -azure-arm: true -csharp: true -library-name: Avs -namespace: Azure.ResourceManager.Avs -require: https://github.com/Azure/azure-rest-api-specs/blob/e19b5771846718774c0452800b9a42c251319f48/specification/vmware/resource-manager/readme.md -#tag: package-2023-09-01 -output-folder: $(this-folder)/Generated -clear-output-folder: true -sample-gen: - output-folder: $(this-folder)/../samples/Generated - clear-output-folder: true -skip-csproj: true -modelerfour: - flatten-payloads: false -use-model-reader-writer: true - -override-operation-name: - Locations_CheckQuotaAvailability: CheckAvsQuotaAvailability - Locations_CheckTrialAvailability: CheckAvsTrialAvailability - PrivateClouds_RotateVcenterPassword: RotateVCenterPassword - -format-by-name-rules: - 'tenantId': 'uuid' - 'ETag': 'etag' - 'location': 'azure-location' - '*Uri': 'Uri' - '*Uris': 'Uri' - -acronym-mapping: - CPU: Cpu - CPUs: Cpus - Os: OS - Ip: IP - Ips: IPs|ips - ID: Id - IDs: Ids - VM: Vm - VMs: Vms - Vmos: VmOS - VMScaleSet: VmScaleSet - DNS: Dns - VPN: Vpn - NAT: Nat - WAN: Wan - Ipv4: IPv4|ipv4 - Ipv6: IPv6|ipv6 - Ipsec: IPsec|ipsec - SSO: Sso - URI: Uri - Etag: ETag|etag - -rename-mapping: - Addon: AvsPrivateCloudAddon - AddonProperties: AvsPrivateCloudAddonProperties - CloudLink.properties.linkedCloud: -|arm-id - Cluster: AvsPrivateCloudCluster - Datastore: AvsPrivateCloudDatastore - ExpressRouteAuthorization.properties.expressRouteAuthorizationId: -|arm-id - ExpressRouteAuthorization.properties.expressRouteId: -|arm-id - GlobalReachConnection.properties.expressRouteId: -|arm-id - GlobalReachConnection.properties.peerExpressRouteCircuit: -|arm-id - AvailabilityProperties: PrivateCloudAvailabilityProperties - Circuit: ExpressRouteCircuit - Encryption: CustomerManagedEncryption - Endpoints: AvsPrivateCloudEndpoints - IdentitySource: SingleSignOnIdentitySource - IdentitySource.primaryServer: -|Uri - IdentitySource.secondaryServer: -|Uri - InternetEnum: InternetConnectivityState - ScriptExecutionParameter: ScriptExecutionParameterDetails - PSCredentialExecutionParameter: PSCredentialExecutionParameterDetails - ScriptSecureStringExecutionParameter: ScriptSecureStringExecutionParameterDetails - ScriptStringExecutionParameter: ScriptStringExecutionParameterDetails - ScriptExecution.properties.scriptCmdletId: -|arm-id - VirtualMachine: AvsPrivateCloudClusterVirtualMachine - WorkloadNetworkDnsService.properties.dnsServiceIp: -|ip-address - DnsServiceLogLevelEnum: DnsServiceLogLevel - DnsServiceStatusEnum: DnsServiceStatus - WorkloadNetworkDnsZone.properties.sourceIp: -|ip-address - WorkloadNetworkPortMirroring: WorkloadNetworkPortMirroringProfile - PortMirroringDirectionEnum: PortMirroringProfileDirection - WorkloadNetworkPortMirroringProvisioningState: WorkloadNetworkPortMirroringProfileProvisioningState - PortMirroringStatusEnum: PortMirroringProfileStatus - SegmentStatusEnum: WorkloadNetworkSegmentStatus - VMTypeEnum: WorkloadNetworkVmType - VMGroupStatusEnum: WorkloadNetworkVmGroupStatus - Quota: AvsSubscriptionQuotaAvailabilityResult - QuotaEnabled: AvsSubscriptionQuotaEnabled - Trial: AvsSubscriptionTrialAvailabilityResult - TrialStatus: AvsSubscriptionTrialStatus - Circuit.expressRouteID: -|arm-id - Circuit.expressRoutePrivatePeeringID: -|arm-id - MountOptionEnum: LunMountMode - SslEnum: SslCertificateStatus - OptionalParamEnum: ParameterOptionalityStatus - VisibilityParameterEnum: ParameterVisibilityStatus - ClusterProvisioningState: AvsPrivateCloudClusterProvisioningState - DatastoreProvisioningState: AvsPrivateCloudDatastoreProvisioningState - VirtualMachineRestrictMovement: AvsPrivateCloudClusterVirtualMachineRestrictMovement - PrivateCloud.properties.vmotionNetwork: VMotionNetwork - PrivateCloud.properties.vcenterPassword: VCenterPassword - PrivateCloud.properties.vcenterCertificateThumbprint: VCenterCertificateThumbprint - AdminCredentials.vcenterUsername: VCenterUsername - AdminCredentials.vcenterPassword: VCenterPassword - AffinityType: AvsPlacementPolicyAffinityType - DiskPoolVolume.targetId: -|arm-id - EncryptionState: AvsEncryptionState - EncryptionVersionType: AvsEncryptionVersionType - ManagementCluster: AvsManagementCluster - NsxPublicIPQuotaRaisedEnum: NsxPublicIPQuotaRaisedStatus - AffinityStrength: VmHostPlacementPolicyAffinityStrength - ClusterZone: AvsClusterZone - CloudLinkProvisioningState: AvsCloudLinkProvisioningState - DnsZoneType : AvsDnsZoneType - VirtualMachineProvisioningState : AvsVirtualMachineProvisioningState - -prepend-rp-prefix: -- CloudLink -- CloudLinkStatus -- PrivateCloud -- PrivateCloudProvisioningState -- EncryptionKeyStatus -- EncryptionKeyVaultProperties - -directive: - - from: vmware.json - where: $.definitions - transform: > - $.PrivateCloudProperties.properties.externalCloudLinks.items['x-ms-format'] = 'arm-id'; - $.WorkloadNetworkDnsZoneProperties.properties.dnsServerIps.items['x-ms-format'] = 'ip-address'; - delete $.ScriptExecutionProperties.properties.namedOutputs.additionalProperties; - $.PlacementPolicyUpdateProperties.properties.vmMembers.items['x-ms-format'] = 'arm-id'; - $.VmHostPlacementPolicyProperties.properties.vmMembers.items['x-ms-format'] = 'arm-id'; - $.VmVmPlacementPolicyProperties.properties.vmMembers.items['x-ms-format'] = 'arm-id'; - $.ScriptCmdletProperties.properties.timeout['format'] = 'duration'; - - from: vmware.json - where: $.paths['/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones'].post - transform: > - $['x-ms-pageable'] = { - 'nextLinkName': null, - 'itemName': 'zones' - } - reason: add this directive so that the return type could become pageable with flattening the item inside ClusterZoneList. -``` diff --git a/sdk/avs/Azure.ResourceManager.Avs/tsp-location.yaml b/sdk/avs/Azure.ResourceManager.Avs/tsp-location.yaml new file mode 100644 index 000000000000..99c3f4c99275 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/vmware/Microsoft.AVS.Management +commit: 6eec0425b447967d716a5dde9aae784ebcdc7244 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/durabletask/ci.mgmt.yml b/sdk/durabletask/ci.mgmt.yml index 5f63204cd804..32b11e75b082 100644 --- a/sdk/durabletask/ci.mgmt.yml +++ b/sdk/durabletask/ci.mgmt.yml @@ -1,7 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none - pr: branches: include: diff --git a/sdk/pineconevectordb/ci.yml b/sdk/pineconevectordb/ci.yml deleted file mode 100644 index 0b8325c8c903..000000000000 --- a/sdk/pineconevectordb/ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - -trigger: - branches: - include: - - main - - hotfix/* - - release/* - paths: - include: - - sdk/pineconevectordb - - sdk/pineconevectordb/ci.yml - - sdk/pineconevectordb/Azure.ResourceManager.PineconeVectorDb - -pr: - branches: - include: - - main - - feature/* - - hotfix/* - - release/* - paths: - include: - - sdk/pineconevectordb - - sdk/pineconevectordb/ci.yml - - sdk/pineconevectordb/Azure.ResourceManager.PineconeVectorDb - -extends: - template: /eng/pipelines/templates/stages/archetype-sdk-client.yml - parameters: - ServiceDirectory: pineconevectordb - ArtifactName: packages - Artifacts: - - name: Azure.ResourceManager.PineconeVectorDb - safeName: AzureResourceManagerPineconeVectorDb 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/