diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs index 01393ce45444..00c33be2aed5 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs @@ -21,8 +21,8 @@ public partial class Sample_ElasticSanCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ElasticSansCreateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Create_MaximumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Create" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Create_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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,41 +41,18 @@ public async Task CreateOrUpdate_ElasticSansCreateMaximumSetGen() // invoke the operation string elasticSanName = "elasticsanname"; - ElasticSanData data = new ElasticSanData(new AzureLocation("France Central"), new ElasticSanSku(ElasticSanSkuName.PremiumLrs) - { - Tier = ElasticSanSkuTier.Premium, - }, 5L, 25L) - { - AvailabilityZones = { "1" }, - PublicNetworkAccess = ElasticSanPublicNetworkAccess.Enabled, - ScaleUpProperties = new ElasticSanScaleUpProperties - { - UnusedSizeTiB = 24L, - IncreaseCapacityUnitByTiB = 4L, - CapacityUnitScaleUpLimitTiB = 17L, - AutoScalePolicyEnforcement = AutoScalePolicyEnforcement.None, - }, - Tags = -{ -["key9316"] = "ihndtieqibtob" -}, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, elasticSanName, data); - ElasticSanResource result = lro.Value; + ElasticSanData data = new ElasticSanData(default, null, default, default); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, elasticSanName, data); - // 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 - ElasticSanData resourceData = result.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 CreateOrUpdate_ElasticSansCreateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Create_MinimumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Create" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Create_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -94,23 +71,18 @@ public async Task CreateOrUpdate_ElasticSansCreateMinimumSetGen() // invoke the operation string elasticSanName = "elasticsanname"; - ElasticSanData data = new ElasticSanData(new AzureLocation("France Central"), new ElasticSanSku(ElasticSanSkuName.PremiumLrs), 15L, 27L); - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, elasticSanName, data); - ElasticSanResource result = lro.Value; + ElasticSanData data = new ElasticSanData(default, null, default, default); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, elasticSanName, data); - // 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 - ElasticSanData resourceData = result.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 Get_ElasticSansGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Get_MaximumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Get_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -142,8 +114,8 @@ public async Task Get_ElasticSansGetMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task Get_ElasticSansGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Get_MinimumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Get_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -175,8 +147,8 @@ public async Task Get_ElasticSansGetMinimumSetGen() [Ignore("Only validating compilation of examples")] public async Task GetAll_ElasticSansListByResourceGroupMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_ListByResourceGroup_MaximumSet_Gen.json - // this example is just showing the usage of "ElasticSans_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSan_ListByResourceGroup" 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(); @@ -210,8 +182,8 @@ public async Task GetAll_ElasticSansListByResourceGroupMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task GetAll_ElasticSansListByResourceGroupMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_ListByResourceGroup_MinimumSet_Gen.json - // this example is just showing the usage of "ElasticSans_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_ListByResourceGroup_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSan_ListByResourceGroup" 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(); @@ -245,8 +217,8 @@ public async Task GetAll_ElasticSansListByResourceGroupMinimumSetGen() [Ignore("Only validating compilation of examples")] public async Task Exists_ElasticSansGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Get_MaximumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Get_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -274,8 +246,8 @@ public async Task Exists_ElasticSansGetMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task Exists_ElasticSansGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Get_MinimumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Get_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -303,8 +275,8 @@ public async Task Exists_ElasticSansGetMinimumSetGen() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ElasticSansGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Get_MaximumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Get_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -344,8 +316,8 @@ public async Task GetIfExists_ElasticSansGetMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ElasticSansGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Get_MinimumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Get_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs index 644ac380a48d..b408ed16ff6e 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs @@ -20,8 +20,8 @@ public partial class Sample_ElasticSanPrivateEndpointConnectionCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_PrivateEndpointConnectionsCreateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Create_MaximumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Create" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Create_MaximumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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,31 +41,18 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionsCreateMaximumSetGen() // invoke the operation string privateEndpointConnectionName = "privateendpointconnectionname"; - ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(new ElasticSanPrivateLinkServiceConnectionState - { - Status = ElasticSanPrivateEndpointServiceConnectionStatus.Pending, - Description = "dxl", - ActionsRequired = "jhjdpwvyzipggtn", - }) - { - GroupIds = { "jdwrzpemdjrpiwzvy" }, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); - ElasticSanPrivateEndpointConnectionResource result = lro.Value; + ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(null); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); - // 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 - ElasticSanPrivateEndpointConnectionData resourceData = result.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 CreateOrUpdate_PrivateEndpointConnectionsCreateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Create_MinimumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Create" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Create_MinimumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -85,23 +72,18 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionsCreateMinimumSetGen() // invoke the operation string privateEndpointConnectionName = "privateendpointconnectionname"; - ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(new ElasticSanPrivateLinkServiceConnectionState()); - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); - ElasticSanPrivateEndpointConnectionResource result = lro.Value; + ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(null); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); - // 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 - ElasticSanPrivateEndpointConnectionData resourceData = result.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 Get_PrivateEndpointConnectionsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Get_MaximumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -134,8 +116,8 @@ public async Task Get_PrivateEndpointConnectionsGetMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task Get_PrivateEndpointConnectionsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Get_MinimumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -168,8 +150,8 @@ public async Task Get_PrivateEndpointConnectionsGetMinimumSetGen() [Ignore("Only validating compilation of examples")] public async Task GetAll_PrivateEndpointConnectionsListMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_List_MaximumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_List_MaximumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -204,8 +186,8 @@ public async Task GetAll_PrivateEndpointConnectionsListMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task GetAll_PrivateEndpointConnectionsListMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_List_MinimumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_List_MinimumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -240,8 +222,8 @@ public async Task GetAll_PrivateEndpointConnectionsListMinimumSetGen() [Ignore("Only validating compilation of examples")] public async Task Exists_PrivateEndpointConnectionsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Get_MaximumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -270,8 +252,8 @@ public async Task Exists_PrivateEndpointConnectionsGetMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task Exists_PrivateEndpointConnectionsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Get_MinimumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -300,8 +282,8 @@ public async Task Exists_PrivateEndpointConnectionsGetMinimumSetGen() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_PrivateEndpointConnectionsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Get_MaximumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -342,8 +324,8 @@ public async Task GetIfExists_PrivateEndpointConnectionsGetMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_PrivateEndpointConnectionsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Get_MinimumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionResource.cs index e4494c955b5a..63e06548c055 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionResource.cs @@ -20,8 +20,8 @@ public partial class Sample_ElasticSanPrivateEndpointConnectionResource [Ignore("Only validating compilation of examples")] public async Task Get_PrivateEndpointConnectionsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Get_MaximumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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 +51,8 @@ public async Task Get_PrivateEndpointConnectionsGetMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task Get_PrivateEndpointConnectionsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Get_MinimumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -82,8 +82,8 @@ public async Task Get_PrivateEndpointConnectionsGetMinimumSetGen() [Ignore("Only validating compilation of examples")] public async Task Delete_PrivateEndpointConnectionsDeleteMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Delete_MaximumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -109,8 +109,8 @@ public async Task Delete_PrivateEndpointConnectionsDeleteMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task Delete_PrivateEndpointConnectionsDeleteMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Delete_MinimumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Delete_MinimumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -136,8 +136,8 @@ public async Task Delete_PrivateEndpointConnectionsDeleteMinimumSetGen() [Ignore("Only validating compilation of examples")] public async Task Update_PrivateEndpointConnectionsCreateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Create_MaximumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Create" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Create_MaximumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -154,31 +154,18 @@ public async Task Update_PrivateEndpointConnectionsCreateMaximumSetGen() ElasticSanPrivateEndpointConnectionResource elasticSanPrivateEndpointConnection = client.GetElasticSanPrivateEndpointConnectionResource(elasticSanPrivateEndpointConnectionResourceId); // invoke the operation - ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(new ElasticSanPrivateLinkServiceConnectionState - { - Status = ElasticSanPrivateEndpointServiceConnectionStatus.Pending, - Description = "dxl", - ActionsRequired = "jhjdpwvyzipggtn", - }) - { - GroupIds = { "jdwrzpemdjrpiwzvy" }, - }; - ArmOperation lro = await elasticSanPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); - ElasticSanPrivateEndpointConnectionResource result = lro.Value; + ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(null); + await elasticSanPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); - // 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 - ElasticSanPrivateEndpointConnectionData resourceData = result.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 Update_PrivateEndpointConnectionsCreateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateEndpointConnections_Create_MinimumSet_Gen.json - // this example is just showing the usage of "PrivateEndpointConnections_Create" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateEndpointConnections_Create_MinimumSet_Gen.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -195,15 +182,10 @@ public async Task Update_PrivateEndpointConnectionsCreateMinimumSetGen() ElasticSanPrivateEndpointConnectionResource elasticSanPrivateEndpointConnection = client.GetElasticSanPrivateEndpointConnectionResource(elasticSanPrivateEndpointConnectionResourceId); // invoke the operation - ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(new ElasticSanPrivateLinkServiceConnectionState()); - ArmOperation lro = await elasticSanPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); - ElasticSanPrivateEndpointConnectionResource result = lro.Value; + ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(null); + await elasticSanPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); - // 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 - ElasticSanPrivateEndpointConnectionData 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/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanResource.cs index ba1b49332c14..5ea83e17c018 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanResource.cs @@ -20,8 +20,8 @@ public partial class Sample_ElasticSanResource [Ignore("Only validating compilation of examples")] public async Task Get_ElasticSansGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Get_MaximumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Get_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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_ElasticSansGetMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task Get_ElasticSansGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Get_MinimumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Get_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -80,8 +80,8 @@ public async Task Get_ElasticSansGetMinimumSetGen() [Ignore("Only validating compilation of examples")] public async Task Delete_ElasticSansDeleteMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Delete_MaximumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -106,8 +106,8 @@ public async Task Delete_ElasticSansDeleteMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task Delete_ElasticSansDeleteMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Delete_MinimumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Delete_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -132,8 +132,8 @@ public async Task Delete_ElasticSansDeleteMinimumSetGen() [Ignore("Only validating compilation of examples")] public async Task Update_ElasticSansUpdateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Update_MaximumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Update_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -149,23 +149,7 @@ public async Task Update_ElasticSansUpdateMaximumSetGen() ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); // invoke the operation - ElasticSanPatch patch = new ElasticSanPatch - { - Tags = -{ -["key1931"] = "yhjwkgmrrwrcoxblgwgzjqusch" -}, - BaseSizeTiB = 13L, - ExtendedCapacitySizeTiB = 29L, - PublicNetworkAccess = ElasticSanPublicNetworkAccess.Enabled, - ScaleUpProperties = new ElasticSanScaleUpProperties - { - UnusedSizeTiB = 24L, - IncreaseCapacityUnitByTiB = 4L, - CapacityUnitScaleUpLimitTiB = 17L, - AutoScalePolicyEnforcement = AutoScalePolicyEnforcement.None, - }, - }; + ElasticSanPatch patch = new ElasticSanPatch(); ArmOperation lro = await elasticSan.UpdateAsync(WaitUntil.Completed, patch); ElasticSanResource result = lro.Value; @@ -180,8 +164,8 @@ public async Task Update_ElasticSansUpdateMaximumSetGen() [Ignore("Only validating compilation of examples")] public async Task Update_ElasticSansUpdateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_Update_MinimumSet_Gen.json - // this example is just showing the usage of "ElasticSans_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_Update_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSan_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(); @@ -210,10 +194,10 @@ public async Task Update_ElasticSansUpdateMinimumSetGen() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetPrivateLinkResources_PrivateLinkResourcesListByElasticSanMaximumSetGen() + public async Task GetByElasticSan_PrivateLinkResourcesListByElasticSanMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateLinkResources_ListByElasticSan_MaximumSet_Gen.json - // this example is just showing the usage of "PrivateLinkResources_ListByElasticSan" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateLinkResources_ListByElasticSan_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSans_ListByElasticSan" 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(); @@ -229,7 +213,7 @@ public async Task GetPrivateLinkResources_PrivateLinkResourcesListByElasticSanMa ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); // invoke the operation and iterate over the result - await foreach (ElasticSanPrivateLinkResource item in elasticSan.GetPrivateLinkResourcesAsync()) + await foreach (ElasticSanPrivateLinkResourceData item in elasticSan.GetByElasticSanAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -239,10 +223,10 @@ public async Task GetPrivateLinkResources_PrivateLinkResourcesListByElasticSanMa [Test] [Ignore("Only validating compilation of examples")] - public async Task GetPrivateLinkResources_PrivateLinkResourcesListByElasticSanMinimumSetGen() + public async Task GetByElasticSan_PrivateLinkResourcesListByElasticSanMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/PrivateLinkResources_ListByElasticSan_MinimumSet_Gen.json - // this example is just showing the usage of "PrivateLinkResources_ListByElasticSan" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/PrivateLinkResources_ListByElasticSan_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSans_ListByElasticSan" 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(); @@ -258,7 +242,7 @@ public async Task GetPrivateLinkResources_PrivateLinkResourcesListByElasticSanMi ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); // invoke the operation and iterate over the result - await foreach (ElasticSanPrivateLinkResource item in elasticSan.GetPrivateLinkResourcesAsync()) + await foreach (ElasticSanPrivateLinkResourceData item in elasticSan.GetByElasticSanAsync()) { Console.WriteLine($"Succeeded: {item}"); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SnapshotCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SnapshotCollection.cs new file mode 100644 index 000000000000..f0cacf46a5c2 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SnapshotCollection.cs @@ -0,0 +1,375 @@ +// 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.ElasticSan.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ElasticSan.Samples +{ + public partial class Sample_SnapshotCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_VolumeSnapshotsCreateMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Create_MaximumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = volumeGroup.GetSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + SnapshotData data = new SnapshotData(null); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName, data); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_VolumeSnapshotsCreateMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Create_MinimumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = volumeGroup.GetSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + SnapshotData data = new SnapshotData(null); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName, data); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_VolumeSnapshotsGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = volumeGroup.GetSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + SnapshotResource result = await collection.GetAsync(snapshotName); + + // 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 + SnapshotData 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_VolumeSnapshotsGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = volumeGroup.GetSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + SnapshotResource result = await collection.GetAsync(snapshotName); + + // 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 + SnapshotData 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_VolumeSnapshotsListByVolumeGroupMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_ListByVolumeGroup_MaximumSet_Gen.json + // this example is just showing the usage of "Snapshot_ListByVolumeGroup" 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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = volumeGroup.GetSnapshots(); + + // invoke the operation and iterate over the result + await foreach (SnapshotResource 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 + SnapshotData 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_VolumeSnapshotsListByVolumeGroupMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_ListByVolumeGroup_MinimumSet_Gen.json + // this example is just showing the usage of "Snapshot_ListByVolumeGroup" 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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = volumeGroup.GetSnapshots(); + + // invoke the operation and iterate over the result + await foreach (SnapshotResource 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 + SnapshotData 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_VolumeSnapshotsGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = volumeGroup.GetSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + bool result = await collection.ExistsAsync(snapshotName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_VolumeSnapshotsGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = volumeGroup.GetSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + bool result = await collection.ExistsAsync(snapshotName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_VolumeSnapshotsGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = volumeGroup.GetSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + NullableResponse response = await collection.GetIfExistsAsync(snapshotName); + SnapshotResource 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 + SnapshotData 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_VolumeSnapshotsGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this SnapshotResource + SnapshotCollection collection = volumeGroup.GetSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + NullableResponse response = await collection.GetIfExistsAsync(snapshotName); + SnapshotResource 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 + SnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SnapshotResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SnapshotResource.cs new file mode 100644 index 000000000000..112760e6169b --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SnapshotResource.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.ElasticSan.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ElasticSan.Samples +{ + public partial class Sample_SnapshotResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_VolumeSnapshotsGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 SnapshotResource created on azure + // for more information of creating SnapshotResource, please refer to the document of SnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier snapshotResourceId = SnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + SnapshotResource snapshot = client.GetSnapshotResource(snapshotResourceId); + + // invoke the operation + SnapshotResource result = await snapshot.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 + SnapshotData 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_VolumeSnapshotsGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 SnapshotResource created on azure + // for more information of creating SnapshotResource, please refer to the document of SnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier snapshotResourceId = SnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + SnapshotResource snapshot = client.GetSnapshotResource(snapshotResourceId); + + // invoke the operation + SnapshotResource result = await snapshot.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 + SnapshotData 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_VolumeSnapshotsDeleteMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 SnapshotResource created on azure + // for more information of creating SnapshotResource, please refer to the document of SnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier snapshotResourceId = SnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + SnapshotResource snapshot = client.GetSnapshotResource(snapshotResourceId); + + // invoke the operation + await snapshot.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_VolumeSnapshotsDeleteMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Delete_MinimumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 SnapshotResource created on azure + // for more information of creating SnapshotResource, please refer to the document of SnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier snapshotResourceId = SnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + SnapshotResource snapshot = client.GetSnapshotResource(snapshotResourceId); + + // invoke the operation + await snapshot.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_VolumeSnapshotsCreateMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Create_MaximumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 SnapshotResource created on azure + // for more information of creating SnapshotResource, please refer to the document of SnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier snapshotResourceId = SnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + SnapshotResource snapshot = client.GetSnapshotResource(snapshotResourceId); + + // invoke the operation + SnapshotData data = new SnapshotData(null); + await snapshot.UpdateAsync(WaitUntil.Completed, data); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_VolumeSnapshotsCreateMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeSnapshots_Create_MinimumSet_Gen.json + // this example is just showing the usage of "Snapshot_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 SnapshotResource created on azure + // for more information of creating SnapshotResource, please refer to the document of SnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier snapshotResourceId = SnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + SnapshotResource snapshot = client.GetSnapshotResource(snapshotResourceId); + + // invoke the operation + SnapshotData data = new SnapshotData(null); + await snapshot.UpdateAsync(WaitUntil.Completed, data); + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index a3580e27e58a..1d8dc1f24667 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/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 GetSkus_SkusListMaximumSetGen() + public async Task GetElasticSans_ElasticSansListBySubscriptionMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/Skus_List_MaximumSet_Gen.json - // this example is just showing the usage of "Skus_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "ElasticSan_ListBySubscription" 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,10 +36,13 @@ public async Task GetSkus_SkusListMaximumSetGen() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - string filter = "obwwdrkq"; - await foreach (ElasticSanSkuInformation item in subscriptionResource.GetSkusAsync(filter: filter)) + await foreach (ElasticSanResource item in subscriptionResource.GetElasticSansAsync()) { - Console.WriteLine($"Succeeded: {item}"); + // 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 + ElasticSanData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine("Succeeded"); @@ -47,10 +50,10 @@ public async Task GetSkus_SkusListMaximumSetGen() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetSkus_SkusListMinimumSetGen() + public async Task GetElasticSans_ElasticSansListBySubscriptionMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/Skus_List_MinimumSet_Gen.json - // this example is just showing the usage of "Skus_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/ElasticSans_ListBySubscription_MinimumSet_Gen.json + // this example is just showing the usage of "ElasticSan_ListBySubscription" 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(); @@ -64,9 +67,13 @@ public async Task GetSkus_SkusListMinimumSetGen() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (ElasticSanSkuInformation item in subscriptionResource.GetSkusAsync()) + await foreach (ElasticSanResource item in subscriptionResource.GetElasticSansAsync()) { - Console.WriteLine($"Succeeded: {item}"); + // 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 + ElasticSanData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine("Succeeded"); @@ -74,10 +81,10 @@ public async Task GetSkus_SkusListMinimumSetGen() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetElasticSans_ElasticSansListBySubscriptionMaximumSetGen() + public async Task GetSkusOperationGroups_SkusListMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_ListBySubscription_MaximumSet_Gen.json - // this example is just showing the usage of "ElasticSans_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/Skus_List_MaximumSet_Gen.json + // this example is just showing the usage of "SkusOperationGroup_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,13 +98,9 @@ public async Task GetElasticSans_ElasticSansListBySubscriptionMaximumSetGen() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (ElasticSanResource item in subscriptionResource.GetElasticSansAsync()) + await foreach (ElasticSanSkuInformation item in subscriptionResource.GetSkusOperationGroupsAsync()) { - // 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 - ElasticSanData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded: {item}"); } Console.WriteLine("Succeeded"); @@ -105,10 +108,10 @@ public async Task GetElasticSans_ElasticSansListBySubscriptionMaximumSetGen() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetElasticSans_ElasticSansListBySubscriptionMinimumSetGen() + public async Task GetSkusOperationGroups_SkusListMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2024-07-01-preview/examples/ElasticSans_ListBySubscription_MinimumSet_Gen.json - // this example is just showing the usage of "ElasticSans_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-07-01-preview/Skus_List_MinimumSet_Gen.json + // this example is just showing the usage of "SkusOperationGroup_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(); @@ -122,13 +125,9 @@ public async Task GetElasticSans_ElasticSansListBySubscriptionMinimumSetGen() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (ElasticSanResource item in subscriptionResource.GetElasticSansAsync()) + await foreach (ElasticSanSkuInformation item in subscriptionResource.GetSkusOperationGroupsAsync()) { - // 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 - ElasticSanData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded: {item}"); } Console.WriteLine("Succeeded"); diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeCollection.cs new file mode 100644 index 000000000000..68f22dad7e17 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeCollection.cs @@ -0,0 +1,374 @@ +// 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.ElasticSan.Samples +{ + public partial class Sample_VolumeCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_VolumesCreateMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Create_MaximumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this VolumeResource + VolumeCollection collection = volumeGroup.GetVolumes(); + + // invoke the operation + string volumeName = "volumename"; + VolumeData data = new VolumeData(default); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, data); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_VolumesCreateMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Create_MinimumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this VolumeResource + VolumeCollection collection = volumeGroup.GetVolumes(); + + // invoke the operation + string volumeName = "volumename"; + VolumeData data = new VolumeData(default); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, data); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_VolumesGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this VolumeResource + VolumeCollection collection = volumeGroup.GetVolumes(); + + // invoke the operation + string volumeName = "volumename"; + VolumeResource result = await collection.GetAsync(volumeName); + + // 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 + VolumeData 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_VolumesGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this VolumeResource + VolumeCollection collection = volumeGroup.GetVolumes(); + + // invoke the operation + string volumeName = "volumename"; + VolumeResource result = await collection.GetAsync(volumeName); + + // 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 + VolumeData 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_VolumesListByVolumeGroupMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_ListByVolumeGroup_MaximumSet_Gen.json + // this example is just showing the usage of "Volume_ListByVolumeGroup" 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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this VolumeResource + VolumeCollection collection = volumeGroup.GetVolumes(); + + // invoke the operation and iterate over the result + await foreach (VolumeResource 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 + VolumeData 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_VolumesListByVolumeGroupMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_ListByVolumeGroup_MinimumSet_Gen.json + // this example is just showing the usage of "Volume_ListByVolumeGroup" 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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this VolumeResource + VolumeCollection collection = volumeGroup.GetVolumes(); + + // invoke the operation and iterate over the result + await foreach (VolumeResource 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 + VolumeData 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_VolumesGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this VolumeResource + VolumeCollection collection = volumeGroup.GetVolumes(); + + // invoke the operation + string volumeName = "volumename"; + bool result = await collection.ExistsAsync(volumeName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_VolumesGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this VolumeResource + VolumeCollection collection = volumeGroup.GetVolumes(); + + // invoke the operation + string volumeName = "volumename"; + bool result = await collection.ExistsAsync(volumeName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_VolumesGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this VolumeResource + VolumeCollection collection = volumeGroup.GetVolumes(); + + // invoke the operation + string volumeName = "volumename"; + NullableResponse response = await collection.GetIfExistsAsync(volumeName); + VolumeResource 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 + VolumeData 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_VolumesGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // get the collection of this VolumeResource + VolumeCollection collection = volumeGroup.GetVolumes(); + + // invoke the operation + string volumeName = "volumename"; + NullableResponse response = await collection.GetIfExistsAsync(volumeName); + VolumeResource 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 + VolumeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeGroupCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeGroupCollection.cs new file mode 100644 index 000000000000..dc56d53a9ea1 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeGroupCollection.cs @@ -0,0 +1,364 @@ +// 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.ElasticSan.Samples +{ + public partial class Sample_VolumeGroupCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_VolumeGroupsCreateMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Create_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this VolumeGroupResource + VolumeGroupCollection collection = elasticSan.GetVolumeGroups(); + + // invoke the operation + string volumeGroupName = "volumegroupname"; + VolumeGroupData data = new VolumeGroupData(); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeGroupName, data); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_VolumeGroupsCreateMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Create_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this VolumeGroupResource + VolumeGroupCollection collection = elasticSan.GetVolumeGroups(); + + // invoke the operation + string volumeGroupName = "volumegroupname"; + VolumeGroupData data = new VolumeGroupData(); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeGroupName, data); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_VolumeGroupsGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this VolumeGroupResource + VolumeGroupCollection collection = elasticSan.GetVolumeGroups(); + + // invoke the operation + string volumeGroupName = "volumegroupname"; + VolumeGroupResource result = await collection.GetAsync(volumeGroupName); + + // 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 + VolumeGroupData 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_VolumeGroupsGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this VolumeGroupResource + VolumeGroupCollection collection = elasticSan.GetVolumeGroups(); + + // invoke the operation + string volumeGroupName = "volumegroupname"; + VolumeGroupResource result = await collection.GetAsync(volumeGroupName); + + // 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 + VolumeGroupData 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_VolumeGroupsListByElasticSanMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_ListByElasticSan_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_ListByElasticSan" 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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this VolumeGroupResource + VolumeGroupCollection collection = elasticSan.GetVolumeGroups(); + + // invoke the operation and iterate over the result + await foreach (VolumeGroupResource 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 + VolumeGroupData 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_VolumeGroupsListByElasticSanMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_ListByElasticSan_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_ListByElasticSan" 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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this VolumeGroupResource + VolumeGroupCollection collection = elasticSan.GetVolumeGroups(); + + // invoke the operation and iterate over the result + await foreach (VolumeGroupResource 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 + VolumeGroupData 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_VolumeGroupsGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this VolumeGroupResource + VolumeGroupCollection collection = elasticSan.GetVolumeGroups(); + + // invoke the operation + string volumeGroupName = "volumegroupname"; + bool result = await collection.ExistsAsync(volumeGroupName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_VolumeGroupsGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this VolumeGroupResource + VolumeGroupCollection collection = elasticSan.GetVolumeGroups(); + + // invoke the operation + string volumeGroupName = "volumegroupname"; + bool result = await collection.ExistsAsync(volumeGroupName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_VolumeGroupsGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this VolumeGroupResource + VolumeGroupCollection collection = elasticSan.GetVolumeGroups(); + + // invoke the operation + string volumeGroupName = "volumegroupname"; + NullableResponse response = await collection.GetIfExistsAsync(volumeGroupName); + VolumeGroupResource 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 + VolumeGroupData 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_VolumeGroupsGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 ElasticSanResource created on azure + // for more information of creating ElasticSanResource, please refer to the document of ElasticSanResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + ResourceIdentifier elasticSanResourceId = ElasticSanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName); + ElasticSanResource elasticSan = client.GetElasticSanResource(elasticSanResourceId); + + // get the collection of this VolumeGroupResource + VolumeGroupCollection collection = elasticSan.GetVolumeGroups(); + + // invoke the operation + string volumeGroupName = "volumegroupname"; + NullableResponse response = await collection.GetIfExistsAsync(volumeGroupName); + VolumeGroupResource 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 + VolumeGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeGroupResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeGroupResource.cs new file mode 100644 index 000000000000..fbf59b73e5a6 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeGroupResource.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.ElasticSan.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ElasticSan.Samples +{ + public partial class Sample_VolumeGroupResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_VolumeGroupsGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // invoke the operation + VolumeGroupResource result = await volumeGroup.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 + VolumeGroupData 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_VolumeGroupsGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // invoke the operation + VolumeGroupResource result = await volumeGroup.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 + VolumeGroupData 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_VolumeGroupsDeleteMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // invoke the operation + await volumeGroup.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_VolumeGroupsDeleteMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Delete_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // invoke the operation + await volumeGroup.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_VolumeGroupsUpdateMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Update_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // invoke the operation + VolumeGroupPatch patch = new VolumeGroupPatch(); + ArmOperation lro = await volumeGroup.UpdateAsync(WaitUntil.Completed, patch); + VolumeGroupResource 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 + VolumeGroupData 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_VolumeGroupsUpdateMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/VolumeGroups_Update_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeGroup_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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // invoke the operation + VolumeGroupPatch patch = new VolumeGroupPatch(); + ArmOperation lro = await volumeGroup.UpdateAsync(WaitUntil.Completed, patch); + VolumeGroupResource 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 + VolumeGroupData 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 PreBackup_VolumeGroupsPreBackupMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_PreBackup_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroups_PreBackup" 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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // invoke the operation + VolumeNameList volumeNameList = new VolumeNameList(null); + ArmOperation lro = await volumeGroup.PreBackupAsync(WaitUntil.Completed, volumeNameList); + PreValidationResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task PreRestore_VolumeGroupsPreRestoreMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_PreRestore_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeGroups_PreRestore" 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 VolumeGroupResource created on azure + // for more information of creating VolumeGroupResource, please refer to the document of VolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier volumeGroupResourceId = VolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + VolumeGroupResource volumeGroup = client.GetVolumeGroupResource(volumeGroupResourceId); + + // invoke the operation + DiskSnapshotList diskSnapshotList = new DiskSnapshotList(null); + ArmOperation lro = await volumeGroup.PreRestoreAsync(WaitUntil.Completed, diskSnapshotList); + PreValidationResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeResource.cs new file mode 100644 index 000000000000..c4497b2a9af6 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_VolumeResource.cs @@ -0,0 +1,275 @@ +// 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.ElasticSan.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ElasticSan.Samples +{ + public partial class Sample_VolumeResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_VolumesGetMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeResource created on azure + // for more information of creating VolumeResource, please refer to the document of VolumeResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string volumeName = "volumename"; + ResourceIdentifier volumeResourceId = VolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + VolumeResource volume = client.GetVolumeResource(volumeResourceId); + + // invoke the operation + VolumeResource result = await volume.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 + VolumeData 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_VolumesGetMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Get_MinimumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeResource created on azure + // for more information of creating VolumeResource, please refer to the document of VolumeResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string volumeName = "volumename"; + ResourceIdentifier volumeResourceId = VolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + VolumeResource volume = client.GetVolumeResource(volumeResourceId); + + // invoke the operation + VolumeResource result = await volume.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 + VolumeData 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_VolumesDeleteMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeResource created on azure + // for more information of creating VolumeResource, please refer to the document of VolumeResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string volumeName = "volumename"; + ResourceIdentifier volumeResourceId = VolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + VolumeResource volume = client.GetVolumeResource(volumeResourceId); + + // invoke the operation + DeleteType? deleteType = DeleteType.Permanent; + await volume.DeleteAsync(WaitUntil.Completed, deleteType: deleteType); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_VolumesDeleteMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Delete_MinimumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeResource created on azure + // for more information of creating VolumeResource, please refer to the document of VolumeResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string volumeName = "volumename"; + ResourceIdentifier volumeResourceId = VolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + VolumeResource volume = client.GetVolumeResource(volumeResourceId); + + // invoke the operation + DeleteType? deleteType = DeleteType.Permanent; + await volume.DeleteAsync(WaitUntil.Completed, deleteType: deleteType); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_VolumesUpdateMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Update_MaximumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeResource created on azure + // for more information of creating VolumeResource, please refer to the document of VolumeResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string volumeName = "volumename"; + ResourceIdentifier volumeResourceId = VolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + VolumeResource volume = client.GetVolumeResource(volumeResourceId); + + // invoke the operation + VolumePatch patch = new VolumePatch(); + ArmOperation lro = await volume.UpdateAsync(WaitUntil.Completed, patch); + VolumeResource 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 + VolumeData 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_VolumesUpdateMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/Volumes_Update_MinimumSet_Gen.json + // this example is just showing the usage of "Volume_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 VolumeResource created on azure + // for more information of creating VolumeResource, please refer to the document of VolumeResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string volumeName = "volumename"; + ResourceIdentifier volumeResourceId = VolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + VolumeResource volume = client.GetVolumeResource(volumeResourceId); + + // invoke the operation + VolumePatch patch = new VolumePatch(); + ArmOperation lro = await volume.UpdateAsync(WaitUntil.Completed, patch); + VolumeResource 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 + VolumeData 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 RestoreVolume_RestoreVolumeMaximumSetGen() + { + // Generated from example definition: 2024-07-01-preview/RestoreVolume_MaximumSet_Gen.json + // this example is just showing the usage of "Volumes_RestoreVolume" 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 VolumeResource created on azure + // for more information of creating VolumeResource, please refer to the document of VolumeResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string volumeName = "volumename-1741526907"; + ResourceIdentifier volumeResourceId = VolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + VolumeResource volume = client.GetVolumeResource(volumeResourceId); + + // invoke the operation + ArmOperation lro = await volume.RestoreVolumeAsync(WaitUntil.Completed); + VolumeResource 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 + VolumeData 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 RestoreVolume_RestoreVolumeMinimumSetGen() + { + // Generated from example definition: 2024-07-01-preview/RestoreVolume_MinimumSet_Gen.json + // this example is just showing the usage of "Volumes_RestoreVolume" 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 VolumeResource created on azure + // for more information of creating VolumeResource, please refer to the document of VolumeResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string volumeName = "volumename-1741526907"; + ResourceIdentifier volumeResourceId = VolumeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + VolumeResource volume = client.GetVolumeResource(volumeResourceId); + + // invoke the operation + ArmOperation lro = await volume.RestoreVolumeAsync(WaitUntil.Completed); + VolumeResource 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 + VolumeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ArmElasticSanModelFactory.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ArmElasticSanModelFactory.cs index 04a77f508af6..dd5bd61a5749 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ArmElasticSanModelFactory.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ArmElasticSanModelFactory.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; using Azure.Core; using Azure.ResourceManager.Models; @@ -17,50 +16,6 @@ namespace Azure.ResourceManager.ElasticSan.Models /// Model factory for models. public static partial class ArmElasticSanModelFactory { - /// Initializes a new instance of . - /// Sku Name. - /// Sku Tier. - /// The type of the resource. - /// The set of locations that the SKU is available. This will be supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - /// Availability of the SKU for the location/zone. - /// The capability information in the specified SKU. - /// A new instance for mocking. - public static ElasticSanSkuInformation ElasticSanSkuInformation(ElasticSanSkuName name = default, ElasticSanSkuTier? tier = null, string resourceType = null, IEnumerable locations = null, IEnumerable locationInfo = null, IEnumerable capabilities = null) - { - locations ??= new List(); - locationInfo ??= new List(); - capabilities ??= new List(); - - return new ElasticSanSkuInformation( - name, - tier, - resourceType, - locations?.ToList(), - locationInfo?.ToList(), - capabilities?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The location. - /// The zones. - /// A new instance for mocking. - public static ElasticSanSkuLocationInfo ElasticSanSkuLocationInfo(AzureLocation? location = null, IEnumerable zones = null) - { - zones ??= new List(); - - return new ElasticSanSkuLocationInfo(location, zones?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of capability. - /// A string value to indicate states of given capability. - /// A new instance for mocking. - public static ElasticSanSkuCapability ElasticSanSkuCapability(string name = null, string value = null) - { - return new ElasticSanSkuCapability(name, value, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -76,13 +31,13 @@ public static ElasticSanSkuCapability ElasticSanSkuCapability(string name = null /// Total size of the provisioned Volumes in GiB. /// Total number of volume groups in this Elastic San appliance. /// Total Provisioned IOPS of the Elastic San appliance. - /// Total Provisioned MBps Elastic San appliance. + /// Total Provisioned MBps Elastic San appliance. /// Total size of the Elastic San appliance in TB. /// The list of Private Endpoint Connections. /// Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. /// Auto Scale Properties for Elastic San Appliance. /// A new instance for mocking. - public static ElasticSanData ElasticSanData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ElasticSanSku sku = null, IEnumerable availabilityZones = null, ElasticSanProvisioningState? provisioningState = null, long baseSizeTiB = default, long extendedCapacitySizeTiB = default, long? totalVolumeSizeGiB = null, long? volumeGroupCount = null, long? totalIops = null, long? totalMbps = null, long? totalSizeTiB = null, IEnumerable privateEndpointConnections = null, ElasticSanPublicNetworkAccess? publicNetworkAccess = null, ElasticSanScaleUpProperties scaleUpProperties = null) + public static ElasticSanData ElasticSanData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ElasticSanSku sku = null, IEnumerable availabilityZones = null, ProvisioningState? provisioningState = null, long baseSizeTiB = default, long extendedCapacitySizeTiB = default, long? totalVolumeSizeGiB = null, long? volumeGroupCount = null, long? totalIops = null, long? totalMBps = null, long? totalSizeTiB = null, IEnumerable privateEndpointConnections = null, PublicNetworkAccess? publicNetworkAccess = null, ScaleUpProperties scaleUpProperties = null) { tags ??= new Dictionary(); availabilityZones ??= new List(); @@ -103,7 +58,7 @@ public static ElasticSanData ElasticSanData(ResourceIdentifier id = null, string totalVolumeSizeGiB, volumeGroupCount, totalIops, - totalMbps, + totalMBps, totalSizeTiB, privateEndpointConnections?.ToList(), publicNetworkAccess, @@ -118,10 +73,10 @@ public static ElasticSanData ElasticSanData(ResourceIdentifier id = null, string /// The systemData. /// Provisioning State of Private Endpoint connection resource. /// Private Endpoint resource. - /// Private Link Service Connection State. + /// Private Link Service Connection State. /// List of resources private endpoint is mapped. /// A new instance for mocking. - public static ElasticSanPrivateEndpointConnectionData ElasticSanPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ElasticSanProvisioningState? provisioningState = null, ResourceIdentifier privateEndpointId = null, ElasticSanPrivateLinkServiceConnectionState connectionState = null, IEnumerable groupIds = null) + public static ElasticSanPrivateEndpointConnectionData ElasticSanPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProvisioningState? provisioningState = null, ResourceIdentifier privateEndpointId = null, ElasticSanPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, IEnumerable groupIds = null) { groupIds ??= new List(); @@ -132,12 +87,37 @@ public static ElasticSanPrivateEndpointConnectionData ElasticSanPrivateEndpointC systemData, provisioningState, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, - connectionState, + privateLinkServiceConnectionState, groupIds?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The private link resource group id. + /// The private link resource required member names. + /// The private link resource Private link DNS zone name. + /// A new instance for mocking. + public static ElasticSanPrivateLinkResourceData ElasticSanPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null) + { + requiredMembers ??= new List(); + requiredZoneNames ??= new List(); + + return new ElasticSanPrivateLinkResourceData( + id, + name, + resourceType, + systemData, + groupId, + requiredMembers?.ToList(), + requiredZoneNames?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -151,13 +131,13 @@ public static ElasticSanPrivateEndpointConnectionData ElasticSanPrivateEndpointC /// The list of Private Endpoint Connections. /// A boolean indicating whether or not Data Integrity Check is enabled. /// The retention policy for the soft deleted volume group and its associated resources. - /// A new instance for mocking. - public static ElasticSanVolumeGroupData ElasticSanVolumeGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ManagedServiceIdentity identity = null, ElasticSanProvisioningState? provisioningState = null, ElasticSanStorageTargetType? protocolType = null, ElasticSanEncryptionType? encryption = null, ElasticSanEncryptionProperties encryptionProperties = null, IEnumerable virtualNetworkRules = null, IEnumerable privateEndpointConnections = null, bool? enforceDataIntegrityCheckForIscsi = null, ElasticSanDeleteRetentionPolicy deleteRetentionPolicy = null) + /// A new instance for mocking. + public static VolumeGroupData VolumeGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ManagedServiceIdentity identity = null, ProvisioningState? provisioningState = null, StorageTargetType? protocolType = null, EncryptionType? encryption = null, EncryptionProperties encryptionProperties = null, IEnumerable virtualNetworkRules = null, IEnumerable privateEndpointConnections = null, bool? enforceDataIntegrityCheckForIscsi = null, DeleteRetentionPolicy deleteRetentionPolicy = null) { - virtualNetworkRules ??= new List(); + virtualNetworkRules ??= new List(); privateEndpointConnections ??= new List(); - return new ElasticSanVolumeGroupData( + return new VolumeGroupData( id, name, resourceType, @@ -167,24 +147,24 @@ public static ElasticSanVolumeGroupData ElasticSanVolumeGroupData(ResourceIdenti protocolType, encryption, encryptionProperties, - virtualNetworkRules != null ? new ElasticSanNetworkRuleSet(virtualNetworkRules?.ToList(), serializedAdditionalRawData: null) : null, + virtualNetworkRules != null ? new NetworkRuleSet(virtualNetworkRules?.ToList(), serializedAdditionalRawData: null) : null, privateEndpointConnections?.ToList(), enforceDataIntegrityCheckForIscsi, deleteRetentionPolicy, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of KeyVault key. /// The version of KeyVault key. /// The Uri of KeyVault. /// The object identifier of the current versioned Key Vault Key in use. /// Timestamp of last rotation of the Key Vault Key. /// This is a read only property that represents the expiration time of the current version of the customer managed key used for encryption. - /// A new instance for mocking. - public static ElasticSanKeyVaultProperties ElasticSanKeyVaultProperties(string keyName = null, string keyVersion = null, Uri keyVaultUri = null, string currentVersionedKeyIdentifier = null, DateTimeOffset? lastKeyRotationTimestamp = null, DateTimeOffset? currentVersionedKeyExpirationTimestamp = null) + /// A new instance for mocking. + public static KeyVaultProperties KeyVaultProperties(string keyName = null, string keyVersion = null, Uri keyVaultUri = null, string currentVersionedKeyIdentifier = null, DateTimeOffset? lastKeyRotationTimestamp = null, DateTimeOffset? currentVersionedKeyExpirationTimestamp = null) { - return new ElasticSanKeyVaultProperties( + return new KeyVaultProperties( keyName, keyVersion, keyVaultUri, @@ -194,7 +174,15 @@ public static ElasticSanKeyVaultProperties ElasticSanKeyVaultProperties(string k serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// a status value indicating success or failure of validation. + /// A new instance for mocking. + public static PreValidationResult PreValidationResult(string validationStatus = null) + { + return new PreValidationResult(validationStatus, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -205,10 +193,10 @@ public static ElasticSanKeyVaultProperties ElasticSanKeyVaultProperties(string k /// Storage target information. /// Parent resource information. /// State of the operation on the resource. - /// A new instance for mocking. - public static ElasticSanVolumeData ElasticSanVolumeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Guid? volumeId = null, ElasticSanVolumeDataSourceInfo creationData = null, long sizeGiB = default, IscsiTargetInfo storageTarget = null, ResourceIdentifier managedByResourceId = null, ElasticSanProvisioningState? provisioningState = null) + /// A new instance for mocking. + public static VolumeData VolumeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string volumeId = null, SourceCreationContent creationData = null, long sizeGiB = default, IscsiTargetInfo storageTarget = null, string managedByResourceId = null, ProvisioningState? provisioningState = null) { - return new ElasticSanVolumeData( + return new VolumeData( id, name, resourceType, @@ -229,7 +217,7 @@ public static ElasticSanVolumeData ElasticSanVolumeData(ResourceIdentifier id = /// State of the operation on the resource. /// Operational status of the iSCSI Target. /// A new instance for mocking. - public static IscsiTargetInfo IscsiTargetInfo(string targetIqn = null, string targetPortalHostname = null, int? targetPortalPort = null, ElasticSanProvisioningState? provisioningState = null, ResourceOperationalStatus? status = null) + public static IscsiTargetInfo IscsiTargetInfo(string targetIqn = null, string targetPortalHostname = null, int? targetPortalPort = null, ProvisioningState? provisioningState = null, OperationalStatus? status = null) { return new IscsiTargetInfo( targetIqn, @@ -240,32 +228,7 @@ public static IscsiTargetInfo IscsiTargetInfo(string targetIqn = null, string ta serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The private link resource group id. - /// The private link resource required member names. - /// The private link resource Private link DNS zone name. - /// A new instance for mocking. - public static ElasticSanPrivateLinkResource ElasticSanPrivateLinkResource(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null) - { - requiredMembers ??= new List(); - requiredZoneNames ??= new List(); - - return new ElasticSanPrivateLinkResource( - id, - name, - resourceType, - systemData, - groupId, - requiredMembers?.ToList(), - requiredZoneNames?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -274,92 +237,63 @@ public static ElasticSanPrivateLinkResource ElasticSanPrivateLinkResource(Resour /// State of the operation on the resource. /// Size of Source Volume. /// Source Volume Name of a snapshot. - /// A new instance for mocking. - public static ElasticSanSnapshotData ElasticSanSnapshotData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier creationDataSourceId = null, ElasticSanProvisioningState? provisioningState = null, long? sourceVolumeSizeGiB = null, string volumeName = null) + /// A new instance for mocking. + public static SnapshotData SnapshotData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string creationDataSourceId = null, ProvisioningState? provisioningState = null, long? sourceVolumeSizeGiB = null, string volumeName = null) { - return new ElasticSanSnapshotData( + return new SnapshotData( id, name, resourceType, systemData, - creationDataSourceId != null ? new SnapshotCreationInfo(creationDataSourceId, serializedAdditionalRawData: null) : null, + creationDataSourceId != null ? new SnapshotCreationContent(creationDataSourceId, serializedAdditionalRawData: null) : null, provisioningState, sourceVolumeSizeGiB, volumeName, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// a status value indicating success or failure of validation. - /// A new instance for mocking. - public static ElasticSanPreValidationResult ElasticSanPreValidationResult(string validationStatus = null) + /// Initializes a new instance of . + /// Sku Name. + /// Sku Tier. + /// The type of the resource. + /// The set of locations that the SKU is available. This will be supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). + /// Availability of the SKU for the location/zone. + /// The capability information in the specified SKU. + /// A new instance for mocking. + public static ElasticSanSkuInformation ElasticSanSkuInformation(ElasticSanSkuName name = default, ElasticSanSkuTier? tier = null, string resourceType = null, IEnumerable locations = null, IEnumerable locationInfo = null, IEnumerable capabilities = null) { - return new ElasticSanPreValidationResult(validationStatus, serializedAdditionalRawData: null); + locations ??= new List(); + locationInfo ??= new List(); + capabilities ??= new List(); + + return new ElasticSanSkuInformation( + name, + tier, + resourceType, + locations?.ToList(), + locationInfo?.ToList(), + capabilities?.ToList(), + serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. + /// Initializes a new instance of . /// The location. - /// resource sku. - /// Logical zone for Elastic San resource; example: ["1"]. - /// State of the operation on the resource. - /// Base size of the Elastic San appliance in TiB. - /// Extended size of the Elastic San appliance in TiB. - /// Total size of the provisioned Volumes in GiB. - /// Total number of volume groups in this Elastic San appliance. - /// Total Provisioned IOPS of the Elastic San appliance. - /// Total Provisioned MBps Elastic San appliance. - /// Total size of the Elastic San appliance in TB. - /// The list of Private Endpoint Connections. - /// Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static ElasticSanData ElasticSanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ElasticSanSku sku, IEnumerable availabilityZones, ElasticSanProvisioningState? provisioningState, long baseSizeTiB, long extendedCapacitySizeTiB, long? totalVolumeSizeGiB, long? volumeGroupCount, long? totalIops, long? totalMbps, long? totalSizeTiB, IEnumerable privateEndpointConnections, ElasticSanPublicNetworkAccess? publicNetworkAccess) + /// The zones. + /// A new instance for mocking. + public static SkuLocationInfo SkuLocationInfo(string location = null, IEnumerable zones = null) { - return ElasticSanData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, sku: sku, availabilityZones: availabilityZones, provisioningState: provisioningState, baseSizeTiB: baseSizeTiB, extendedCapacitySizeTiB: extendedCapacitySizeTiB, totalVolumeSizeGiB: totalVolumeSizeGiB, volumeGroupCount: volumeGroupCount, totalIops: totalIops, totalMbps: totalMbps, totalSizeTiB: totalSizeTiB, privateEndpointConnections: privateEndpointConnections, publicNetworkAccess: publicNetworkAccess, scaleUpProperties: default); - } + zones ??= new List(); - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. - /// State of the operation on the resource. - /// Type of storage target. - /// Type of encryption. - /// Encryption Properties describing Key Vault and Identity information. - /// A collection of rules governing the accessibility from specific network locations. - /// The list of Private Endpoint Connections. - /// A boolean indicating whether or not Data Integrity Check is enabled. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static ElasticSanVolumeGroupData ElasticSanVolumeGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, ElasticSanProvisioningState? provisioningState, ElasticSanStorageTargetType? protocolType, ElasticSanEncryptionType? encryption, ElasticSanEncryptionProperties encryptionProperties, IEnumerable virtualNetworkRules, IEnumerable privateEndpointConnections, bool? enforceDataIntegrityCheckForIscsi) - { - return ElasticSanVolumeGroupData(id: id, name: name, resourceType: resourceType, systemData: systemData, identity: identity, provisioningState: provisioningState, protocolType: protocolType, encryption: encryption, encryptionProperties: encryptionProperties, virtualNetworkRules: virtualNetworkRules, privateEndpointConnections: privateEndpointConnections, enforceDataIntegrityCheckForIscsi: enforceDataIntegrityCheckForIscsi, deleteRetentionPolicy: default); + return new SkuLocationInfo(location, zones?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. - /// State of the operation on the resource. - /// Type of storage target. - /// Type of encryption. - /// Encryption Properties describing Key Vault and Identity information. - /// A collection of rules governing the accessibility from specific network locations. - /// The list of Private Endpoint Connections. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static ElasticSanVolumeGroupData ElasticSanVolumeGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, ElasticSanProvisioningState? provisioningState, ElasticSanStorageTargetType? protocolType, ElasticSanEncryptionType? encryption, ElasticSanEncryptionProperties encryptionProperties, IEnumerable virtualNetworkRules, IEnumerable privateEndpointConnections) + /// Initializes a new instance of . + /// The name of capability. + /// A string value to indicate states of given capability. + /// A new instance for mocking. + public static SKUCapability SKUCapability(string name = null, string value = null) { - return ElasticSanVolumeGroupData(id: id, name: name, resourceType: resourceType, systemData: systemData, identity: identity, provisioningState: provisioningState, protocolType: protocolType, encryption: encryption, encryptionProperties: encryptionProperties, virtualNetworkRules: virtualNetworkRules, privateEndpointConnections: privateEndpointConnections, enforceDataIntegrityCheckForIscsi: default, deleteRetentionPolicy: default); + return new SKUCapability(name, value, serializedAdditionalRawData: null); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanCollection.cs index 47c28b19d7ee..19258f2da448 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanCollection.cs @@ -61,7 +61,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// ElasticSans_Create + /// ElasticSan_Create /// /// /// Default Api Version @@ -79,7 +79,7 @@ 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 elasticSanName, ElasticSanData data, CancellationToken cancellationToken = default) + public virtual async Task CreateOrUpdateAsync(WaitUntil waitUntil, string elasticSanName, ElasticSanData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNull(data, nameof(data)); @@ -89,9 +89,9 @@ public virtual async Task> CreateOrUpdateAsync( try { var response = await _elasticSanRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, elasticSanName, data, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(new ElasticSanOperationSource(Client), _elasticSanClientDiagnostics, Pipeline, _elasticSanRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, elasticSanName, data).Request, response, OperationFinalStateVia.Location); + var operation = new ElasticSanArmOperation(_elasticSanClientDiagnostics, Pipeline, _elasticSanRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, elasticSanName, data).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) @@ -110,7 +110,7 @@ public virtual async Task> CreateOrUpdateAsync( /// /// /// Operation Id - /// ElasticSans_Create + /// ElasticSan_Create /// /// /// Default Api Version @@ -128,7 +128,7 @@ public virtual async Task> CreateOrUpdateAsync( /// 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 elasticSanName, ElasticSanData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string elasticSanName, ElasticSanData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNull(data, nameof(data)); @@ -138,9 +138,9 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUnt try { var response = _elasticSanRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, elasticSanName, data, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanOperationSource(Client), _elasticSanClientDiagnostics, Pipeline, _elasticSanRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, elasticSanName, data).Request, response, OperationFinalStateVia.Location); + var operation = new ElasticSanArmOperation(_elasticSanClientDiagnostics, Pipeline, _elasticSanRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, elasticSanName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) @@ -159,7 +159,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUnt /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -204,7 +204,7 @@ public virtual async Task> GetAsync(string elasticS /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -249,7 +249,7 @@ public virtual Response Get(string elasticSanName, Cancellat /// /// /// Operation Id - /// ElasticSans_ListByResourceGroup + /// ElasticSan_ListByResourceGroup /// /// /// Default Api Version @@ -279,7 +279,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken c /// /// /// Operation Id - /// ElasticSans_ListByResourceGroup + /// ElasticSan_ListByResourceGroup /// /// /// Default Api Version @@ -309,7 +309,7 @@ public virtual Pageable GetAll(CancellationToken cancellatio /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -352,7 +352,7 @@ public virtual async Task> ExistsAsync(string elasticSanName, Can /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -395,7 +395,7 @@ public virtual Response Exists(string elasticSanName, CancellationToken ca /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -440,7 +440,7 @@ public virtual async Task> GetIfExistsAsync /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.Serialization.cs index b6aabea089ee..fec2113926c5 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.Serialization.cs @@ -75,10 +75,10 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("totalIops"u8); writer.WriteNumberValue(TotalIops.Value); } - if (options.Format != "W" && Optional.IsDefined(TotalMbps)) + if (options.Format != "W" && Optional.IsDefined(TotalMBps)) { writer.WritePropertyName("totalMBps"u8); - writer.WriteNumberValue(TotalMbps.Value); + writer.WriteNumberValue(TotalMBps.Value); } if (options.Format != "W" && Optional.IsDefined(TotalSizeTiB)) { @@ -136,16 +136,16 @@ internal static ElasticSanData DeserializeElasticSanData(JsonElement element, Mo SystemData systemData = default; ElasticSanSku sku = default; IList availabilityZones = default; - ElasticSanProvisioningState? provisioningState = default; + ProvisioningState? provisioningState = default; long baseSizeTiB = default; long extendedCapacitySizeTiB = default; long? totalVolumeSizeGiB = default; long? volumeGroupCount = default; long? totalIops = default; - long? totalMbps = default; + long? totalMBps = default; long? totalSizeTiB = default; IReadOnlyList privateEndpointConnections = default; - ElasticSanPublicNetworkAccess? publicNetworkAccess = default; + PublicNetworkAccess? publicNetworkAccess = default; AutoScaleProperties autoScaleProperties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -228,7 +228,7 @@ internal static ElasticSanData DeserializeElasticSanData(JsonElement element, Mo { continue; } - provisioningState = new ElasticSanProvisioningState(property0.Value.GetString()); + provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("baseSizeTiB"u8)) @@ -274,7 +274,7 @@ internal static ElasticSanData DeserializeElasticSanData(JsonElement element, Mo { continue; } - totalMbps = property0.Value.GetInt64(); + totalMBps = property0.Value.GetInt64(); continue; } if (property0.NameEquals("totalSizeTiB"u8)) @@ -306,7 +306,7 @@ internal static ElasticSanData DeserializeElasticSanData(JsonElement element, Mo { continue; } - publicNetworkAccess = new ElasticSanPublicNetworkAccess(property0.Value.GetString()); + publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } if (property0.NameEquals("autoScaleProperties"u8)) @@ -342,7 +342,7 @@ internal static ElasticSanData DeserializeElasticSanData(JsonElement element, Mo totalVolumeSizeGiB, volumeGroupCount, totalIops, - totalMbps, + totalMBps, totalSizeTiB, privateEndpointConnections ?? new ChangeTrackingList(), publicNetworkAccess, diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.cs index 6f6fb770ea9d..f6de8ec5dacf 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.cs @@ -83,13 +83,13 @@ public ElasticSanData(AzureLocation location, ElasticSanSku sku, long baseSizeTi /// Total size of the provisioned Volumes in GiB. /// Total number of volume groups in this Elastic San appliance. /// Total Provisioned IOPS of the Elastic San appliance. - /// Total Provisioned MBps Elastic San appliance. + /// Total Provisioned MBps Elastic San appliance. /// Total size of the Elastic San appliance in TB. /// The list of Private Endpoint Connections. /// Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. /// Auto Scale Properties for Elastic San Appliance. /// Keeps track of any properties unknown to the library. - internal ElasticSanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ElasticSanSku sku, IList availabilityZones, ElasticSanProvisioningState? provisioningState, long baseSizeTiB, long extendedCapacitySizeTiB, long? totalVolumeSizeGiB, long? volumeGroupCount, long? totalIops, long? totalMbps, long? totalSizeTiB, IReadOnlyList privateEndpointConnections, ElasticSanPublicNetworkAccess? publicNetworkAccess, AutoScaleProperties autoScaleProperties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal ElasticSanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ElasticSanSku sku, IList availabilityZones, ProvisioningState? provisioningState, long baseSizeTiB, long extendedCapacitySizeTiB, long? totalVolumeSizeGiB, long? volumeGroupCount, long? totalIops, long? totalMBps, long? totalSizeTiB, IReadOnlyList privateEndpointConnections, PublicNetworkAccess? publicNetworkAccess, AutoScaleProperties autoScaleProperties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; AvailabilityZones = availabilityZones; @@ -99,7 +99,7 @@ internal ElasticSanData(ResourceIdentifier id, string name, ResourceType resourc TotalVolumeSizeGiB = totalVolumeSizeGiB; VolumeGroupCount = volumeGroupCount; TotalIops = totalIops; - TotalMbps = totalMbps; + TotalMBps = totalMBps; TotalSizeTiB = totalSizeTiB; PrivateEndpointConnections = privateEndpointConnections; PublicNetworkAccess = publicNetworkAccess; @@ -117,7 +117,7 @@ internal ElasticSanData() /// Logical zone for Elastic San resource; example: ["1"]. public IList AvailabilityZones { get; } /// State of the operation on the resource. - public ElasticSanProvisioningState? ProvisioningState { get; } + public ProvisioningState? ProvisioningState { get; } /// Base size of the Elastic San appliance in TiB. public long BaseSizeTiB { get; set; } /// Extended size of the Elastic San appliance in TiB. @@ -129,17 +129,17 @@ internal ElasticSanData() /// Total Provisioned IOPS of the Elastic San appliance. public long? TotalIops { get; } /// Total Provisioned MBps Elastic San appliance. - public long? TotalMbps { get; } + public long? TotalMBps { get; } /// Total size of the Elastic San appliance in TB. public long? TotalSizeTiB { get; } /// The list of Private Endpoint Connections. public IReadOnlyList PrivateEndpointConnections { get; } /// Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. - public ElasticSanPublicNetworkAccess? PublicNetworkAccess { get; set; } + public PublicNetworkAccess? PublicNetworkAccess { get; set; } /// Auto Scale Properties for Elastic San Appliance. internal AutoScaleProperties AutoScaleProperties { get; set; } /// Scale up settings on Elastic San Appliance. - public ElasticSanScaleUpProperties ScaleUpProperties + public ScaleUpProperties ScaleUpProperties { get => AutoScaleProperties is null ? default : AutoScaleProperties.ScaleUpProperties; set diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionCollection.cs index 884d0390490d..6766fd81b1bf 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionCollection.cs @@ -60,7 +60,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// PrivateEndpointConnections_Create + /// PrivateEndpointConnection_Create /// /// /// Default Api Version @@ -78,7 +78,7 @@ 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 privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public virtual async Task CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); Argument.AssertNotNull(data, nameof(data)); @@ -88,9 +88,9 @@ public virtual async Task(new ElasticSanPrivateEndpointConnectionOperationSource(Client), _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data).Request, response, OperationFinalStateVia.Location); + var operation = new ElasticSanArmOperation(_elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data).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) @@ -109,7 +109,7 @@ public virtual async Task /// /// Operation Id - /// PrivateEndpointConnections_Create + /// PrivateEndpointConnection_Create /// /// /// Default Api Version @@ -127,7 +127,7 @@ public virtual async Task 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 privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); Argument.AssertNotNull(data, nameof(data)); @@ -137,9 +137,9 @@ public virtual ArmOperation CreateO try { var response = _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanPrivateEndpointConnectionOperationSource(Client), _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data).Request, response, OperationFinalStateVia.Location); + var operation = new ElasticSanArmOperation(_elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) @@ -158,7 +158,7 @@ public virtual ArmOperation CreateO /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -203,7 +203,7 @@ public virtual async Task> /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -248,7 +248,7 @@ public virtual Response Get(string /// /// /// Operation Id - /// PrivateEndpointConnections_List + /// PrivateEndpointConnection_List /// /// /// Default Api Version @@ -265,7 +265,8 @@ public virtual Response Get(string public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ElasticSanPrivateEndpointConnectionResource(Client, ElasticSanPrivateEndpointConnectionData.DeserializeElasticSanPrivateEndpointConnectionData(e)), _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ElasticSanPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticSanPrivateEndpointConnectionResource(Client, ElasticSanPrivateEndpointConnectionData.DeserializeElasticSanPrivateEndpointConnectionData(e)), _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ElasticSanPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -277,7 +278,7 @@ public virtual AsyncPageable GetAll /// /// /// Operation Id - /// PrivateEndpointConnections_List + /// PrivateEndpointConnection_List /// /// /// Default Api Version @@ -294,7 +295,8 @@ public virtual AsyncPageable GetAll public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ElasticSanPrivateEndpointConnectionResource(Client, ElasticSanPrivateEndpointConnectionData.DeserializeElasticSanPrivateEndpointConnectionData(e)), _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ElasticSanPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticSanPrivateEndpointConnectionResource(Client, ElasticSanPrivateEndpointConnectionData.DeserializeElasticSanPrivateEndpointConnectionData(e)), _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ElasticSanPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -306,7 +308,7 @@ public virtual Pageable GetAll(Canc /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -349,7 +351,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -392,7 +394,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -437,7 +439,7 @@ public virtual async Task /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionData.Serialization.cs index 6c8bac99bad1..91e23e086cf7 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionData.Serialization.cs @@ -51,7 +51,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri JsonSerializer.Serialize(writer, PrivateEndpoint); } writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState, options); + writer.WriteObjectValue(PrivateLinkServiceConnectionState, options); if (Optional.IsCollectionDefined(GroupIds)) { writer.WritePropertyName("groupIds"u8); @@ -89,7 +89,7 @@ internal static ElasticSanPrivateEndpointConnectionData DeserializeElasticSanPri string name = default; ResourceType type = default; SystemData systemData = default; - ElasticSanProvisioningState? provisioningState = default; + ProvisioningState? provisioningState = default; SubResource privateEndpoint = default; ElasticSanPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; IList groupIds = default; @@ -136,7 +136,7 @@ internal static ElasticSanPrivateEndpointConnectionData DeserializeElasticSanPri { continue; } - provisioningState = new ElasticSanProvisioningState(property0.Value.GetString()); + provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("privateEndpoint"u8)) diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionData.cs index a6b011d5022d..2e9a38658421 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionData.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionData.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.ElasticSan { /// /// A class representing the ElasticSanPrivateEndpointConnection data model. - /// Response for PrivateEndpoint Connection object + /// Response for PrivateEndpoint Connection object /// public partial class ElasticSanPrivateEndpointConnectionData : ResourceData { @@ -53,13 +53,13 @@ public partial class ElasticSanPrivateEndpointConnectionData : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// Private Link Service Connection State. - /// is null. - public ElasticSanPrivateEndpointConnectionData(ElasticSanPrivateLinkServiceConnectionState connectionState) + /// Private Link Service Connection State. + /// is null. + public ElasticSanPrivateEndpointConnectionData(ElasticSanPrivateLinkServiceConnectionState privateLinkServiceConnectionState) { - Argument.AssertNotNull(connectionState, nameof(connectionState)); + Argument.AssertNotNull(privateLinkServiceConnectionState, nameof(privateLinkServiceConnectionState)); - ConnectionState = connectionState; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; GroupIds = new ChangeTrackingList(); } @@ -70,14 +70,14 @@ public ElasticSanPrivateEndpointConnectionData(ElasticSanPrivateLinkServiceConne /// The systemData. /// Provisioning State of Private Endpoint connection resource. /// Private Endpoint resource. - /// Private Link Service Connection State. + /// Private Link Service Connection State. /// List of resources private endpoint is mapped. /// Keeps track of any properties unknown to the library. - internal ElasticSanPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ElasticSanProvisioningState? provisioningState, SubResource privateEndpoint, ElasticSanPrivateLinkServiceConnectionState connectionState, IList groupIds, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ElasticSanPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisioningState? provisioningState, SubResource privateEndpoint, ElasticSanPrivateLinkServiceConnectionState privateLinkServiceConnectionState, IList groupIds, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; PrivateEndpoint = privateEndpoint; - ConnectionState = connectionState; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; GroupIds = groupIds; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -88,7 +88,7 @@ internal ElasticSanPrivateEndpointConnectionData() } /// Provisioning State of Private Endpoint connection resource. - public ElasticSanProvisioningState? ProvisioningState { get; } + public ProvisioningState? ProvisioningState { get; } /// Private Endpoint resource. internal SubResource PrivateEndpoint { get; set; } /// Gets Id. @@ -98,7 +98,7 @@ public ResourceIdentifier PrivateEndpointId } /// Private Link Service Connection State. - public ElasticSanPrivateLinkServiceConnectionState ConnectionState { get; set; } + public ElasticSanPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } /// List of resources private endpoint is mapped. public IList GroupIds { get; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionResource.cs index 672ce2a3b136..a122210c5d00 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionResource.cs @@ -97,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -137,7 +137,7 @@ public virtual async Task> /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -177,7 +177,7 @@ public virtual Response Get(Cancell /// /// /// Operation Id - /// PrivateEndpointConnections_Delete + /// PrivateEndpointConnection_Delete /// /// /// Default Api Version @@ -219,7 +219,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// PrivateEndpointConnections_Delete + /// PrivateEndpointConnection_Delete /// /// /// Default Api Version @@ -261,7 +261,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// PrivateEndpointConnections_Create + /// PrivateEndpointConnection_Create /// /// /// Default Api Version @@ -277,7 +277,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Private Endpoint Connection Approval object. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public virtual async Task UpdateAsync(WaitUntil waitUntil, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); @@ -286,9 +286,9 @@ public virtual async Task(new ElasticSanPrivateEndpointConnectionOperationSource(Client), _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var operation = new ElasticSanArmOperation(_elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).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) @@ -307,7 +307,7 @@ public virtual async Task /// /// Operation Id - /// PrivateEndpointConnections_Create + /// PrivateEndpointConnection_Create /// /// /// Default Api Version @@ -323,7 +323,7 @@ public virtual async Task Private Endpoint Connection Approval object. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); @@ -332,9 +332,9 @@ public virtual ArmOperation Update( try { var response = _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanPrivateEndpointConnectionOperationSource(Client), _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var operation = new ElasticSanArmOperation(_elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _elasticSanPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs index de4598dd7ab2..4613473d9c1b 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs @@ -38,8 +38,6 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ClientDiagnostics _elasticSanClientDiagnostics; private readonly ElasticSansRestOperations _elasticSanRestClient; - private readonly ClientDiagnostics _privateLinkResourcesClientDiagnostics; - private readonly PrivateLinkResourcesRestOperations _privateLinkResourcesRestClient; private readonly ElasticSanData _data; /// Gets the resource type for the operations. @@ -67,8 +65,6 @@ internal ElasticSanResource(ArmClient client, ResourceIdentifier id) : base(clie _elasticSanClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string elasticSanApiVersion); _elasticSanRestClient = new ElasticSansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticSanApiVersion); - _privateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _privateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -95,23 +91,23 @@ 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 ElasticSanVolumeGroupResources in the ElasticSan. - /// An object representing collection of ElasticSanVolumeGroupResources and their operations over a ElasticSanVolumeGroupResource. - public virtual ElasticSanVolumeGroupCollection GetElasticSanVolumeGroups() + /// Gets a collection of ElasticSanPrivateEndpointConnectionResources in the ElasticSan. + /// An object representing collection of ElasticSanPrivateEndpointConnectionResources and their operations over a ElasticSanPrivateEndpointConnectionResource. + public virtual ElasticSanPrivateEndpointConnectionCollection GetElasticSanPrivateEndpointConnections() { - return GetCachedClient(client => new ElasticSanVolumeGroupCollection(client, Id)); + return GetCachedClient(client => new ElasticSanPrivateEndpointConnectionCollection(client, Id)); } /// - /// Get an VolumeGroups. + /// Gets the specified private endpoint connection associated with the Elastic San /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName} /// /// /// Operation Id - /// VolumeGroups_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -119,30 +115,30 @@ public virtual ElasticSanVolumeGroupCollection GetElasticSanVolumeGroups() /// /// /// Resource - /// + /// /// /// /// - /// The name of the VolumeGroup. + /// The name of the Private Endpoint connection. /// 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> GetElasticSanVolumeGroupAsync(string volumeGroupName, CancellationToken cancellationToken = default) + public virtual async Task> GetElasticSanPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { - return await GetElasticSanVolumeGroups().GetAsync(volumeGroupName, cancellationToken).ConfigureAwait(false); + return await GetElasticSanPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); } /// - /// Get an VolumeGroups. + /// Gets the specified private endpoint connection associated with the Elastic San /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName} /// /// /// Operation Id - /// VolumeGroups_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -150,37 +146,37 @@ public virtual async Task> GetElasticSan /// /// /// Resource - /// + /// /// /// /// - /// The name of the VolumeGroup. + /// The name of the Private Endpoint connection. /// 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 GetElasticSanVolumeGroup(string volumeGroupName, CancellationToken cancellationToken = default) + public virtual Response GetElasticSanPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { - return GetElasticSanVolumeGroups().Get(volumeGroupName, cancellationToken); + return GetElasticSanPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); } - /// Gets a collection of ElasticSanPrivateEndpointConnectionResources in the ElasticSan. - /// An object representing collection of ElasticSanPrivateEndpointConnectionResources and their operations over a ElasticSanPrivateEndpointConnectionResource. - public virtual ElasticSanPrivateEndpointConnectionCollection GetElasticSanPrivateEndpointConnections() + /// Gets a collection of VolumeGroupResources in the ElasticSan. + /// An object representing collection of VolumeGroupResources and their operations over a VolumeGroupResource. + public virtual VolumeGroupCollection GetVolumeGroups() { - return GetCachedClient(client => new ElasticSanPrivateEndpointConnectionCollection(client, Id)); + return GetCachedClient(client => new VolumeGroupCollection(client, Id)); } /// - /// Gets the specified private endpoint connection associated with the Elastic San + /// Get an VolumeGroups. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName} /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// VolumeGroup_Get /// /// /// Default Api Version @@ -188,30 +184,30 @@ public virtual ElasticSanPrivateEndpointConnectionCollection GetElasticSanPrivat /// /// /// Resource - /// + /// /// /// /// - /// The name of the Private Endpoint connection. + /// The name of the VolumeGroup. /// 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> GetElasticSanPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public virtual async Task> GetVolumeGroupAsync(string volumeGroupName, CancellationToken cancellationToken = default) { - return await GetElasticSanPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + return await GetVolumeGroups().GetAsync(volumeGroupName, cancellationToken).ConfigureAwait(false); } /// - /// Gets the specified private endpoint connection associated with the Elastic San + /// Get an VolumeGroups. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName} /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// VolumeGroup_Get /// /// /// Default Api Version @@ -219,18 +215,18 @@ public virtual async Task> /// /// /// Resource - /// + /// /// /// /// - /// The name of the Private Endpoint connection. + /// The name of the VolumeGroup. /// 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 GetElasticSanPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public virtual Response GetVolumeGroup(string volumeGroupName, CancellationToken cancellationToken = default) { - return GetElasticSanPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); + return GetVolumeGroups().Get(volumeGroupName, cancellationToken); } /// @@ -242,7 +238,7 @@ public virtual Response GetElasticS /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -282,7 +278,7 @@ public virtual async Task> GetAsync(CancellationTok /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -322,7 +318,7 @@ public virtual Response Get(CancellationToken cancellationTo /// /// /// Operation Id - /// ElasticSans_Delete + /// ElasticSan_Delete /// /// /// Default Api Version @@ -364,7 +360,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// ElasticSans_Delete + /// ElasticSan_Delete /// /// /// Default Api Version @@ -406,7 +402,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// ElasticSans_Update + /// ElasticSan_Update /// /// /// Default Api Version @@ -452,7 +448,7 @@ public virtual async Task> UpdateAsync(WaitUnti /// /// /// Operation Id - /// ElasticSans_Update + /// ElasticSan_Update /// /// /// Default Api Version @@ -498,20 +494,25 @@ public virtual ArmOperation Update(WaitUntil waitUntil, Elas /// /// /// Operation Id - /// PrivateLinkResources_ListByElasticSan + /// ElasticSans_ListByElasticSan /// /// /// Default Api Version /// 2024-07-01-preview /// + /// + /// Resource + /// + /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPrivateLinkResourcesAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetByElasticSanAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByElasticSanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => ElasticSanPrivateLinkResource.DeserializeElasticSanPrivateLinkResource(e), _privateLinkResourcesClientDiagnostics, Pipeline, "ElasticSanResource.GetPrivateLinkResources", "value", null, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanRestClient.CreateListByElasticSanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanRestClient.CreateListByElasticSanNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ElasticSanPrivateLinkResourceData.DeserializeElasticSanPrivateLinkResourceData(e), _elasticSanClientDiagnostics, Pipeline, "ElasticSanResource.GetByElasticSan", "value", "nextLink", cancellationToken); } /// @@ -523,20 +524,25 @@ public virtual AsyncPageable GetPrivateLinkResour /// /// /// Operation Id - /// PrivateLinkResources_ListByElasticSan + /// ElasticSans_ListByElasticSan /// /// /// Default Api Version /// 2024-07-01-preview /// + /// + /// Resource + /// + /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPrivateLinkResources(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetByElasticSan(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByElasticSanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => ElasticSanPrivateLinkResource.DeserializeElasticSanPrivateLinkResource(e), _privateLinkResourcesClientDiagnostics, Pipeline, "ElasticSanResource.GetPrivateLinkResources", "value", null, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanRestClient.CreateListByElasticSanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanRestClient.CreateListByElasticSanNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ElasticSanPrivateLinkResourceData.DeserializeElasticSanPrivateLinkResourceData(e), _elasticSanClientDiagnostics, Pipeline, "ElasticSanResource.GetByElasticSan", "value", "nextLink", cancellationToken); } /// @@ -548,7 +554,7 @@ public virtual Pageable GetPrivateLinkResources(C /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -610,7 +616,7 @@ public virtual async Task> AddTagAsync(string key, /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -672,7 +678,7 @@ public virtual Response AddTag(string key, string value, Can /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -729,7 +735,7 @@ public virtual async Task> SetTagsAsync(IDictionary /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -786,7 +792,7 @@ public virtual Response SetTags(IDictionary /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -846,7 +852,7 @@ public virtual async Task> RemoveTagAsync(string ke /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.Serialization.cs deleted file mode 100644 index f08c1e0c7b49..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.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.ElasticSan -{ - public partial class ElasticSanSnapshotResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ElasticSanSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticSanContext.Default); - - ElasticSanSnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticSanContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.Serialization.cs deleted file mode 100644 index 16f38b852ef4..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.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.ElasticSan -{ - public partial class ElasticSanVolumeGroupResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ElasticSanVolumeGroupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticSanContext.Default); - - ElasticSanVolumeGroupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticSanContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.Serialization.cs deleted file mode 100644 index b0231593dca2..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.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.ElasticSan -{ - public partial class ElasticSanVolumeResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ElasticSanVolumeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticSanContext.Default); - - ElasticSanVolumeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticSanContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs index a3518f9eb62c..562122bc43e2 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs @@ -53,79 +53,79 @@ public static ElasticSanResource GetElasticSanResource(this ArmClient client, Re } /// - /// 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 ElasticSanVolumeGroupResource GetElasticSanVolumeGroupResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ElasticSanPrivateEndpointConnectionResource GetElasticSanPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableElasticSanArmClient(client).GetElasticSanVolumeGroupResource(id); + return GetMockableElasticSanArmClient(client).GetElasticSanPrivateEndpointConnectionResource(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 ElasticSanVolumeResource GetElasticSanVolumeResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static VolumeGroupResource GetVolumeGroupResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableElasticSanArmClient(client).GetElasticSanVolumeResource(id); + return GetMockableElasticSanArmClient(client).GetVolumeGroupResource(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 ElasticSanPrivateEndpointConnectionResource GetElasticSanPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static VolumeResource GetVolumeResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableElasticSanArmClient(client).GetElasticSanPrivateEndpointConnectionResource(id); + return GetMockableElasticSanArmClient(client).GetVolumeResource(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 ElasticSanSnapshotResource GetElasticSanSnapshotResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static SnapshotResource GetSnapshotResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableElasticSanArmClient(client).GetElasticSanSnapshotResource(id); + return GetMockableElasticSanArmClient(client).GetSnapshotResource(id); } /// @@ -154,7 +154,7 @@ public static ElasticSanCollection GetElasticSans(this ResourceGroupResource res /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -192,7 +192,7 @@ public static async Task> GetElasticSanAsync(this R /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -222,141 +222,141 @@ public static Response GetElasticSan(this ResourceGroupResou } /// - /// List all the available Skus in the region and information related to them + /// Gets a list of ElasticSans in a subscription /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans /// /// /// Operation Id - /// Skus_List + /// ElasticSan_ListBySubscription /// /// /// Default Api Version /// 2024-07-01-preview /// + /// + /// Resource + /// + /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Specify $filter='location eq <location>' to filter on location. /// 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, string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetElasticSansAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetSkusAsync(filter, cancellationToken); + return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetElasticSansAsync(cancellationToken); } /// - /// List all the available Skus in the region and information related to them + /// Gets a list of ElasticSans in a subscription /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans /// /// /// Operation Id - /// Skus_List + /// ElasticSan_ListBySubscription /// /// /// Default Api Version /// 2024-07-01-preview /// + /// + /// Resource + /// + /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Specify $filter='location eq <location>' to filter on location. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetSkus(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetElasticSans(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetSkus(filter, cancellationToken); + return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetElasticSans(cancellationToken); } /// - /// Gets a list of ElasticSans in a subscription + /// List all the available Skus in the region and information related to them /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus /// /// /// Operation Id - /// ElasticSans_ListBySubscription + /// SkusOperationGroup_List /// /// /// Default Api Version /// 2024-07-01-preview /// - /// - /// Resource - /// - /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// Specify $filter='location eq <location>' to filter on location. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetElasticSansAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSkusOperationGroupsAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetElasticSansAsync(cancellationToken); + return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetSkusOperationGroupsAsync(filter, cancellationToken); } /// - /// Gets a list of ElasticSans in a subscription + /// List all the available Skus in the region and information related to them /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus /// /// /// Operation Id - /// ElasticSans_ListBySubscription + /// SkusOperationGroup_List /// /// /// Default Api Version /// 2024-07-01-preview /// - /// - /// Resource - /// - /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// Specify $filter='location eq <location>' to filter on location. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetElasticSans(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSkusOperationGroups(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetElasticSans(cancellationToken); + return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetSkusOperationGroups(filter, cancellationToken); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanArmClient.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanArmClient.cs index 618e620a71c7..74ab102e293f 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanArmClient.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanArmClient.cs @@ -47,51 +47,51 @@ public virtual ElasticSanResource GetElasticSanResource(ResourceIdentifier 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 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 ElasticSanVolumeGroupResource GetElasticSanVolumeGroupResource(ResourceIdentifier id) + /// Returns a object. + public virtual ElasticSanPrivateEndpointConnectionResource GetElasticSanPrivateEndpointConnectionResource(ResourceIdentifier id) { - ElasticSanVolumeGroupResource.ValidateResourceId(id); - return new ElasticSanVolumeGroupResource(Client, id); + ElasticSanPrivateEndpointConnectionResource.ValidateResourceId(id); + return new ElasticSanPrivateEndpointConnectionResource(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 ElasticSanVolumeResource GetElasticSanVolumeResource(ResourceIdentifier id) + /// Returns a object. + public virtual VolumeGroupResource GetVolumeGroupResource(ResourceIdentifier id) { - ElasticSanVolumeResource.ValidateResourceId(id); - return new ElasticSanVolumeResource(Client, id); + VolumeGroupResource.ValidateResourceId(id); + return new VolumeGroupResource(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 ElasticSanPrivateEndpointConnectionResource GetElasticSanPrivateEndpointConnectionResource(ResourceIdentifier id) + /// Returns a object. + public virtual VolumeResource GetVolumeResource(ResourceIdentifier id) { - ElasticSanPrivateEndpointConnectionResource.ValidateResourceId(id); - return new ElasticSanPrivateEndpointConnectionResource(Client, id); + VolumeResource.ValidateResourceId(id); + return new VolumeResource(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 ElasticSanSnapshotResource GetElasticSanSnapshotResource(ResourceIdentifier id) + /// Returns a object. + public virtual SnapshotResource GetSnapshotResource(ResourceIdentifier id) { - ElasticSanSnapshotResource.ValidateResourceId(id); - return new ElasticSanSnapshotResource(Client, id); + SnapshotResource.ValidateResourceId(id); + return new SnapshotResource(Client, id); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanResourceGroupResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanResourceGroupResource.cs index 58bcb51320ea..05dc7698d9a1 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanResourceGroupResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanResourceGroupResource.cs @@ -49,7 +49,7 @@ public virtual ElasticSanCollection GetElasticSans() /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version @@ -80,7 +80,7 @@ public virtual async Task> GetElasticSanAsync(strin /// /// /// Operation Id - /// ElasticSans_Get + /// ElasticSan_Get /// /// /// Default Api Version diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanSubscriptionResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanSubscriptionResource.cs index 1c9425fe60d5..9b67c36b2c29 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanSubscriptionResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanSubscriptionResource.cs @@ -16,10 +16,10 @@ namespace Azure.ResourceManager.ElasticSan.Mocking /// A class to add extension methods to SubscriptionResource. public partial class MockableElasticSanSubscriptionResource : ArmResource { - private ClientDiagnostics _skusClientDiagnostics; - private SkusRestOperations _skusRestClient; private ClientDiagnostics _elasticSanClientDiagnostics; private ElasticSansRestOperations _elasticSanRestClient; + private ClientDiagnostics _skusOperationGroupClientDiagnostics; + private SkusOperationGroupRestOperations _skusOperationGroupRestClient; /// Initializes a new instance of the class for mocking. protected MockableElasticSanSubscriptionResource() @@ -33,10 +33,10 @@ internal MockableElasticSanSubscriptionResource(ArmClient client, ResourceIdenti { } - private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics ElasticSanClientDiagnostics => _elasticSanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ElasticSanResource.ResourceType.Namespace, Diagnostics); private ElasticSansRestOperations ElasticSanRestClient => _elasticSanRestClient ??= new ElasticSansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ElasticSanResource.ResourceType)); + private ClientDiagnostics SkusOperationGroupClientDiagnostics => _skusOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SkusOperationGroupRestOperations SkusOperationGroupRestClient => _skusOperationGroupRestClient ??= new SkusOperationGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -45,115 +45,117 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// List all the available Skus in the region and information related to them + /// Gets a list of ElasticSans in a subscription /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans /// /// /// Operation Id - /// Skus_List + /// ElasticSan_ListBySubscription /// /// /// Default Api Version /// 2024-07-01-preview /// + /// + /// Resource + /// + /// /// /// - /// Specify $filter='location eq <location>' to filter on location. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSkusAsync(string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetElasticSansAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => ElasticSanSkuInformation.DeserializeElasticSanSkuInformation(e), SkusClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetSkus", "value", null, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticSanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticSanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticSanResource(Client, ElasticSanData.DeserializeElasticSanData(e)), ElasticSanClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetElasticSans", "value", "nextLink", cancellationToken); } /// - /// List all the available Skus in the region and information related to them + /// Gets a list of ElasticSans in a subscription /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans /// /// /// Operation Id - /// Skus_List + /// ElasticSan_ListBySubscription /// /// /// Default Api Version /// 2024-07-01-preview /// + /// + /// Resource + /// + /// /// /// - /// Specify $filter='location eq <location>' to filter on location. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSkus(string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetElasticSans(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => ElasticSanSkuInformation.DeserializeElasticSanSkuInformation(e), SkusClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetSkus", "value", null, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticSanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticSanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticSanResource(Client, ElasticSanData.DeserializeElasticSanData(e)), ElasticSanClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetElasticSans", "value", "nextLink", cancellationToken); } /// - /// Gets a list of ElasticSans in a subscription + /// List all the available Skus in the region and information related to them /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus /// /// /// Operation Id - /// ElasticSans_ListBySubscription + /// SkusOperationGroup_List /// /// /// Default Api Version /// 2024-07-01-preview /// - /// - /// Resource - /// - /// /// /// + /// Specify $filter='location eq <location>' to filter on location. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetElasticSansAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusOperationGroupsAsync(string filter = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticSanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticSanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticSanResource(Client, ElasticSanData.DeserializeElasticSanData(e)), ElasticSanClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetElasticSans", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusOperationGroupRestClient.CreateListRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusOperationGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ElasticSanSkuInformation.DeserializeElasticSanSkuInformation(e), SkusOperationGroupClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetSkusOperationGroups", "value", "nextLink", cancellationToken); } /// - /// Gets a list of ElasticSans in a subscription + /// List all the available Skus in the region and information related to them /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus /// /// /// Operation Id - /// ElasticSans_ListBySubscription + /// SkusOperationGroup_List /// /// /// Default Api Version /// 2024-07-01-preview /// - /// - /// Resource - /// - /// /// /// + /// Specify $filter='location eq <location>' to filter on location. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetElasticSans(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkusOperationGroups(string filter = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticSanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticSanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticSanResource(Client, ElasticSanData.DeserializeElasticSanData(e)), ElasticSanClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetElasticSans", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusOperationGroupRestClient.CreateListRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusOperationGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ElasticSanSkuInformation.DeserializeElasticSanSkuInformation(e), SkusOperationGroupClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetSkusOperationGroups", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanPrivateEndpointConnectionOperationSource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanPrivateEndpointConnectionOperationSource.cs deleted file mode 100644 index ddb958054f05..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanPrivateEndpointConnectionOperationSource.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.ElasticSan -{ - internal class ElasticSanPrivateEndpointConnectionOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal ElasticSanPrivateEndpointConnectionOperationSource(ArmClient client) - { - _client = client; - } - - ElasticSanPrivateEndpointConnectionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); - return new ElasticSanPrivateEndpointConnectionResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); - return await Task.FromResult(new ElasticSanPrivateEndpointConnectionResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanSnapshotOperationSource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanSnapshotOperationSource.cs deleted file mode 100644 index 93eda7bc5778..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanSnapshotOperationSource.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.ElasticSan -{ - internal class ElasticSanSnapshotOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal ElasticSanSnapshotOperationSource(ArmClient client) - { - _client = client; - } - - ElasticSanSnapshotResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); - return new ElasticSanSnapshotResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); - return await Task.FromResult(new ElasticSanSnapshotResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanVolumeGroupOperationSource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanVolumeGroupOperationSource.cs deleted file mode 100644 index 27261e68af2b..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanVolumeGroupOperationSource.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.ElasticSan -{ - internal class ElasticSanVolumeGroupOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal ElasticSanVolumeGroupOperationSource(ArmClient client) - { - _client = client; - } - - ElasticSanVolumeGroupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); - return new ElasticSanVolumeGroupResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); - return await Task.FromResult(new ElasticSanVolumeGroupResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanVolumeOperationSource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanVolumeOperationSource.cs deleted file mode 100644 index f625f9028b07..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanVolumeOperationSource.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.ElasticSan -{ - internal class ElasticSanVolumeOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal ElasticSanVolumeOperationSource(ArmClient client) - { - _client = client; - } - - ElasticSanVolumeResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); - return new ElasticSanVolumeResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); - return await Task.FromResult(new ElasticSanVolumeResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanPreValidationResultOperationSource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/PreValidationResultOperationSource.cs similarity index 50% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanPreValidationResultOperationSource.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/PreValidationResultOperationSource.cs index 3d223010fff6..244b497fd399 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanPreValidationResultOperationSource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/PreValidationResultOperationSource.cs @@ -13,18 +13,18 @@ namespace Azure.ResourceManager.ElasticSan { - internal class ElasticSanPreValidationResultOperationSource : IOperationSource + internal class PreValidationResultOperationSource : IOperationSource { - ElasticSanPreValidationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + PreValidationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - return ElasticSanPreValidationResult.DeserializeElasticSanPreValidationResult(document.RootElement); + return PreValidationResult.DeserializePreValidationResult(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - return ElasticSanPreValidationResult.DeserializeElasticSanPreValidationResult(document.RootElement); + return PreValidationResult.DeserializePreValidationResult(document.RootElement); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/VolumeGroupOperationSource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/VolumeGroupOperationSource.cs new file mode 100644 index 000000000000..81e2ed145074 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/VolumeGroupOperationSource.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.ElasticSan +{ + internal class VolumeGroupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal VolumeGroupOperationSource(ArmClient client) + { + _client = client; + } + + VolumeGroupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); + return new VolumeGroupResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); + return await Task.FromResult(new VolumeGroupResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/VolumeOperationSource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/VolumeOperationSource.cs new file mode 100644 index 000000000000..9642f970e641 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/VolumeOperationSource.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.ElasticSan +{ + internal class VolumeOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal VolumeOperationSource(ArmClient client) + { + _client = client; + } + + VolumeResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); + return new VolumeResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticSanContext.Default); + return await Task.FromResult(new VolumeResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/Action.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/Action.cs new file mode 100644 index 000000000000..dca233ebe6f2 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/Action.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// The action of virtual network rule. + public readonly partial struct Action : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Action(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AllowValue = "Allow"; + + /// Allow. + public static Action Allow { get; } = new Action(AllowValue); + /// Determines if two values are the same. + public static bool operator ==(Action left, Action right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Action left, Action right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Action(string value) => new Action(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Action other && Equals(other); + /// + public bool Equals(Action 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/AutoScaleProperties.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/AutoScaleProperties.Serialization.cs index 750ff6f8c4d4..c5c854a137e4 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/AutoScaleProperties.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/AutoScaleProperties.Serialization.cs @@ -76,7 +76,7 @@ internal static AutoScaleProperties DeserializeAutoScaleProperties(JsonElement e { return null; } - ElasticSanScaleUpProperties scaleUpProperties = default; + ScaleUpProperties scaleUpProperties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -87,7 +87,7 @@ internal static AutoScaleProperties DeserializeAutoScaleProperties(JsonElement e { continue; } - scaleUpProperties = ElasticSanScaleUpProperties.DeserializeElasticSanScaleUpProperties(property.Value, options); + scaleUpProperties = ScaleUpProperties.DeserializeScaleUpProperties(property.Value, options); continue; } if (options.Format != "W") diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/AutoScaleProperties.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/AutoScaleProperties.cs index 0e27090d64ac..891f9eb25737 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/AutoScaleProperties.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/AutoScaleProperties.cs @@ -53,13 +53,13 @@ public AutoScaleProperties() /// Initializes a new instance of . /// Scale up settings on Elastic San Appliance. /// Keeps track of any properties unknown to the library. - internal AutoScaleProperties(ElasticSanScaleUpProperties scaleUpProperties, IDictionary serializedAdditionalRawData) + internal AutoScaleProperties(ScaleUpProperties scaleUpProperties, IDictionary serializedAdditionalRawData) { ScaleUpProperties = scaleUpProperties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Scale up settings on Elastic San Appliance. - public ElasticSanScaleUpProperties ScaleUpProperties { get; set; } + public ScaleUpProperties ScaleUpProperties { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteRetentionPolicy.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DeleteRetentionPolicy.Serialization.cs similarity index 64% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteRetentionPolicy.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DeleteRetentionPolicy.Serialization.cs index d3a4e15ac13c..45c3285e218f 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteRetentionPolicy.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DeleteRetentionPolicy.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanDeleteRetentionPolicy : IUtf8JsonSerializable, IJsonModel + public partial class DeleteRetentionPolicy : 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(ElasticSanDeleteRetentionPolicy)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DeleteRetentionPolicy)} does not support writing '{format}' format."); } if (Optional.IsDefined(PolicyState)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanDeleteRetentionPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DeleteRetentionPolicy 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(ElasticSanDeleteRetentionPolicy)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DeleteRetentionPolicy)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanDeleteRetentionPolicy(document.RootElement, options); + return DeserializeDeleteRetentionPolicy(document.RootElement, options); } - internal static ElasticSanDeleteRetentionPolicy DeserializeElasticSanDeleteRetentionPolicy(JsonElement element, ModelReaderWriterOptions options = null) + internal static DeleteRetentionPolicy DeserializeDeleteRetentionPolicy(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,7 +81,7 @@ internal static ElasticSanDeleteRetentionPolicy DeserializeElasticSanDeleteReten { return null; } - ElasticSanDeleteRetentionPolicyState? policyState = default; + PolicyState? policyState = default; int? retentionPeriodDays = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -93,7 +93,7 @@ internal static ElasticSanDeleteRetentionPolicy DeserializeElasticSanDeleteReten { continue; } - policyState = new ElasticSanDeleteRetentionPolicyState(property.Value.GetString()); + policyState = new PolicyState(property.Value.GetString()); continue; } if (property.NameEquals("retentionPeriodDays"u8)) @@ -111,38 +111,38 @@ internal static ElasticSanDeleteRetentionPolicy DeserializeElasticSanDeleteReten } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanDeleteRetentionPolicy(policyState, retentionPeriodDays, serializedAdditionalRawData); + return new DeleteRetentionPolicy(policyState, retentionPeriodDays, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanDeleteRetentionPolicy)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeleteRetentionPolicy)} does not support writing '{options.Format}' format."); } } - ElasticSanDeleteRetentionPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DeleteRetentionPolicy 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 DeserializeElasticSanDeleteRetentionPolicy(document.RootElement, options); + return DeserializeDeleteRetentionPolicy(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanDeleteRetentionPolicy)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeleteRetentionPolicy)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteRetentionPolicy.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DeleteRetentionPolicy.cs similarity index 80% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteRetentionPolicy.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DeleteRetentionPolicy.cs index 02f82d7a4dc7..a228c0473d95 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteRetentionPolicy.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DeleteRetentionPolicy.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// Response for Delete Retention Policy object. - public partial class ElasticSanDeleteRetentionPolicy + public partial class DeleteRetentionPolicy { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ElasticSanDeleteRetentionPolicy /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanDeleteRetentionPolicy() + /// Initializes a new instance of . + public DeleteRetentionPolicy() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// /// The number of days to retain the resources after deletion. /// Keeps track of any properties unknown to the library. - internal ElasticSanDeleteRetentionPolicy(ElasticSanDeleteRetentionPolicyState? policyState, int? retentionPeriodDays, IDictionary serializedAdditionalRawData) + internal DeleteRetentionPolicy(PolicyState? policyState, int? retentionPeriodDays, IDictionary serializedAdditionalRawData) { PolicyState = policyState; RetentionPeriodDays = retentionPeriodDays; @@ -62,7 +62,7 @@ internal ElasticSanDeleteRetentionPolicy(ElasticSanDeleteRetentionPolicyState? p } /// Gets or sets the policy state. - public ElasticSanDeleteRetentionPolicyState? PolicyState { get; set; } + public PolicyState? PolicyState { get; set; } /// The number of days to retain the resources after deletion. public int? RetentionPeriodDays { get; set; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DeleteType.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DeleteType.cs new file mode 100644 index 000000000000..679e221e6698 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DeleteType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// The DeleteType. + public readonly partial struct DeleteType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeleteType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PermanentValue = "permanent"; + + /// permanent. + public static DeleteType Permanent { get; } = new DeleteType(PermanentValue); + /// Determines if two values are the same. + public static bool operator ==(DeleteType left, DeleteType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeleteType left, DeleteType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DeleteType(string value) => new DeleteType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeleteType other && Equals(other); + /// + public bool Equals(DeleteType 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotListContent.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotList.Serialization.cs similarity index 70% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotListContent.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotList.Serialization.cs index 6f8aef4ba99b..c3d5ce7554c0 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotListContent.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotList.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class DiskSnapshotListContent : IUtf8JsonSerializable, IJsonModel + public partial class DiskSnapshotList : 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, ModelReade /// 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(DiskSnapshotListContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DiskSnapshotList)} does not support writing '{format}' format."); } writer.WritePropertyName("diskSnapshotIds"u8); @@ -63,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DiskSnapshotListContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DiskSnapshotList 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(DiskSnapshotListContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DiskSnapshotList)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDiskSnapshotListContent(document.RootElement, options); + return DeserializeDiskSnapshotList(document.RootElement, options); } - internal static DiskSnapshotListContent DeserializeDiskSnapshotListContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static DiskSnapshotList DeserializeDiskSnapshotList(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -111,38 +111,38 @@ internal static DiskSnapshotListContent DeserializeDiskSnapshotListContent(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new DiskSnapshotListContent(diskSnapshotIds, serializedAdditionalRawData); + return new DiskSnapshotList(diskSnapshotIds, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(DiskSnapshotListContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DiskSnapshotList)} does not support writing '{options.Format}' format."); } } - DiskSnapshotListContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DiskSnapshotList 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 DeserializeDiskSnapshotListContent(document.RootElement, options); + return DeserializeDiskSnapshotList(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(DiskSnapshotListContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DiskSnapshotList)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotListContent.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotList.cs similarity index 85% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotListContent.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotList.cs index b02c657468dd..e6137a4310d3 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotListContent.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/DiskSnapshotList.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// object to hold array of Disk Snapshot ARM IDs. - public partial class DiskSnapshotListContent + public partial class DiskSnapshotList { /// /// Keeps track of any properties unknown to the library. @@ -47,27 +47,27 @@ public partial class DiskSnapshotListContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// array of DiskSnapshot ARM IDs. /// is null. - public DiskSnapshotListContent(IEnumerable diskSnapshotIds) + public DiskSnapshotList(IEnumerable diskSnapshotIds) { Argument.AssertNotNull(diskSnapshotIds, nameof(diskSnapshotIds)); DiskSnapshotIds = diskSnapshotIds.ToList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// array of DiskSnapshot ARM IDs. /// Keeps track of any properties unknown to the library. - internal DiskSnapshotListContent(IList diskSnapshotIds, IDictionary serializedAdditionalRawData) + internal DiskSnapshotList(IList diskSnapshotIds, IDictionary serializedAdditionalRawData) { DiskSnapshotIds = diskSnapshotIds; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal DiskSnapshotListContent() + /// Initializes a new instance of for deserialization. + internal DiskSnapshotList() { } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanAccessSoftDeletedVolume.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanAccessSoftDeletedVolume.cs deleted file mode 100644 index 435f0758eb1a..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanAccessSoftDeletedVolume.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.ElasticSan.Models -{ - /// The ElasticSanAccessSoftDeletedVolume. - public readonly partial struct ElasticSanAccessSoftDeletedVolume : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticSanAccessSoftDeletedVolume(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TrueValue = "true"; - private const string FalseValue = "false"; - - /// true. - public static ElasticSanAccessSoftDeletedVolume True { get; } = new ElasticSanAccessSoftDeletedVolume(TrueValue); - /// false. - public static ElasticSanAccessSoftDeletedVolume False { get; } = new ElasticSanAccessSoftDeletedVolume(FalseValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanAccessSoftDeletedVolume left, ElasticSanAccessSoftDeletedVolume right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanAccessSoftDeletedVolume left, ElasticSanAccessSoftDeletedVolume right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanAccessSoftDeletedVolume(string value) => new ElasticSanAccessSoftDeletedVolume(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanAccessSoftDeletedVolume other && Equals(other); - /// - public bool Equals(ElasticSanAccessSoftDeletedVolume 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteRetentionPolicyState.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteRetentionPolicyState.cs deleted file mode 100644 index b511a9c6bc72..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteRetentionPolicyState.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.ElasticSan.Models -{ - /// The ElasticSanDeleteRetentionPolicyState. - public readonly partial struct ElasticSanDeleteRetentionPolicyState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticSanDeleteRetentionPolicyState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// Enabled. - public static ElasticSanDeleteRetentionPolicyState Enabled { get; } = new ElasticSanDeleteRetentionPolicyState(EnabledValue); - /// Disabled. - public static ElasticSanDeleteRetentionPolicyState Disabled { get; } = new ElasticSanDeleteRetentionPolicyState(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanDeleteRetentionPolicyState left, ElasticSanDeleteRetentionPolicyState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanDeleteRetentionPolicyState left, ElasticSanDeleteRetentionPolicyState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanDeleteRetentionPolicyState(string value) => new ElasticSanDeleteRetentionPolicyState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanDeleteRetentionPolicyState other && Equals(other); - /// - public bool Equals(ElasticSanDeleteRetentionPolicyState 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteSnapshotsUnderVolume.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteSnapshotsUnderVolume.cs deleted file mode 100644 index 4404f4e89640..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteSnapshotsUnderVolume.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.ElasticSan.Models -{ - /// The ElasticSanDeleteSnapshotsUnderVolume. - public readonly partial struct ElasticSanDeleteSnapshotsUnderVolume : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticSanDeleteSnapshotsUnderVolume(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TrueValue = "true"; - private const string FalseValue = "false"; - - /// true. - public static ElasticSanDeleteSnapshotsUnderVolume True { get; } = new ElasticSanDeleteSnapshotsUnderVolume(TrueValue); - /// false. - public static ElasticSanDeleteSnapshotsUnderVolume False { get; } = new ElasticSanDeleteSnapshotsUnderVolume(FalseValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanDeleteSnapshotsUnderVolume left, ElasticSanDeleteSnapshotsUnderVolume right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanDeleteSnapshotsUnderVolume left, ElasticSanDeleteSnapshotsUnderVolume right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanDeleteSnapshotsUnderVolume(string value) => new ElasticSanDeleteSnapshotsUnderVolume(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanDeleteSnapshotsUnderVolume other && Equals(other); - /// - public bool Equals(ElasticSanDeleteSnapshotsUnderVolume 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteType.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteType.cs deleted file mode 100644 index 16b1e95369df..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanDeleteType.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ElasticSan.Models -{ - /// The ElasticSanDeleteType. - public readonly partial struct ElasticSanDeleteType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticSanDeleteType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PermanentValue = "permanent"; - - /// permanent. - public static ElasticSanDeleteType Permanent { get; } = new ElasticSanDeleteType(PermanentValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanDeleteType left, ElasticSanDeleteType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanDeleteType left, ElasticSanDeleteType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanDeleteType(string value) => new ElasticSanDeleteType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanDeleteType other && Equals(other); - /// - public bool Equals(ElasticSanDeleteType 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanForceDeleteVolume.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanForceDeleteVolume.cs deleted file mode 100644 index 1367624e9b68..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanForceDeleteVolume.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.ElasticSan.Models -{ - /// The ElasticSanForceDeleteVolume. - public readonly partial struct ElasticSanForceDeleteVolume : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticSanForceDeleteVolume(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TrueValue = "true"; - private const string FalseValue = "false"; - - /// true. - public static ElasticSanForceDeleteVolume True { get; } = new ElasticSanForceDeleteVolume(TrueValue); - /// false. - public static ElasticSanForceDeleteVolume False { get; } = new ElasticSanForceDeleteVolume(FalseValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanForceDeleteVolume left, ElasticSanForceDeleteVolume right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanForceDeleteVolume left, ElasticSanForceDeleteVolume right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanForceDeleteVolume(string value) => new ElasticSanForceDeleteVolume(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanForceDeleteVolume other && Equals(other); - /// - public bool Equals(ElasticSanForceDeleteVolume 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanList.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanList.Serialization.cs index b9c3227e5896..a48cf50393a2 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanList.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanList.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ElasticSanList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,17 +84,13 @@ internal static ElasticSanList DeserializeElasticSanList(JsonElement element, Mo return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +101,11 @@ internal static ElasticSanList DeserializeElasticSanList(JsonElement element, Mo } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +114,7 @@ internal static ElasticSanList DeserializeElasticSanList(JsonElement element, Mo } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ElasticSanList(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanList.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanList.cs index 32ad1dbf4f2b..ec6759b54f48 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanList.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ElasticSan.Models { @@ -46,25 +47,34 @@ internal partial class ElasticSanList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ElasticSanList() + /// The ElasticSan items on this page. + /// is null. + internal ElasticSanList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// An array of Elastic San objects. - /// URI to fetch the next section of the paginated response. + /// The ElasticSan items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ElasticSanList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ElasticSanList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// An array of Elastic San objects. + /// Initializes a new instance of for deserialization. + internal ElasticSanList() + { + } + + /// The ElasticSan items on this page. public IReadOnlyList Value { get; } - /// URI to fetch the next section of the paginated response. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.Serialization.cs index f55c71aae6a5..9eaa9d5f0107 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.Serialization.cs @@ -108,7 +108,7 @@ internal static ElasticSanPatch DeserializeElasticSanPatch(JsonElement element, IDictionary tags = default; long? baseSizeTiB = default; long? extendedCapacitySizeTiB = default; - ElasticSanPublicNetworkAccess? publicNetworkAccess = default; + PublicNetworkAccess? publicNetworkAccess = default; AutoScaleProperties autoScaleProperties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -161,7 +161,7 @@ internal static ElasticSanPatch DeserializeElasticSanPatch(JsonElement element, { continue; } - publicNetworkAccess = new ElasticSanPublicNetworkAccess(property0.Value.GetString()); + publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } if (property0.NameEquals("autoScaleProperties"u8)) @@ -183,11 +183,11 @@ internal static ElasticSanPatch DeserializeElasticSanPatch(JsonElement element, } serializedAdditionalRawData = rawDataDictionary; return new ElasticSanPatch( - tags ?? new ChangeTrackingDictionary(), baseSizeTiB, extendedCapacitySizeTiB, publicNetworkAccess, autoScaleProperties, + tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.cs index 1ca15a613f0c..0fc9bf1c5345 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.cs @@ -52,34 +52,32 @@ public ElasticSanPatch() } /// Initializes a new instance of . - /// Update tags. /// Base size of the Elastic San appliance in TiB. /// Extended size of the Elastic San appliance in TiB. /// Allow or disallow public network access to ElasticSan Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. /// Auto Scale Properties for Elastic San Appliance. + /// Update tags. /// Keeps track of any properties unknown to the library. - internal ElasticSanPatch(IDictionary tags, long? baseSizeTiB, long? extendedCapacitySizeTiB, ElasticSanPublicNetworkAccess? publicNetworkAccess, AutoScaleProperties autoScaleProperties, IDictionary serializedAdditionalRawData) + internal ElasticSanPatch(long? baseSizeTiB, long? extendedCapacitySizeTiB, PublicNetworkAccess? publicNetworkAccess, AutoScaleProperties autoScaleProperties, IDictionary tags, IDictionary serializedAdditionalRawData) { - Tags = tags; BaseSizeTiB = baseSizeTiB; ExtendedCapacitySizeTiB = extendedCapacitySizeTiB; PublicNetworkAccess = publicNetworkAccess; AutoScaleProperties = autoScaleProperties; + Tags = tags; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Update tags. - public IDictionary Tags { get; } /// Base size of the Elastic San appliance in TiB. public long? BaseSizeTiB { get; set; } /// Extended size of the Elastic San appliance in TiB. public long? ExtendedCapacitySizeTiB { get; set; } /// Allow or disallow public network access to ElasticSan Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. - public ElasticSanPublicNetworkAccess? PublicNetworkAccess { get; set; } + public PublicNetworkAccess? PublicNetworkAccess { get; set; } /// Auto Scale Properties for Elastic San Appliance. internal AutoScaleProperties AutoScaleProperties { get; set; } /// Scale up settings on Elastic San Appliance. - public ElasticSanScaleUpProperties ScaleUpProperties + public ScaleUpProperties ScaleUpProperties { get => AutoScaleProperties is null ? default : AutoScaleProperties.ScaleUpProperties; set @@ -89,5 +87,8 @@ public ElasticSanScaleUpProperties ScaleUpProperties AutoScaleProperties.ScaleUpProperties = value; } } + + /// Update tags. + public IDictionary Tags { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateEndpointConnectionListResult.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateEndpointConnectionListResult.Serialization.cs index 5d19f771dad5..564c01eadd05 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateEndpointConnectionListResult.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ElasticSanPrivateEndpointConnectionListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,17 +84,13 @@ internal static ElasticSanPrivateEndpointConnectionListResult DeserializeElastic return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +101,11 @@ internal static ElasticSanPrivateEndpointConnectionListResult DeserializeElastic } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +114,7 @@ internal static ElasticSanPrivateEndpointConnectionListResult DeserializeElastic } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanPrivateEndpointConnectionListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ElasticSanPrivateEndpointConnectionListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateEndpointConnectionListResult.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateEndpointConnectionListResult.cs index 8accdcaa8752..d3c6f2969bcd 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateEndpointConnectionListResult.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateEndpointConnectionListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ElasticSan.Models { - /// List of private endpoint connections associated with SAN. + /// The response of a PrivateEndpointConnection list operation. internal partial class ElasticSanPrivateEndpointConnectionListResult { /// @@ -46,25 +47,34 @@ internal partial class ElasticSanPrivateEndpointConnectionListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ElasticSanPrivateEndpointConnectionListResult() + /// The PrivateEndpointConnection items on this page. + /// is null. + internal ElasticSanPrivateEndpointConnectionListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Array of private endpoint connections. - /// URI to fetch the next section of the paginated response. + /// The PrivateEndpointConnection items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ElasticSanPrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ElasticSanPrivateEndpointConnectionListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Array of private endpoint connections. + /// Initializes a new instance of for deserialization. + internal ElasticSanPrivateEndpointConnectionListResult() + { + } + + /// The PrivateEndpointConnection items on this page. public IReadOnlyList Value { get; } - /// URI to fetch the next section of the paginated response. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResource.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceData.Serialization.cs similarity index 79% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResource.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceData.Serialization.cs index ba3799c01268..78280681551f 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResource.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceData.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanPrivateLinkResource : IUtf8JsonSerializable, IJsonModel + public partial class ElasticSanPrivateLinkResourceData : 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, Mode /// 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(ElasticSanPrivateLinkResource)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ElasticSanPrivateLinkResourceData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -66,19 +66,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteEndObject(); } - ElasticSanPrivateLinkResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ElasticSanPrivateLinkResourceData 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(ElasticSanPrivateLinkResource)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ElasticSanPrivateLinkResourceData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanPrivateLinkResource(document.RootElement, options); + return DeserializeElasticSanPrivateLinkResourceData(document.RootElement, options); } - internal static ElasticSanPrivateLinkResource DeserializeElasticSanPrivateLinkResource(JsonElement element, ModelReaderWriterOptions options = null) + internal static ElasticSanPrivateLinkResourceData DeserializeElasticSanPrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -92,7 +92,7 @@ internal static ElasticSanPrivateLinkResource DeserializeElasticSanPrivateLinkRe SystemData systemData = default; string groupId = default; IReadOnlyList requiredMembers = default; - IList requiredZoneNames = default; + IReadOnlyList requiredZoneNames = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -172,7 +172,7 @@ internal static ElasticSanPrivateLinkResource DeserializeElasticSanPrivateLinkRe } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanPrivateLinkResource( + return new ElasticSanPrivateLinkResourceData( id, name, type, @@ -183,35 +183,35 @@ internal static ElasticSanPrivateLinkResource DeserializeElasticSanPrivateLinkRe 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanPrivateLinkResource)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticSanPrivateLinkResourceData)} does not support writing '{options.Format}' format."); } } - ElasticSanPrivateLinkResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ElasticSanPrivateLinkResourceData 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 DeserializeElasticSanPrivateLinkResource(document.RootElement, options); + return DeserializeElasticSanPrivateLinkResourceData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanPrivateLinkResource)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticSanPrivateLinkResourceData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceData.cs similarity index 83% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResource.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceData.cs index f1c94b9465f5..254ce9c769b7 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceData.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// A private link resource. - public partial class ElasticSanPrivateLinkResource : ResourceData + public partial class ElasticSanPrivateLinkResourceData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -47,14 +47,14 @@ public partial class ElasticSanPrivateLinkResource : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanPrivateLinkResource() + /// Initializes a new instance of . + internal ElasticSanPrivateLinkResourceData() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -63,7 +63,7 @@ public ElasticSanPrivateLinkResource() /// The private link resource required member names. /// The private link resource Private link DNS zone name. /// Keeps track of any properties unknown to the library. - internal ElasticSanPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ElasticSanPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { GroupId = groupId; RequiredMembers = requiredMembers; @@ -76,6 +76,6 @@ internal ElasticSanPrivateLinkResource(ResourceIdentifier id, string name, Resou /// The private link resource required member names. public IReadOnlyList RequiredMembers { get; } /// The private link resource Private link DNS zone name. - public IList RequiredZoneNames { get; } + public IReadOnlyList RequiredZoneNames { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceListResult.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceListResult.Serialization.cs index 13d6505c996f..3cf959f75fe6 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceListResult.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ElasticSanPrivateLinkResourceListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -86,29 +83,29 @@ internal static ElasticSanPrivateLinkResourceListResult DeserializeElasticSanPri { return null; } - IReadOnlyList value = default; - string nextLink = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ElasticSanPrivateLinkResource.DeserializeElasticSanPrivateLinkResource(item, options)); + array.Add(ElasticSanPrivateLinkResourceData.DeserializeElasticSanPrivateLinkResourceData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +114,7 @@ internal static ElasticSanPrivateLinkResourceListResult DeserializeElasticSanPri } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ElasticSanPrivateLinkResourceListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceListResult.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceListResult.cs index 6c03b2686ebf..cfb15a0d58bb 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceListResult.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPrivateLinkResourceListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ElasticSan.Models { - /// A list of private link resources. + /// Paged collection of PrivateLinkResource items. internal partial class ElasticSanPrivateLinkResourceListResult { /// @@ -46,25 +47,34 @@ internal partial class ElasticSanPrivateLinkResourceListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ElasticSanPrivateLinkResourceListResult() + /// The PrivateLinkResource items on this page. + /// is null. + internal ElasticSanPrivateLinkResourceListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Array of private link resources. - /// URI to fetch the next section of the paginated response. + /// The PrivateLinkResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ElasticSanPrivateLinkResourceListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ElasticSanPrivateLinkResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Array of private link resources. - public IReadOnlyList Value { get; } - /// URI to fetch the next section of the paginated response. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal ElasticSanPrivateLinkResourceListResult() + { + } + + /// The PrivateLinkResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanProvisioningState.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanProvisioningState.cs deleted file mode 100644 index b747c2f17eea..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanProvisioningState.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ElasticSan.Models -{ - /// Provisioning state of the iSCSI Target. - public readonly partial struct ElasticSanProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticSanProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string InvalidValue = "Invalid"; - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CanceledValue = "Canceled"; - private const string PendingValue = "Pending"; - private const string CreatingValue = "Creating"; - private const string UpdatingValue = "Updating"; - private const string DeletingValue = "Deleting"; - private const string DeletedValue = "Deleted"; - private const string RestoringValue = "Restoring"; - private const string SoftDeletingValue = "SoftDeleting"; - - /// Invalid. - public static ElasticSanProvisioningState Invalid { get; } = new ElasticSanProvisioningState(InvalidValue); - /// Succeeded. - public static ElasticSanProvisioningState Succeeded { get; } = new ElasticSanProvisioningState(SucceededValue); - /// Failed. - public static ElasticSanProvisioningState Failed { get; } = new ElasticSanProvisioningState(FailedValue); - /// Canceled. - public static ElasticSanProvisioningState Canceled { get; } = new ElasticSanProvisioningState(CanceledValue); - /// Pending. - public static ElasticSanProvisioningState Pending { get; } = new ElasticSanProvisioningState(PendingValue); - /// Creating. - public static ElasticSanProvisioningState Creating { get; } = new ElasticSanProvisioningState(CreatingValue); - /// Updating. - public static ElasticSanProvisioningState Updating { get; } = new ElasticSanProvisioningState(UpdatingValue); - /// Deleting. - public static ElasticSanProvisioningState Deleting { get; } = new ElasticSanProvisioningState(DeletingValue); - /// Deleted. - public static ElasticSanProvisioningState Deleted { get; } = new ElasticSanProvisioningState(DeletedValue); - /// Restoring. - public static ElasticSanProvisioningState Restoring { get; } = new ElasticSanProvisioningState(RestoringValue); - /// SoftDeleting. - public static ElasticSanProvisioningState SoftDeleting { get; } = new ElasticSanProvisioningState(SoftDeletingValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanProvisioningState left, ElasticSanProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanProvisioningState left, ElasticSanProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanProvisioningState(string value) => new ElasticSanProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanProvisioningState other && Equals(other); - /// - public bool Equals(ElasticSanProvisioningState 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPublicNetworkAccess.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPublicNetworkAccess.cs deleted file mode 100644 index 6753dc117b23..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPublicNetworkAccess.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.ElasticSan.Models -{ - /// Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. - public readonly partial struct ElasticSanPublicNetworkAccess : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticSanPublicNetworkAccess(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// Enabled. - public static ElasticSanPublicNetworkAccess Enabled { get; } = new ElasticSanPublicNetworkAccess(EnabledValue); - /// Disabled. - public static ElasticSanPublicNetworkAccess Disabled { get; } = new ElasticSanPublicNetworkAccess(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanPublicNetworkAccess left, ElasticSanPublicNetworkAccess right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanPublicNetworkAccess left, ElasticSanPublicNetworkAccess right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanPublicNetworkAccess(string value) => new ElasticSanPublicNetworkAccess(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanPublicNetworkAccess other && Equals(other); - /// - public bool Equals(ElasticSanPublicNetworkAccess 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformation.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformation.Serialization.cs index f952894fc350..dda0c7088482 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformation.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformation.Serialization.cs @@ -117,8 +117,8 @@ internal static ElasticSanSkuInformation DeserializeElasticSanSkuInformation(Jso ElasticSanSkuTier? tier = default; string resourceType = default; IReadOnlyList locations = default; - IReadOnlyList locationInfo = default; - IReadOnlyList capabilities = default; + IReadOnlyList locationInfo = default; + IReadOnlyList capabilities = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -162,10 +162,10 @@ internal static ElasticSanSkuInformation DeserializeElasticSanSkuInformation(Jso { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ElasticSanSkuLocationInfo.DeserializeElasticSanSkuLocationInfo(item, options)); + array.Add(SkuLocationInfo.DeserializeSkuLocationInfo(item, options)); } locationInfo = array; continue; @@ -176,10 +176,10 @@ internal static ElasticSanSkuInformation DeserializeElasticSanSkuInformation(Jso { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ElasticSanSkuCapability.DeserializeElasticSanSkuCapability(item, options)); + array.Add(SKUCapability.DeserializeSKUCapability(item, options)); } capabilities = array; continue; @@ -195,8 +195,8 @@ internal static ElasticSanSkuInformation DeserializeElasticSanSkuInformation(Jso tier, resourceType, locations ?? new ChangeTrackingList(), - locationInfo ?? new ChangeTrackingList(), - capabilities ?? new ChangeTrackingList(), + locationInfo ?? new ChangeTrackingList(), + capabilities ?? new ChangeTrackingList(), serializedAdditionalRawData); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformation.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformation.cs index 6631b75ea77e..6e5666143645 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformation.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformation.cs @@ -51,8 +51,8 @@ internal ElasticSanSkuInformation(ElasticSanSkuName name) { Name = name; Locations = new ChangeTrackingList(); - LocationInfo = new ChangeTrackingList(); - Capabilities = new ChangeTrackingList(); + LocationInfo = new ChangeTrackingList(); + Capabilities = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -63,7 +63,7 @@ internal ElasticSanSkuInformation(ElasticSanSkuName name) /// Availability of the SKU for the location/zone. /// The capability information in the specified SKU. /// Keeps track of any properties unknown to the library. - internal ElasticSanSkuInformation(ElasticSanSkuName name, ElasticSanSkuTier? tier, string resourceType, IReadOnlyList locations, IReadOnlyList locationInfo, IReadOnlyList capabilities, IDictionary serializedAdditionalRawData) + internal ElasticSanSkuInformation(ElasticSanSkuName name, ElasticSanSkuTier? tier, string resourceType, IReadOnlyList locations, IReadOnlyList locationInfo, IReadOnlyList capabilities, IDictionary serializedAdditionalRawData) { Name = name; Tier = tier; @@ -88,8 +88,8 @@ internal ElasticSanSkuInformation() /// The set of locations that the SKU is available. This will be supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). public IReadOnlyList Locations { get; } /// Availability of the SKU for the location/zone. - public IReadOnlyList LocationInfo { get; } + public IReadOnlyList LocationInfo { get; } /// The capability information in the specified SKU. - public IReadOnlyList Capabilities { get; } + public IReadOnlyList Capabilities { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuName.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuName.cs index f5cdf447ecb0..8db41c95dc03 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuName.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuName.cs @@ -22,13 +22,13 @@ public ElasticSanSkuName(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string PremiumLrsValue = "Premium_LRS"; - private const string PremiumZrsValue = "Premium_ZRS"; + private const string PremiumLRSValue = "Premium_LRS"; + private const string PremiumZRSValue = "Premium_ZRS"; /// Premium locally redundant storage. - public static ElasticSanSkuName PremiumLrs { get; } = new ElasticSanSkuName(PremiumLrsValue); + public static ElasticSanSkuName PremiumLRS { get; } = new ElasticSanSkuName(PremiumLRSValue); /// Premium zone redundant storage. - public static ElasticSanSkuName PremiumZrs { get; } = new ElasticSanSkuName(PremiumZrsValue); + public static ElasticSanSkuName PremiumZRS { get; } = new ElasticSanSkuName(PremiumZRSValue); /// Determines if two values are the same. public static bool operator ==(ElasticSanSkuName left, ElasticSanSkuName right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanStorageTargetType.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanStorageTargetType.cs deleted file mode 100644 index 2fa0a279f0e4..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanStorageTargetType.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.ElasticSan.Models -{ - /// Storage Target type. - public readonly partial struct ElasticSanStorageTargetType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticSanStorageTargetType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string IscsiValue = "Iscsi"; - private const string NoneValue = "None"; - - /// Iscsi. - public static ElasticSanStorageTargetType Iscsi { get; } = new ElasticSanStorageTargetType(IscsiValue); - /// None. - public static ElasticSanStorageTargetType None { get; } = new ElasticSanStorageTargetType(NoneValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanStorageTargetType left, ElasticSanStorageTargetType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanStorageTargetType left, ElasticSanStorageTargetType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanStorageTargetType(string value) => new ElasticSanStorageTargetType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanStorageTargetType other && Equals(other); - /// - public bool Equals(ElasticSanStorageTargetType 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRuleAction.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRuleAction.cs deleted file mode 100644 index 291d3226cc65..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRuleAction.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ElasticSan.Models -{ - /// The action of virtual network rule. - public readonly partial struct ElasticSanVirtualNetworkRuleAction : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticSanVirtualNetworkRuleAction(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AllowValue = "Allow"; - - /// Allow. - public static ElasticSanVirtualNetworkRuleAction Allow { get; } = new ElasticSanVirtualNetworkRuleAction(AllowValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanVirtualNetworkRuleAction left, ElasticSanVirtualNetworkRuleAction right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanVirtualNetworkRuleAction left, ElasticSanVirtualNetworkRuleAction right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanVirtualNetworkRuleAction(string value) => new ElasticSanVirtualNetworkRuleAction(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanVirtualNetworkRuleAction other && Equals(other); - /// - public bool Equals(ElasticSanVirtualNetworkRuleAction 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeCreateOption.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeCreateOption.cs deleted file mode 100644 index bf881c17b286..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeCreateOption.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.ElasticSan.Models -{ - /// This enumerates the possible sources of a volume creation. - public readonly partial struct ElasticSanVolumeCreateOption : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticSanVolumeCreateOption(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NoneValue = "None"; - private const string VolumeSnapshotValue = "VolumeSnapshot"; - private const string DiskSnapshotValue = "DiskSnapshot"; - private const string DiskValue = "Disk"; - private const string DiskRestorePointValue = "DiskRestorePoint"; - - /// None. - public static ElasticSanVolumeCreateOption None { get; } = new ElasticSanVolumeCreateOption(NoneValue); - /// VolumeSnapshot. - public static ElasticSanVolumeCreateOption VolumeSnapshot { get; } = new ElasticSanVolumeCreateOption(VolumeSnapshotValue); - /// DiskSnapshot. - public static ElasticSanVolumeCreateOption DiskSnapshot { get; } = new ElasticSanVolumeCreateOption(DiskSnapshotValue); - /// Disk. - public static ElasticSanVolumeCreateOption Disk { get; } = new ElasticSanVolumeCreateOption(DiskValue); - /// DiskRestorePoint. - public static ElasticSanVolumeCreateOption DiskRestorePoint { get; } = new ElasticSanVolumeCreateOption(DiskRestorePointValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanVolumeCreateOption left, ElasticSanVolumeCreateOption right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanVolumeCreateOption left, ElasticSanVolumeCreateOption right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanVolumeCreateOption(string value) => new ElasticSanVolumeCreateOption(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanVolumeCreateOption other && Equals(other); - /// - public bool Equals(ElasticSanVolumeCreateOption 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionIdentity.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.Serialization.cs similarity index 60% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionIdentity.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.Serialization.cs index 8797daa5c8f1..d162bf3edc1b 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionIdentity.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - internal partial class ElasticSanEncryptionIdentity : IUtf8JsonSerializable, IJsonModel + internal partial class EncryptionIdentity : 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, Model /// 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(ElasticSanEncryptionIdentity)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(EncryptionIdentity)} does not support writing '{format}' format."); } if (Optional.IsDefined(EncryptionUserAssignedIdentity)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanEncryptionIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + EncryptionIdentity 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(ElasticSanEncryptionIdentity)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(EncryptionIdentity)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanEncryptionIdentity(document.RootElement, options); + return DeserializeEncryptionIdentity(document.RootElement, options); } - internal static ElasticSanEncryptionIdentity DeserializeElasticSanEncryptionIdentity(JsonElement element, ModelReaderWriterOptions options = null) + internal static EncryptionIdentity DeserializeEncryptionIdentity(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,18 +76,14 @@ internal static ElasticSanEncryptionIdentity DeserializeElasticSanEncryptionIden { return null; } - ResourceIdentifier userAssignedIdentity = default; + string userAssignedIdentity = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("userAssignedIdentity"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - userAssignedIdentity = new ResourceIdentifier(property.Value.GetString()); + userAssignedIdentity = property.Value.GetString(); continue; } if (options.Format != "W") @@ -96,38 +92,38 @@ internal static ElasticSanEncryptionIdentity DeserializeElasticSanEncryptionIden } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanEncryptionIdentity(userAssignedIdentity, serializedAdditionalRawData); + return new EncryptionIdentity(userAssignedIdentity, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanEncryptionIdentity)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(EncryptionIdentity)} does not support writing '{options.Format}' format."); } } - ElasticSanEncryptionIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + EncryptionIdentity 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 DeserializeElasticSanEncryptionIdentity(document.RootElement, options); + return DeserializeEncryptionIdentity(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanEncryptionIdentity)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(EncryptionIdentity)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionIdentity.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.cs similarity index 84% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionIdentity.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.cs index b2ad4cc10767..ea872f7a6f8a 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionIdentity.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ElasticSan.Models { /// Encryption identity for the volume group. - internal partial class ElasticSanEncryptionIdentity + internal partial class EncryptionIdentity { /// /// Keeps track of any properties unknown to the library. @@ -46,21 +45,21 @@ internal partial class ElasticSanEncryptionIdentity /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanEncryptionIdentity() + /// Initializes a new instance of . + public EncryptionIdentity() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Resource identifier of the UserAssigned identity to be associated with server-side encryption on the volume group. /// Keeps track of any properties unknown to the library. - internal ElasticSanEncryptionIdentity(ResourceIdentifier encryptionUserAssignedIdentity, IDictionary serializedAdditionalRawData) + internal EncryptionIdentity(string encryptionUserAssignedIdentity, IDictionary serializedAdditionalRawData) { EncryptionUserAssignedIdentity = encryptionUserAssignedIdentity; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource identifier of the UserAssigned identity to be associated with server-side encryption on the volume group. - public ResourceIdentifier EncryptionUserAssignedIdentity { get; set; } + public string EncryptionUserAssignedIdentity { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionProperties.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.Serialization.cs similarity index 62% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionProperties.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.Serialization.cs index 0a272201ffb9..c363f2b7192a 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionProperties.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanEncryptionProperties : IUtf8JsonSerializable, IJsonModel + public partial class EncryptionProperties : 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(ElasticSanEncryptionProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(EncryptionProperties)} does not support writing '{format}' format."); } if (Optional.IsDefined(KeyVaultProperties)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanEncryptionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + EncryptionProperties 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(ElasticSanEncryptionProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(EncryptionProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanEncryptionProperties(document.RootElement, options); + return DeserializeEncryptionProperties(document.RootElement, options); } - internal static ElasticSanEncryptionProperties DeserializeElasticSanEncryptionProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static EncryptionProperties DeserializeEncryptionProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,8 +81,8 @@ internal static ElasticSanEncryptionProperties DeserializeElasticSanEncryptionPr { return null; } - ElasticSanKeyVaultProperties keyVaultProperties = default; - ElasticSanEncryptionIdentity identity = default; + KeyVaultProperties keyVaultProperties = default; + EncryptionIdentity identity = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -93,7 +93,7 @@ internal static ElasticSanEncryptionProperties DeserializeElasticSanEncryptionPr { continue; } - keyVaultProperties = ElasticSanKeyVaultProperties.DeserializeElasticSanKeyVaultProperties(property.Value, options); + keyVaultProperties = KeyVaultProperties.DeserializeKeyVaultProperties(property.Value, options); continue; } if (property.NameEquals("identity"u8)) @@ -102,7 +102,7 @@ internal static ElasticSanEncryptionProperties DeserializeElasticSanEncryptionPr { continue; } - identity = ElasticSanEncryptionIdentity.DeserializeElasticSanEncryptionIdentity(property.Value, options); + identity = EncryptionIdentity.DeserializeEncryptionIdentity(property.Value, options); continue; } if (options.Format != "W") @@ -111,38 +111,38 @@ internal static ElasticSanEncryptionProperties DeserializeElasticSanEncryptionPr } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanEncryptionProperties(keyVaultProperties, identity, serializedAdditionalRawData); + return new EncryptionProperties(keyVaultProperties, identity, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanEncryptionProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(EncryptionProperties)} does not support writing '{options.Format}' format."); } } - ElasticSanEncryptionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + EncryptionProperties 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 DeserializeElasticSanEncryptionProperties(document.RootElement, options); + return DeserializeEncryptionProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanEncryptionProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(EncryptionProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionProperties.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.cs similarity index 80% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionProperties.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.cs index 0254243ff74d..925e95f08102 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionProperties.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ElasticSan.Models { /// The encryption settings on the volume group. - public partial class ElasticSanEncryptionProperties + public partial class EncryptionProperties { /// /// Keeps track of any properties unknown to the library. @@ -46,16 +45,16 @@ public partial class ElasticSanEncryptionProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanEncryptionProperties() + /// Initializes a new instance of . + public EncryptionProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Properties provided by key vault. /// The identity to be used with service-side encryption at rest. /// Keeps track of any properties unknown to the library. - internal ElasticSanEncryptionProperties(ElasticSanKeyVaultProperties keyVaultProperties, ElasticSanEncryptionIdentity encryptionIdentity, IDictionary serializedAdditionalRawData) + internal EncryptionProperties(KeyVaultProperties keyVaultProperties, EncryptionIdentity encryptionIdentity, IDictionary serializedAdditionalRawData) { KeyVaultProperties = keyVaultProperties; EncryptionIdentity = encryptionIdentity; @@ -63,17 +62,17 @@ internal ElasticSanEncryptionProperties(ElasticSanKeyVaultProperties keyVaultPro } /// Properties provided by key vault. - public ElasticSanKeyVaultProperties KeyVaultProperties { get; set; } + public KeyVaultProperties KeyVaultProperties { get; set; } /// The identity to be used with service-side encryption at rest. - internal ElasticSanEncryptionIdentity EncryptionIdentity { get; set; } + internal EncryptionIdentity EncryptionIdentity { get; set; } /// Resource identifier of the UserAssigned identity to be associated with server-side encryption on the volume group. - public ResourceIdentifier EncryptionUserAssignedIdentity + public string EncryptionUserAssignedIdentity { get => EncryptionIdentity is null ? default : EncryptionIdentity.EncryptionUserAssignedIdentity; set { if (EncryptionIdentity is null) - EncryptionIdentity = new ElasticSanEncryptionIdentity(); + EncryptionIdentity = new EncryptionIdentity(); EncryptionIdentity.EncryptionUserAssignedIdentity = value; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionType.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionType.cs similarity index 52% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionType.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionType.cs index fae104499c25..366879c6dcb7 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionType.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionType.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// The type of key used to encrypt the data of the disk. - public readonly partial struct ElasticSanEncryptionType : IEquatable + public readonly partial struct EncryptionType : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public ElasticSanEncryptionType(string value) + public EncryptionType(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -26,21 +26,21 @@ public ElasticSanEncryptionType(string value) private const string EncryptionAtRestWithCustomerManagedKeyValue = "EncryptionAtRestWithCustomerManagedKey"; /// Volume is encrypted at rest with Platform managed key. It is the default encryption type. - public static ElasticSanEncryptionType EncryptionAtRestWithPlatformKey { get; } = new ElasticSanEncryptionType(EncryptionAtRestWithPlatformKeyValue); + public static EncryptionType EncryptionAtRestWithPlatformKey { get; } = new EncryptionType(EncryptionAtRestWithPlatformKeyValue); /// Volume is encrypted at rest with Customer managed key that can be changed and revoked by a customer. - public static ElasticSanEncryptionType EncryptionAtRestWithCustomerManagedKey { get; } = new ElasticSanEncryptionType(EncryptionAtRestWithCustomerManagedKeyValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticSanEncryptionType left, ElasticSanEncryptionType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticSanEncryptionType left, ElasticSanEncryptionType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticSanEncryptionType(string value) => new ElasticSanEncryptionType(value); + public static EncryptionType EncryptionAtRestWithCustomerManagedKey { get; } = new EncryptionType(EncryptionAtRestWithCustomerManagedKeyValue); + /// Determines if two values are the same. + public static bool operator ==(EncryptionType left, EncryptionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EncryptionType left, EncryptionType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EncryptionType(string value) => new EncryptionType(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticSanEncryptionType other && Equals(other); + public override bool Equals(object obj) => obj is EncryptionType other && Equals(other); /// - public bool Equals(ElasticSanEncryptionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(EncryptionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/IscsiTargetInfo.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/IscsiTargetInfo.Serialization.cs index da494e8102ec..d159187bd39f 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/IscsiTargetInfo.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/IscsiTargetInfo.Serialization.cs @@ -99,8 +99,8 @@ internal static IscsiTargetInfo DeserializeIscsiTargetInfo(JsonElement element, string targetIqn = default; string targetPortalHostname = default; int? targetPortalPort = default; - ElasticSanProvisioningState? provisioningState = default; - ResourceOperationalStatus? status = default; + ProvisioningState? provisioningState = default; + OperationalStatus? status = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -130,7 +130,7 @@ internal static IscsiTargetInfo DeserializeIscsiTargetInfo(JsonElement element, { continue; } - provisioningState = new ElasticSanProvisioningState(property.Value.GetString()); + provisioningState = new ProvisioningState(property.Value.GetString()); continue; } if (property.NameEquals("status"u8)) @@ -139,7 +139,7 @@ internal static IscsiTargetInfo DeserializeIscsiTargetInfo(JsonElement element, { continue; } - status = new ResourceOperationalStatus(property.Value.GetString()); + status = new OperationalStatus(property.Value.GetString()); continue; } if (options.Format != "W") diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/IscsiTargetInfo.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/IscsiTargetInfo.cs index 44c6716a8a9f..fd5c53fe0dcb 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/IscsiTargetInfo.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/IscsiTargetInfo.cs @@ -46,7 +46,7 @@ public partial class IscsiTargetInfo private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal IscsiTargetInfo() + public IscsiTargetInfo() { } @@ -57,7 +57,7 @@ internal IscsiTargetInfo() /// State of the operation on the resource. /// Operational status of the iSCSI Target. /// Keeps track of any properties unknown to the library. - internal IscsiTargetInfo(string targetIqn, string targetPortalHostname, int? targetPortalPort, ElasticSanProvisioningState? provisioningState, ResourceOperationalStatus? status, IDictionary serializedAdditionalRawData) + internal IscsiTargetInfo(string targetIqn, string targetPortalHostname, int? targetPortalPort, ProvisioningState? provisioningState, OperationalStatus? status, IDictionary serializedAdditionalRawData) { TargetIqn = targetIqn; TargetPortalHostname = targetPortalHostname; @@ -74,8 +74,8 @@ internal IscsiTargetInfo(string targetIqn, string targetPortalHostname, int? tar /// iSCSI Target Portal Port. public int? TargetPortalPort { get; } /// State of the operation on the resource. - public ElasticSanProvisioningState? ProvisioningState { get; } + public ProvisioningState? ProvisioningState { get; } /// Operational status of the iSCSI Target. - public ResourceOperationalStatus? Status { get; } + public OperationalStatus? Status { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanKeyVaultProperties.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.Serialization.cs similarity index 77% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanKeyVaultProperties.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.Serialization.cs index 7ce5abc64651..2550dd994e68 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanKeyVaultProperties.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanKeyVaultProperties : IUtf8JsonSerializable, IJsonModel + public partial class KeyVaultProperties : 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, Model /// 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(ElasticSanKeyVaultProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(KeyVaultProperties)} does not support writing '{format}' format."); } if (Optional.IsDefined(KeyName)) @@ -81,19 +81,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanKeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + KeyVaultProperties 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(ElasticSanKeyVaultProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(KeyVaultProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanKeyVaultProperties(document.RootElement, options); + return DeserializeKeyVaultProperties(document.RootElement, options); } - internal static ElasticSanKeyVaultProperties DeserializeElasticSanKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -159,7 +159,7 @@ internal static ElasticSanKeyVaultProperties DeserializeElasticSanKeyVaultProper } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanKeyVaultProperties( + return new KeyVaultProperties( keyName, keyVersion, keyVaultUri, @@ -169,35 +169,35 @@ internal static ElasticSanKeyVaultProperties DeserializeElasticSanKeyVaultProper 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanKeyVaultProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(KeyVaultProperties)} does not support writing '{options.Format}' format."); } } - ElasticSanKeyVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + KeyVaultProperties 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 DeserializeElasticSanKeyVaultProperties(document.RootElement, options); + return DeserializeKeyVaultProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanKeyVaultProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(KeyVaultProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanKeyVaultProperties.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.cs similarity index 86% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanKeyVaultProperties.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.cs index 62eabf653fe0..16bf1ab429d9 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanKeyVaultProperties.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// Properties of key vault. - public partial class ElasticSanKeyVaultProperties + public partial class KeyVaultProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,12 +45,12 @@ public partial class ElasticSanKeyVaultProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanKeyVaultProperties() + /// Initializes a new instance of . + public KeyVaultProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of KeyVault key. /// The version of KeyVault key. /// The Uri of KeyVault. @@ -58,7 +58,7 @@ public ElasticSanKeyVaultProperties() /// Timestamp of last rotation of the Key Vault Key. /// This is a read only property that represents the expiration time of the current version of the customer managed key used for encryption. /// Keeps track of any properties unknown to the library. - internal ElasticSanKeyVaultProperties(string keyName, string keyVersion, Uri keyVaultUri, string currentVersionedKeyIdentifier, DateTimeOffset? lastKeyRotationTimestamp, DateTimeOffset? currentVersionedKeyExpirationTimestamp, IDictionary serializedAdditionalRawData) + internal KeyVaultProperties(string keyName, string keyVersion, Uri keyVaultUri, string currentVersionedKeyIdentifier, DateTimeOffset? lastKeyRotationTimestamp, DateTimeOffset? currentVersionedKeyExpirationTimestamp, IDictionary serializedAdditionalRawData) { KeyName = keyName; KeyVersion = keyVersion; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.Serialization.cs index eddbd1b4b4d2..888f05dfeb8e 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.Serialization.cs @@ -76,18 +76,14 @@ internal static ManagedByInfo DeserializeManagedByInfo(JsonElement element, Mode { return null; } - ResourceIdentifier resourceId = default; + string resourceId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("resourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resourceId = new ResourceIdentifier(property.Value.GetString()); + resourceId = property.Value.GetString(); continue; } if (options.Format != "W") diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.cs index c5aec561afb3..976f57c07555 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ElasticSan.Models { @@ -54,13 +53,13 @@ public ManagedByInfo() /// Initializes a new instance of . /// Resource ID of the resource managing the volume, this is a restricted field and can only be set for internal use. /// Keeps track of any properties unknown to the library. - internal ManagedByInfo(ResourceIdentifier resourceId, IDictionary serializedAdditionalRawData) + internal ManagedByInfo(string resourceId, IDictionary serializedAdditionalRawData) { ResourceId = resourceId; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource ID of the resource managing the volume, this is a restricted field and can only be set for internal use. - public ResourceIdentifier ResourceId { get; set; } + public string ResourceId { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanNetworkRuleSet.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/NetworkRuleSet.Serialization.cs similarity index 63% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanNetworkRuleSet.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/NetworkRuleSet.Serialization.cs index b6d9dc274564..ff9d7a2cf47b 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanNetworkRuleSet.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/NetworkRuleSet.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - internal partial class ElasticSanNetworkRuleSet : IUtf8JsonSerializable, IJsonModel + internal partial class NetworkRuleSet : 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(ElasticSanNetworkRuleSet)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(NetworkRuleSet)} does not support writing '{format}' format."); } if (Optional.IsCollectionDefined(VirtualNetworkRules)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanNetworkRuleSet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + NetworkRuleSet 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(ElasticSanNetworkRuleSet)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(NetworkRuleSet)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanNetworkRuleSet(document.RootElement, options); + return DeserializeNetworkRuleSet(document.RootElement, options); } - internal static ElasticSanNetworkRuleSet DeserializeElasticSanNetworkRuleSet(JsonElement element, ModelReaderWriterOptions options = null) + internal static NetworkRuleSet DeserializeNetworkRuleSet(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,7 +81,7 @@ internal static ElasticSanNetworkRuleSet DeserializeElasticSanNetworkRuleSet(Jso { return null; } - IList virtualNetworkRules = default; + IList virtualNetworkRules = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -92,10 +92,10 @@ internal static ElasticSanNetworkRuleSet DeserializeElasticSanNetworkRuleSet(Jso { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ElasticSanVirtualNetworkRule.DeserializeElasticSanVirtualNetworkRule(item, options)); + array.Add(VirtualNetworkRule.DeserializeVirtualNetworkRule(item, options)); } virtualNetworkRules = array; continue; @@ -106,38 +106,38 @@ internal static ElasticSanNetworkRuleSet DeserializeElasticSanNetworkRuleSet(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanNetworkRuleSet(virtualNetworkRules ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new NetworkRuleSet(virtualNetworkRules ?? 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanNetworkRuleSet)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(NetworkRuleSet)} does not support writing '{options.Format}' format."); } } - ElasticSanNetworkRuleSet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + NetworkRuleSet 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 DeserializeElasticSanNetworkRuleSet(document.RootElement, options); + return DeserializeNetworkRuleSet(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanNetworkRuleSet)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(NetworkRuleSet)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanNetworkRuleSet.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/NetworkRuleSet.cs similarity index 77% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanNetworkRuleSet.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/NetworkRuleSet.cs index 47da97dd23c7..dea591bddb30 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanNetworkRuleSet.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/NetworkRuleSet.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// A set of rules governing the network accessibility. - internal partial class ElasticSanNetworkRuleSet + internal partial class NetworkRuleSet { /// /// Keeps track of any properties unknown to the library. @@ -45,22 +45,22 @@ internal partial class ElasticSanNetworkRuleSet /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanNetworkRuleSet() + /// Initializes a new instance of . + public NetworkRuleSet() { - VirtualNetworkRules = new ChangeTrackingList(); + VirtualNetworkRules = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The list of virtual network rules. /// Keeps track of any properties unknown to the library. - internal ElasticSanNetworkRuleSet(IList virtualNetworkRules, IDictionary serializedAdditionalRawData) + internal NetworkRuleSet(IList virtualNetworkRules, IDictionary serializedAdditionalRawData) { VirtualNetworkRules = virtualNetworkRules; _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of virtual network rules. - public IList VirtualNetworkRules { get; } + public IList VirtualNetworkRules { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/OperationalStatus.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/OperationalStatus.cs new file mode 100644 index 000000000000..aefebe5133a7 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/OperationalStatus.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.ElasticSan.Models +{ + /// Operational status of the resource. + public readonly partial struct OperationalStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperationalStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InvalidValue = "Invalid"; + private const string UnknownValue = "Unknown"; + private const string HealthyValue = "Healthy"; + private const string UnhealthyValue = "Unhealthy"; + private const string UpdatingValue = "Updating"; + private const string RunningValue = "Running"; + private const string StoppedValue = "Stopped"; + private const string StoppedDeallocatedValue = "Stopped (deallocated)"; + + /// Invalid. + public static OperationalStatus Invalid { get; } = new OperationalStatus(InvalidValue); + /// Unknown. + public static OperationalStatus Unknown { get; } = new OperationalStatus(UnknownValue); + /// Healthy. + public static OperationalStatus Healthy { get; } = new OperationalStatus(HealthyValue); + /// Unhealthy. + public static OperationalStatus Unhealthy { get; } = new OperationalStatus(UnhealthyValue); + /// Updating. + public static OperationalStatus Updating { get; } = new OperationalStatus(UpdatingValue); + /// Running. + public static OperationalStatus Running { get; } = new OperationalStatus(RunningValue); + /// Stopped. + public static OperationalStatus Stopped { get; } = new OperationalStatus(StoppedValue); + /// Stopped (deallocated). + public static OperationalStatus StoppedDeallocated { get; } = new OperationalStatus(StoppedDeallocatedValue); + /// Determines if two values are the same. + public static bool operator ==(OperationalStatus left, OperationalStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationalStatus left, OperationalStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OperationalStatus(string value) => new OperationalStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationalStatus other && Equals(other); + /// + public bool Equals(OperationalStatus 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PolicyState.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PolicyState.cs new file mode 100644 index 000000000000..fa5e48aac5cd --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PolicyState.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.ElasticSan.Models +{ + /// The PolicyState. + public readonly partial struct PolicyState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PolicyState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static PolicyState Enabled { get; } = new PolicyState(EnabledValue); + /// Disabled. + public static PolicyState Disabled { get; } = new PolicyState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyState left, PolicyState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyState left, PolicyState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PolicyState(string value) => new PolicyState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyState other && Equals(other); + /// + public bool Equals(PolicyState 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPreValidationResult.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PreValidationResult.Serialization.cs similarity index 63% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPreValidationResult.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PreValidationResult.Serialization.cs index 8c212f6fa3a3..e8c86e22418d 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPreValidationResult.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PreValidationResult.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanPreValidationResult : IUtf8JsonSerializable, IJsonModel + public partial class PreValidationResult : 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, Mode /// 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(ElasticSanPreValidationResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(PreValidationResult)} does not support writing '{format}' format."); } if (Optional.IsDefined(ValidationStatus)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanPreValidationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PreValidationResult 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(ElasticSanPreValidationResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(PreValidationResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanPreValidationResult(document.RootElement, options); + return DeserializePreValidationResult(document.RootElement, options); } - internal static ElasticSanPreValidationResult DeserializeElasticSanPreValidationResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static PreValidationResult DeserializePreValidationResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -92,38 +92,38 @@ internal static ElasticSanPreValidationResult DeserializeElasticSanPreValidation } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanPreValidationResult(validationStatus, serializedAdditionalRawData); + return new PreValidationResult(validationStatus, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanPreValidationResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(PreValidationResult)} does not support writing '{options.Format}' format."); } } - ElasticSanPreValidationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PreValidationResult 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 DeserializeElasticSanPreValidationResult(document.RootElement, options); + return DeserializePreValidationResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanPreValidationResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(PreValidationResult)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPreValidationResult.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PreValidationResult.cs similarity index 83% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPreValidationResult.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PreValidationResult.cs index 1d5dfe5335fd..686698a5baa5 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPreValidationResult.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PreValidationResult.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// response object for pre validation api. - public partial class ElasticSanPreValidationResult + public partial class PreValidationResult { /// /// Keeps track of any properties unknown to the library. @@ -45,15 +45,15 @@ public partial class ElasticSanPreValidationResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticSanPreValidationResult() + /// Initializes a new instance of . + internal PreValidationResult() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// a status value indicating success or failure of validation. /// Keeps track of any properties unknown to the library. - internal ElasticSanPreValidationResult(string validationStatus, IDictionary serializedAdditionalRawData) + internal PreValidationResult(string validationStatus, IDictionary serializedAdditionalRawData) { ValidationStatus = validationStatus; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ProvisioningState.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..8de7ee5cffb3 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// Provisioning state of the iSCSI Target. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InvalidValue = "Invalid"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string PendingValue = "Pending"; + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string DeletedValue = "Deleted"; + private const string RestoringValue = "Restoring"; + private const string SoftDeletingValue = "SoftDeleting"; + + /// Invalid. + public static ProvisioningState Invalid { get; } = new ProvisioningState(InvalidValue); + /// Succeeded. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Pending. + public static ProvisioningState Pending { get; } = new ProvisioningState(PendingValue); + /// Creating. + public static ProvisioningState Creating { get; } = new ProvisioningState(CreatingValue); + /// Updating. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// Deleting. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// Deleted. + public static ProvisioningState Deleted { get; } = new ProvisioningState(DeletedValue); + /// Restoring. + public static ProvisioningState Restoring { get; } = new ProvisioningState(RestoringValue); + /// SoftDeleting. + public static ProvisioningState SoftDeleting { get; } = new ProvisioningState(SoftDeletingValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PublicNetworkAccess.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 000000000000..4bc8f0739098 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PublicNetworkAccess.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.ElasticSan.Models +{ + /// Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + public readonly partial struct PublicNetworkAccess : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PublicNetworkAccess(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static PublicNetworkAccess Enabled { get; } = new PublicNetworkAccess(EnabledValue); + /// Disabled. + public static PublicNetworkAccess Disabled { get; } = new PublicNetworkAccess(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(PublicNetworkAccess left, PublicNetworkAccess right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PublicNetworkAccess left, PublicNetworkAccess right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PublicNetworkAccess(string value) => new PublicNetworkAccess(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PublicNetworkAccess other && Equals(other); + /// + public bool Equals(PublicNetworkAccess 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ResourceOperationalStatus.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ResourceOperationalStatus.cs deleted file mode 100644 index c210f119aa3e..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ResourceOperationalStatus.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.ElasticSan.Models -{ - /// Operational status of the resource. - public readonly partial struct ResourceOperationalStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ResourceOperationalStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string InvalidValue = "Invalid"; - private const string UnknownValue = "Unknown"; - private const string HealthyValue = "Healthy"; - private const string UnhealthyValue = "Unhealthy"; - private const string UpdatingValue = "Updating"; - private const string RunningValue = "Running"; - private const string StoppedValue = "Stopped"; - private const string StoppedDeallocatedValue = "Stopped (deallocated)"; - - /// Invalid. - public static ResourceOperationalStatus Invalid { get; } = new ResourceOperationalStatus(InvalidValue); - /// Unknown. - public static ResourceOperationalStatus Unknown { get; } = new ResourceOperationalStatus(UnknownValue); - /// Healthy. - public static ResourceOperationalStatus Healthy { get; } = new ResourceOperationalStatus(HealthyValue); - /// Unhealthy. - public static ResourceOperationalStatus Unhealthy { get; } = new ResourceOperationalStatus(UnhealthyValue); - /// Updating. - public static ResourceOperationalStatus Updating { get; } = new ResourceOperationalStatus(UpdatingValue); - /// Running. - public static ResourceOperationalStatus Running { get; } = new ResourceOperationalStatus(RunningValue); - /// Stopped. - public static ResourceOperationalStatus Stopped { get; } = new ResourceOperationalStatus(StoppedValue); - /// Stopped (deallocated). - public static ResourceOperationalStatus StoppedDeallocated { get; } = new ResourceOperationalStatus(StoppedDeallocatedValue); - /// Determines if two values are the same. - public static bool operator ==(ResourceOperationalStatus left, ResourceOperationalStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ResourceOperationalStatus left, ResourceOperationalStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ResourceOperationalStatus(string value) => new ResourceOperationalStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ResourceOperationalStatus other && Equals(other); - /// - public bool Equals(ResourceOperationalStatus 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuCapability.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SKUCapability.Serialization.cs similarity index 67% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuCapability.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SKUCapability.Serialization.cs index 3a5db0a259ca..b851f506986a 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuCapability.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SKUCapability.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanSkuCapability : IUtf8JsonSerializable, IJsonModel + public partial class SKUCapability : 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, ModelReade /// 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(ElasticSanSkuCapability)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(SKUCapability)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Name)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanSkuCapability IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + SKUCapability 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(ElasticSanSkuCapability)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(SKUCapability)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanSkuCapability(document.RootElement, options); + return DeserializeSKUCapability(document.RootElement, options); } - internal static ElasticSanSkuCapability DeserializeElasticSanSkuCapability(JsonElement element, ModelReaderWriterOptions options = null) + internal static SKUCapability DeserializeSKUCapability(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -103,38 +103,38 @@ internal static ElasticSanSkuCapability DeserializeElasticSanSkuCapability(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanSkuCapability(name, value, serializedAdditionalRawData); + return new SKUCapability(name, value, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanSkuCapability)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(SKUCapability)} does not support writing '{options.Format}' format."); } } - ElasticSanSkuCapability IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + SKUCapability 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 DeserializeElasticSanSkuCapability(document.RootElement, options); + return DeserializeSKUCapability(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanSkuCapability)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(SKUCapability)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuCapability.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SKUCapability.cs similarity index 84% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuCapability.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SKUCapability.cs index e398d100642c..18ba949622e3 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuCapability.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SKUCapability.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// The capability information in the specified SKU. - public partial class ElasticSanSkuCapability + public partial class SKUCapability { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ElasticSanSkuCapability /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticSanSkuCapability() + /// Initializes a new instance of . + internal SKUCapability() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of capability. /// A string value to indicate states of given capability. /// Keeps track of any properties unknown to the library. - internal ElasticSanSkuCapability(string name, string value, IDictionary serializedAdditionalRawData) + internal SKUCapability(string name, string value, IDictionary serializedAdditionalRawData) { Name = name; Value = value; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanScaleUpProperties.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ScaleUpProperties.Serialization.cs similarity index 73% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanScaleUpProperties.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ScaleUpProperties.Serialization.cs index 674fdcc69728..9ff94803455a 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanScaleUpProperties.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ScaleUpProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanScaleUpProperties : IUtf8JsonSerializable, IJsonModel + public partial class ScaleUpProperties : 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(ElasticSanScaleUpProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ScaleUpProperties)} does not support writing '{format}' format."); } if (Optional.IsDefined(UnusedSizeTiB)) @@ -71,19 +71,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanScaleUpProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ScaleUpProperties 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(ElasticSanScaleUpProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ScaleUpProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanScaleUpProperties(document.RootElement, options); + return DeserializeScaleUpProperties(document.RootElement, options); } - internal static ElasticSanScaleUpProperties DeserializeElasticSanScaleUpProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static ScaleUpProperties DeserializeScaleUpProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -141,38 +141,38 @@ internal static ElasticSanScaleUpProperties DeserializeElasticSanScaleUpProperti } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanScaleUpProperties(unusedSizeTiB, increaseCapacityUnitByTiB, capacityUnitScaleUpLimitTiB, autoScalePolicyEnforcement, serializedAdditionalRawData); + return new ScaleUpProperties(unusedSizeTiB, increaseCapacityUnitByTiB, capacityUnitScaleUpLimitTiB, autoScalePolicyEnforcement, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanScaleUpProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ScaleUpProperties)} does not support writing '{options.Format}' format."); } } - ElasticSanScaleUpProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ScaleUpProperties 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 DeserializeElasticSanScaleUpProperties(document.RootElement, options); + return DeserializeScaleUpProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanScaleUpProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ScaleUpProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanScaleUpProperties.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ScaleUpProperties.cs similarity index 85% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanScaleUpProperties.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ScaleUpProperties.cs index 8a2952e7426a..082e4dfec41e 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanScaleUpProperties.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ScaleUpProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// Scale up properties on Elastic San Appliance. - public partial class ElasticSanScaleUpProperties + public partial class ScaleUpProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,18 +45,18 @@ public partial class ElasticSanScaleUpProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanScaleUpProperties() + /// Initializes a new instance of . + public ScaleUpProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Unused size on Elastic San appliance in TiB. /// Unit to increase Capacity Unit on Elastic San appliance in TiB. /// Maximum scale up size on Elastic San appliance in TiB. /// Enable or Disable scale up setting on Elastic San Appliance. /// Keeps track of any properties unknown to the library. - internal ElasticSanScaleUpProperties(long? unusedSizeTiB, long? increaseCapacityUnitByTiB, long? capacityUnitScaleUpLimitTiB, AutoScalePolicyEnforcement? autoScalePolicyEnforcement, IDictionary serializedAdditionalRawData) + internal ScaleUpProperties(long? unusedSizeTiB, long? increaseCapacityUnitByTiB, long? capacityUnitScaleUpLimitTiB, AutoScalePolicyEnforcement? autoScalePolicyEnforcement, IDictionary serializedAdditionalRawData) { UnusedSizeTiB = unusedSizeTiB; IncreaseCapacityUnitByTiB = increaseCapacityUnitByTiB; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformationList.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuInformationList.Serialization.cs similarity index 64% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformationList.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuInformationList.Serialization.cs index 6e49c20c9be7..52892fef11c3 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformationList.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuInformationList.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - internal partial class ElasticSanSkuInformationList : IUtf8JsonSerializable, IJsonModel + internal partial class SkuInformationList : 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,13 +28,13 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// 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(ElasticSanSkuInformationList)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(SkuInformationList)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -44,10 +44,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanSkuInformationList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + SkuInformationList 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(ElasticSanSkuInformationList)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(SkuInformationList)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanSkuInformationList(document.RootElement, options); + return DeserializeSkuInformationList(document.RootElement, options); } - internal static ElasticSanSkuInformationList DeserializeElasticSanSkuInformationList(JsonElement element, ModelReaderWriterOptions options = null) + internal static SkuInformationList DeserializeSkuInformationList(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -87,17 +87,13 @@ internal static ElasticSanSkuInformationList DeserializeElasticSanSkuInformation return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +104,11 @@ internal static ElasticSanSkuInformationList DeserializeElasticSanSkuInformation } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,38 +117,38 @@ internal static ElasticSanSkuInformationList DeserializeElasticSanSkuInformation } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanSkuInformationList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new SkuInformationList(value, nextLink, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanSkuInformationList)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(SkuInformationList)} does not support writing '{options.Format}' format."); } } - ElasticSanSkuInformationList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + SkuInformationList 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 DeserializeElasticSanSkuInformationList(document.RootElement, options); + return DeserializeSkuInformationList(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanSkuInformationList)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(SkuInformationList)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformationList.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuInformationList.cs similarity index 64% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformationList.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuInformationList.cs index c1fa48a735e9..b6293c28ca76 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuInformationList.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuInformationList.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ElasticSan.Models { /// List of SKU Information objects. - internal partial class ElasticSanSkuInformationList + internal partial class SkuInformationList { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +46,32 @@ internal partial class ElasticSanSkuInformationList /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticSanSkuInformationList() + /// Initializes a new instance of . + /// The SkuInformation items on this page. + internal SkuInformationList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } - /// Initializes a new instance of . - /// List of ResourceType Sku. - /// URI to fetch the next section of the paginated response. + /// Initializes a new instance of . + /// The SkuInformation items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ElasticSanSkuInformationList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal SkuInformationList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of ResourceType Sku. + /// Initializes a new instance of for deserialization. + internal SkuInformationList() + { + } + + /// The SkuInformation items on this page. public IReadOnlyList Value { get; } - /// URI to fetch the next section of the paginated response. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuLocationInfo.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuLocationInfo.Serialization.cs similarity index 65% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuLocationInfo.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuLocationInfo.Serialization.cs index af49201a4858..63fadb5f9f97 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuLocationInfo.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuLocationInfo.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanSkuLocationInfo : IUtf8JsonSerializable, IJsonModel + public partial class SkuLocationInfo : 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,16 +28,16 @@ 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(ElasticSanSkuLocationInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(SkuLocationInfo)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Location)) { writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location.Value); + writer.WriteStringValue(Location); } if (options.Format != "W" && Optional.IsCollectionDefined(Zones)) { @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanSkuLocationInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + SkuLocationInfo 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(ElasticSanSkuLocationInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(SkuLocationInfo)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanSkuLocationInfo(document.RootElement, options); + return DeserializeSkuLocationInfo(document.RootElement, options); } - internal static ElasticSanSkuLocationInfo DeserializeElasticSanSkuLocationInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static SkuLocationInfo DeserializeSkuLocationInfo(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,7 +86,7 @@ internal static ElasticSanSkuLocationInfo DeserializeElasticSanSkuLocationInfo(J { return null; } - AzureLocation? location = default; + string location = default; IReadOnlyList zones = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -94,11 +94,7 @@ internal static ElasticSanSkuLocationInfo DeserializeElasticSanSkuLocationInfo(J { if (property.NameEquals("location"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - location = new AzureLocation(property.Value.GetString()); + location = property.Value.GetString(); continue; } if (property.NameEquals("zones"u8)) @@ -121,38 +117,38 @@ internal static ElasticSanSkuLocationInfo DeserializeElasticSanSkuLocationInfo(J } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanSkuLocationInfo(location, zones ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new SkuLocationInfo(location, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanSkuLocationInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(SkuLocationInfo)} does not support writing '{options.Format}' format."); } } - ElasticSanSkuLocationInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + SkuLocationInfo 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 DeserializeElasticSanSkuLocationInfo(document.RootElement, options); + return DeserializeSkuLocationInfo(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanSkuLocationInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(SkuLocationInfo)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuLocationInfo.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuLocationInfo.cs similarity index 81% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuLocationInfo.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuLocationInfo.cs index 8a0e5d9144fb..8507ea1ec7f8 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSkuLocationInfo.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SkuLocationInfo.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ElasticSan.Models { /// The location info. - public partial class ElasticSanSkuLocationInfo + public partial class SkuLocationInfo { /// /// Keeps track of any properties unknown to the library. @@ -46,17 +45,17 @@ public partial class ElasticSanSkuLocationInfo /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticSanSkuLocationInfo() + /// Initializes a new instance of . + internal SkuLocationInfo() { Zones = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The location. /// The zones. /// Keeps track of any properties unknown to the library. - internal ElasticSanSkuLocationInfo(AzureLocation? location, IReadOnlyList zones, IDictionary serializedAdditionalRawData) + internal SkuLocationInfo(string location, IReadOnlyList zones, IDictionary serializedAdditionalRawData) { Location = location; Zones = zones; @@ -64,7 +63,7 @@ internal ElasticSanSkuLocationInfo(AzureLocation? location, IReadOnlyList The location. - public AzureLocation? Location { get; } + public string Location { get; } /// The zones. public IReadOnlyList Zones { get; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationInfo.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationContent.Serialization.cs similarity index 64% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationInfo.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationContent.Serialization.cs index ab6e81e6bc5e..9fd76e3a8908 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationInfo.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class SnapshotCreationInfo : IUtf8JsonSerializable, IJsonModel + public partial class SnapshotCreationContent : 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, 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(SnapshotCreationInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(SnapshotCreationContent)} does not support writing '{format}' format."); } writer.WritePropertyName("sourceId"u8); @@ -53,19 +53,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SnapshotCreationInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + SnapshotCreationContent 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(SnapshotCreationInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(SnapshotCreationContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSnapshotCreationInfo(document.RootElement, options); + return DeserializeSnapshotCreationContent(document.RootElement, options); } - internal static SnapshotCreationInfo DeserializeSnapshotCreationInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static SnapshotCreationContent DeserializeSnapshotCreationContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -73,14 +73,14 @@ internal static SnapshotCreationInfo DeserializeSnapshotCreationInfo(JsonElement { return null; } - ResourceIdentifier sourceId = default; + string sourceId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceId"u8)) { - sourceId = new ResourceIdentifier(property.Value.GetString()); + sourceId = property.Value.GetString(); continue; } if (options.Format != "W") @@ -89,38 +89,38 @@ internal static SnapshotCreationInfo DeserializeSnapshotCreationInfo(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new SnapshotCreationInfo(sourceId, serializedAdditionalRawData); + return new SnapshotCreationContent(sourceId, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(SnapshotCreationInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(SnapshotCreationContent)} does not support writing '{options.Format}' format."); } } - SnapshotCreationInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + SnapshotCreationContent 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 DeserializeSnapshotCreationInfo(document.RootElement, options); + return DeserializeSnapshotCreationContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(SnapshotCreationInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(SnapshotCreationContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationInfo.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationContent.cs similarity index 86% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationInfo.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationContent.cs index 23d296610227..66c4f1b46cbc 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationInfo.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationContent.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ElasticSan.Models { /// Data used when creating a volume snapshot. - public partial class SnapshotCreationInfo + public partial class SnapshotCreationContent { /// /// Keeps track of any properties unknown to the library. @@ -46,31 +45,31 @@ public partial class SnapshotCreationInfo /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Fully qualified resource ID of the volume. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". /// is null. - public SnapshotCreationInfo(ResourceIdentifier sourceId) + public SnapshotCreationContent(string sourceId) { Argument.AssertNotNull(sourceId, nameof(sourceId)); SourceId = sourceId; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Fully qualified resource ID of the volume. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". /// Keeps track of any properties unknown to the library. - internal SnapshotCreationInfo(ResourceIdentifier sourceId, IDictionary serializedAdditionalRawData) + internal SnapshotCreationContent(string sourceId, IDictionary serializedAdditionalRawData) { SourceId = sourceId; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal SnapshotCreationInfo() + /// Initializes a new instance of for deserialization. + internal SnapshotCreationContent() { } /// Fully qualified resource ID of the volume. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". - public ResourceIdentifier SourceId { get; set; } + public string SourceId { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.Serialization.cs index e946ec3ebb19..da508cede6fa 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(SnapshotList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -86,29 +83,29 @@ internal static SnapshotList DeserializeSnapshotList(JsonElement element, ModelR { return null; } - IReadOnlyList value = default; - string nextLink = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(item, options)); + array.Add(SnapshotData.DeserializeSnapshotData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +114,7 @@ internal static SnapshotList DeserializeSnapshotList(JsonElement element, ModelR } } serializedAdditionalRawData = rawDataDictionary; - return new SnapshotList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new SnapshotList(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.cs index 6b14308f0fe3..f2eb858eb0b3 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ElasticSan.Models { @@ -46,25 +47,34 @@ internal partial class SnapshotList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal SnapshotList() + /// The Snapshot items on this page. + /// is null. + internal SnapshotList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// An array of Snapshot objects. - /// URI to fetch the next section of the paginated response. + /// The Snapshot items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal SnapshotList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal SnapshotList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// An array of Snapshot objects. - public IReadOnlyList Value { get; } - /// URI to fetch the next section of the paginated response. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal SnapshotList() + { + } + + /// The Snapshot items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SourceCreationContent.Serialization.cs similarity index 60% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SourceCreationContent.Serialization.cs index 773237acf52a..0d05e77595fd 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SourceCreationContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanVolumeDataSourceInfo : IUtf8JsonSerializable, IJsonModel + public partial class SourceCreationContent : 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(ElasticSanVolumeDataSourceInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(SourceCreationContent)} does not support writing '{format}' format."); } if (Optional.IsDefined(CreateSource)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanVolumeDataSourceInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + SourceCreationContent 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(ElasticSanVolumeDataSourceInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(SourceCreationContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanVolumeDataSourceInfo(document.RootElement, options); + return DeserializeSourceCreationContent(document.RootElement, options); } - internal static ElasticSanVolumeDataSourceInfo DeserializeElasticSanVolumeDataSourceInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static SourceCreationContent DeserializeSourceCreationContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,8 +81,8 @@ internal static ElasticSanVolumeDataSourceInfo DeserializeElasticSanVolumeDataSo { return null; } - ElasticSanVolumeCreateOption? createSource = default; - ResourceIdentifier sourceId = default; + VolumeCreateOption? createSource = default; + string sourceId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -93,16 +93,12 @@ internal static ElasticSanVolumeDataSourceInfo DeserializeElasticSanVolumeDataSo { continue; } - createSource = new ElasticSanVolumeCreateOption(property.Value.GetString()); + createSource = new VolumeCreateOption(property.Value.GetString()); continue; } if (property.NameEquals("sourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sourceId = new ResourceIdentifier(property.Value.GetString()); + sourceId = property.Value.GetString(); continue; } if (options.Format != "W") @@ -111,38 +107,38 @@ internal static ElasticSanVolumeDataSourceInfo DeserializeElasticSanVolumeDataSo } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanVolumeDataSourceInfo(createSource, sourceId, serializedAdditionalRawData); + return new SourceCreationContent(createSource, sourceId, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanVolumeDataSourceInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(SourceCreationContent)} does not support writing '{options.Format}' format."); } } - ElasticSanVolumeDataSourceInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + SourceCreationContent 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 DeserializeElasticSanVolumeDataSourceInfo(document.RootElement, options); + return DeserializeSourceCreationContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanVolumeDataSourceInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(SourceCreationContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SourceCreationContent.cs similarity index 80% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SourceCreationContent.cs index 97591bf0f8d7..c8c8bab22279 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SourceCreationContent.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ElasticSan.Models { /// Data source used when creating the volume. - public partial class ElasticSanVolumeDataSourceInfo + public partial class SourceCreationContent { /// /// Keeps track of any properties unknown to the library. @@ -46,16 +45,16 @@ public partial class ElasticSanVolumeDataSourceInfo /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanVolumeDataSourceInfo() + /// Initializes a new instance of . + public SourceCreationContent() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// This enumerates the possible sources of a volume creation. /// Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". /// Keeps track of any properties unknown to the library. - internal ElasticSanVolumeDataSourceInfo(ElasticSanVolumeCreateOption? createSource, ResourceIdentifier sourceId, IDictionary serializedAdditionalRawData) + internal SourceCreationContent(VolumeCreateOption? createSource, string sourceId, IDictionary serializedAdditionalRawData) { CreateSource = createSource; SourceId = sourceId; @@ -63,8 +62,8 @@ internal ElasticSanVolumeDataSourceInfo(ElasticSanVolumeCreateOption? createSour } /// This enumerates the possible sources of a volume creation. - public ElasticSanVolumeCreateOption? CreateSource { get; set; } + public VolumeCreateOption? CreateSource { get; set; } /// Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - public ResourceIdentifier SourceId { get; set; } + public string SourceId { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/StorageTargetType.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/StorageTargetType.cs new file mode 100644 index 000000000000..c0919e80cb97 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/StorageTargetType.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.ElasticSan.Models +{ + /// Storage Target type. + public readonly partial struct StorageTargetType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StorageTargetType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IscsiValue = "Iscsi"; + private const string NoneValue = "None"; + + /// Iscsi. + public static StorageTargetType Iscsi { get; } = new StorageTargetType(IscsiValue); + /// None. + public static StorageTargetType None { get; } = new StorageTargetType(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(StorageTargetType left, StorageTargetType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StorageTargetType left, StorageTargetType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator StorageTargetType(string value) => new StorageTargetType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StorageTargetType other && Equals(other); + /// + public bool Equals(StorageTargetType 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VirtualNetworkRule.Serialization.cs similarity index 62% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VirtualNetworkRule.Serialization.cs index 3784380eda3d..25f2b6ddc46c 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VirtualNetworkRule.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanVirtualNetworkRule : IUtf8JsonSerializable, IJsonModel + public partial class VirtualNetworkRule : 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, Model /// 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(ElasticSanVirtualNetworkRule)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VirtualNetworkRule)} does not support writing '{format}' format."); } writer.WritePropertyName("id"u8); @@ -58,19 +58,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanVirtualNetworkRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VirtualNetworkRule 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(ElasticSanVirtualNetworkRule)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VirtualNetworkRule)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanVirtualNetworkRule(document.RootElement, options); + return DeserializeVirtualNetworkRule(document.RootElement, options); } - internal static ElasticSanVirtualNetworkRule DeserializeElasticSanVirtualNetworkRule(JsonElement element, ModelReaderWriterOptions options = null) + internal static VirtualNetworkRule DeserializeVirtualNetworkRule(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -78,15 +78,15 @@ internal static ElasticSanVirtualNetworkRule DeserializeElasticSanVirtualNetwork { return null; } - ResourceIdentifier id = default; - ElasticSanVirtualNetworkRuleAction? action = default; + string id = default; + Action? action = 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()); + id = property.Value.GetString(); continue; } if (property.NameEquals("action"u8)) @@ -95,7 +95,7 @@ internal static ElasticSanVirtualNetworkRule DeserializeElasticSanVirtualNetwork { continue; } - action = new ElasticSanVirtualNetworkRuleAction(property.Value.GetString()); + action = new Action(property.Value.GetString()); continue; } if (options.Format != "W") @@ -104,38 +104,38 @@ internal static ElasticSanVirtualNetworkRule DeserializeElasticSanVirtualNetwork } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanVirtualNetworkRule(id, action, serializedAdditionalRawData); + return new VirtualNetworkRule(id, action, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanVirtualNetworkRule)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VirtualNetworkRule)} does not support writing '{options.Format}' format."); } } - ElasticSanVirtualNetworkRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VirtualNetworkRule 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 DeserializeElasticSanVirtualNetworkRule(document.RootElement, options); + return DeserializeVirtualNetworkRule(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanVirtualNetworkRule)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VirtualNetworkRule)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VirtualNetworkRule.cs similarity index 77% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VirtualNetworkRule.cs index 8e0fd523dfdc..b3c1c9de9b47 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VirtualNetworkRule.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ElasticSan.Models { /// Virtual Network rule. - public partial class ElasticSanVirtualNetworkRule + public partial class VirtualNetworkRule { /// /// Keeps track of any properties unknown to the library. @@ -46,35 +45,35 @@ public partial class ElasticSanVirtualNetworkRule /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. /// is null. - public ElasticSanVirtualNetworkRule(ResourceIdentifier virtualNetworkResourceId) + public VirtualNetworkRule(string virtualNetworkResourceId) { Argument.AssertNotNull(virtualNetworkResourceId, nameof(virtualNetworkResourceId)); VirtualNetworkResourceId = virtualNetworkResourceId; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. /// The action of virtual network rule. /// Keeps track of any properties unknown to the library. - internal ElasticSanVirtualNetworkRule(ResourceIdentifier virtualNetworkResourceId, ElasticSanVirtualNetworkRuleAction? action, IDictionary serializedAdditionalRawData) + internal VirtualNetworkRule(string virtualNetworkResourceId, Action? action, IDictionary serializedAdditionalRawData) { VirtualNetworkResourceId = virtualNetworkResourceId; Action = action; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ElasticSanVirtualNetworkRule() + /// Initializes a new instance of for deserialization. + internal VirtualNetworkRule() { } /// Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - public ResourceIdentifier VirtualNetworkResourceId { get; set; } + public string VirtualNetworkResourceId { get; set; } /// The action of virtual network rule. - public ElasticSanVirtualNetworkRuleAction? Action { get; set; } + public Action? Action { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeCreateOption.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeCreateOption.cs new file mode 100644 index 000000000000..3a7c93fdcad3 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeCreateOption.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.ElasticSan.Models +{ + /// This enumerates the possible sources of a volume creation. + public readonly partial struct VolumeCreateOption : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VolumeCreateOption(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string VolumeSnapshotValue = "VolumeSnapshot"; + private const string DiskSnapshotValue = "DiskSnapshot"; + private const string DiskValue = "Disk"; + private const string DiskRestorePointValue = "DiskRestorePoint"; + + /// None. + public static VolumeCreateOption None { get; } = new VolumeCreateOption(NoneValue); + /// VolumeSnapshot. + public static VolumeCreateOption VolumeSnapshot { get; } = new VolumeCreateOption(VolumeSnapshotValue); + /// DiskSnapshot. + public static VolumeCreateOption DiskSnapshot { get; } = new VolumeCreateOption(DiskSnapshotValue); + /// Disk. + public static VolumeCreateOption Disk { get; } = new VolumeCreateOption(DiskValue); + /// DiskRestorePoint. + public static VolumeCreateOption DiskRestorePoint { get; } = new VolumeCreateOption(DiskRestorePointValue); + /// Determines if two values are the same. + public static bool operator ==(VolumeCreateOption left, VolumeCreateOption right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VolumeCreateOption left, VolumeCreateOption right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VolumeCreateOption(string value) => new VolumeCreateOption(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VolumeCreateOption other && Equals(other); + /// + public bool Equals(VolumeCreateOption 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeList.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupList.Serialization.cs similarity index 58% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeList.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupList.Serialization.cs index cf153de2fdc0..3e99c3729c3b 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeList.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupList.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - internal partial class ElasticSanVolumeList : IUtf8JsonSerializable, IJsonModel + internal partial class VolumeGroupList : 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,26 +28,23 @@ 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(ElasticSanVolumeList)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -66,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanVolumeList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VolumeGroupList 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(ElasticSanVolumeList)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupList)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanVolumeList(document.RootElement, options); + return DeserializeVolumeGroupList(document.RootElement, options); } - internal static ElasticSanVolumeList DeserializeElasticSanVolumeList(JsonElement element, ModelReaderWriterOptions options = null) + internal static VolumeGroupList DeserializeVolumeGroupList(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,29 +83,29 @@ internal static ElasticSanVolumeList DeserializeElasticSanVolumeList(JsonElement { return null; } - IReadOnlyList value = default; - string nextLink = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ElasticSanVolumeData.DeserializeElasticSanVolumeData(item, options)); + array.Add(VolumeGroupData.DeserializeVolumeGroupData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,38 +114,38 @@ internal static ElasticSanVolumeList DeserializeElasticSanVolumeList(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanVolumeList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new VolumeGroupList(value, nextLink, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanVolumeList)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupList)} does not support writing '{options.Format}' format."); } } - ElasticSanVolumeList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VolumeGroupList 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 DeserializeElasticSanVolumeList(document.RootElement, options); + return DeserializeVolumeGroupList(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanVolumeList)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupList)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupList.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupList.cs similarity index 60% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupList.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupList.cs index 315fa26dd9ac..11dab34bf8e6 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupList.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupList.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ElasticSan.Models { /// List of Volume Groups. - internal partial class ElasticSanVolumeGroupList + internal partial class VolumeGroupList { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +46,35 @@ internal partial class ElasticSanVolumeGroupList /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticSanVolumeGroupList() + /// Initializes a new instance of . + /// The VolumeGroup items on this page. + /// is null. + internal VolumeGroupList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } - /// Initializes a new instance of . - /// An array of Volume Groups objects. - /// URI to fetch the next section of the paginated response. + /// Initializes a new instance of . + /// The VolumeGroup items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ElasticSanVolumeGroupList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal VolumeGroupList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// An array of Volume Groups objects. - public IReadOnlyList Value { get; } - /// URI to fetch the next section of the paginated response. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal VolumeGroupList() + { + } + + /// The VolumeGroup items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupPatch.Serialization.cs similarity index 73% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupPatch.Serialization.cs index af2877af405e..3f6cf693911d 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupPatch.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanVolumeGroupPatch : IUtf8JsonSerializable, IJsonModel + public partial class VolumeGroupPatch : 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, 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(ElasticSanVolumeGroupPatch)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupPatch)} does not support writing '{format}' format."); } if (Optional.IsDefined(Identity)) @@ -90,19 +90,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanVolumeGroupPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VolumeGroupPatch 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(ElasticSanVolumeGroupPatch)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupPatch)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanVolumeGroupPatch(document.RootElement, options); + return DeserializeVolumeGroupPatch(document.RootElement, options); } - internal static ElasticSanVolumeGroupPatch DeserializeElasticSanVolumeGroupPatch(JsonElement element, ModelReaderWriterOptions options = null) + internal static VolumeGroupPatch DeserializeVolumeGroupPatch(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -111,12 +111,12 @@ internal static ElasticSanVolumeGroupPatch DeserializeElasticSanVolumeGroupPatch return null; } ManagedServiceIdentity identity = default; - ElasticSanStorageTargetType? protocolType = default; - ElasticSanEncryptionType? encryption = default; - ElasticSanEncryptionProperties encryptionProperties = default; - ElasticSanNetworkRuleSet networkAcls = default; + StorageTargetType? protocolType = default; + EncryptionType? encryption = default; + EncryptionProperties encryptionProperties = default; + NetworkRuleSet networkAcls = default; bool? enforceDataIntegrityCheckForIscsi = default; - ElasticSanDeleteRetentionPolicy deleteRetentionPolicy = default; + DeleteRetentionPolicy deleteRetentionPolicy = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -145,7 +145,7 @@ internal static ElasticSanVolumeGroupPatch DeserializeElasticSanVolumeGroupPatch { continue; } - protocolType = new ElasticSanStorageTargetType(property0.Value.GetString()); + protocolType = new StorageTargetType(property0.Value.GetString()); continue; } if (property0.NameEquals("encryption"u8)) @@ -154,7 +154,7 @@ internal static ElasticSanVolumeGroupPatch DeserializeElasticSanVolumeGroupPatch { continue; } - encryption = new ElasticSanEncryptionType(property0.Value.GetString()); + encryption = new EncryptionType(property0.Value.GetString()); continue; } if (property0.NameEquals("encryptionProperties"u8)) @@ -163,7 +163,7 @@ internal static ElasticSanVolumeGroupPatch DeserializeElasticSanVolumeGroupPatch { continue; } - encryptionProperties = ElasticSanEncryptionProperties.DeserializeElasticSanEncryptionProperties(property0.Value, options); + encryptionProperties = EncryptionProperties.DeserializeEncryptionProperties(property0.Value, options); continue; } if (property0.NameEquals("networkAcls"u8)) @@ -172,7 +172,7 @@ internal static ElasticSanVolumeGroupPatch DeserializeElasticSanVolumeGroupPatch { continue; } - networkAcls = ElasticSanNetworkRuleSet.DeserializeElasticSanNetworkRuleSet(property0.Value, options); + networkAcls = NetworkRuleSet.DeserializeNetworkRuleSet(property0.Value, options); continue; } if (property0.NameEquals("enforceDataIntegrityCheckForIscsi"u8)) @@ -190,7 +190,7 @@ internal static ElasticSanVolumeGroupPatch DeserializeElasticSanVolumeGroupPatch { continue; } - deleteRetentionPolicy = ElasticSanDeleteRetentionPolicy.DeserializeElasticSanDeleteRetentionPolicy(property0.Value, options); + deleteRetentionPolicy = DeleteRetentionPolicy.DeserializeDeleteRetentionPolicy(property0.Value, options); continue; } } @@ -202,7 +202,7 @@ internal static ElasticSanVolumeGroupPatch DeserializeElasticSanVolumeGroupPatch } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanVolumeGroupPatch( + return new VolumeGroupPatch( identity, protocolType, encryption, @@ -213,35 +213,35 @@ internal static ElasticSanVolumeGroupPatch DeserializeElasticSanVolumeGroupPatch 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanVolumeGroupPatch)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupPatch)} does not support writing '{options.Format}' format."); } } - ElasticSanVolumeGroupPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VolumeGroupPatch 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 DeserializeElasticSanVolumeGroupPatch(document.RootElement, options); + return DeserializeVolumeGroupPatch(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanVolumeGroupPatch)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupPatch)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupPatch.cs similarity index 77% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupPatch.cs index ae110c64e77e..05cca616d548 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeGroupPatch.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// Volume Group request. - public partial class ElasticSanVolumeGroupPatch + public partial class VolumeGroupPatch { /// /// Keeps track of any properties unknown to the library. @@ -46,12 +46,12 @@ public partial class ElasticSanVolumeGroupPatch /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanVolumeGroupPatch() + /// Initializes a new instance of . + public VolumeGroupPatch() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. /// Type of storage target. /// Type of encryption. @@ -60,7 +60,7 @@ public ElasticSanVolumeGroupPatch() /// A boolean indicating whether or not Data Integrity Check is enabled. /// The retention policy for the soft deleted volume group and its associated resources. /// Keeps track of any properties unknown to the library. - internal ElasticSanVolumeGroupPatch(ManagedServiceIdentity identity, ElasticSanStorageTargetType? protocolType, ElasticSanEncryptionType? encryption, ElasticSanEncryptionProperties encryptionProperties, ElasticSanNetworkRuleSet networkAcls, bool? enforceDataIntegrityCheckForIscsi, ElasticSanDeleteRetentionPolicy deleteRetentionPolicy, IDictionary serializedAdditionalRawData) + internal VolumeGroupPatch(ManagedServiceIdentity identity, StorageTargetType? protocolType, EncryptionType? encryption, EncryptionProperties encryptionProperties, NetworkRuleSet networkAcls, bool? enforceDataIntegrityCheckForIscsi, DeleteRetentionPolicy deleteRetentionPolicy, IDictionary serializedAdditionalRawData) { Identity = identity; ProtocolType = protocolType; @@ -75,20 +75,20 @@ internal ElasticSanVolumeGroupPatch(ManagedServiceIdentity identity, ElasticSanS /// The identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. public ManagedServiceIdentity Identity { get; set; } /// Type of storage target. - public ElasticSanStorageTargetType? ProtocolType { get; set; } + public StorageTargetType? ProtocolType { get; set; } /// Type of encryption. - public ElasticSanEncryptionType? Encryption { get; set; } + public EncryptionType? Encryption { get; set; } /// Encryption Properties describing Key Vault and Identity information. - public ElasticSanEncryptionProperties EncryptionProperties { get; set; } + public EncryptionProperties EncryptionProperties { get; set; } /// A collection of rules governing the accessibility from specific network locations. - internal ElasticSanNetworkRuleSet NetworkAcls { get; set; } + internal NetworkRuleSet NetworkAcls { get; set; } /// The list of virtual network rules. - public IList VirtualNetworkRules + public IList VirtualNetworkRules { get { if (NetworkAcls is null) - NetworkAcls = new ElasticSanNetworkRuleSet(); + NetworkAcls = new NetworkRuleSet(); return NetworkAcls.VirtualNetworkRules; } } @@ -96,6 +96,6 @@ public IList VirtualNetworkRules /// A boolean indicating whether or not Data Integrity Check is enabled. public bool? EnforceDataIntegrityCheckForIscsi { get; set; } /// The retention policy for the soft deleted volume group and its associated resources. - public ElasticSanDeleteRetentionPolicy DeleteRetentionPolicy { get; set; } + public DeleteRetentionPolicy DeleteRetentionPolicy { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupList.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeList.Serialization.cs similarity index 57% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupList.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeList.Serialization.cs index dd3201f30506..afa0417c8abc 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupList.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeList.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - internal partial class ElasticSanVolumeGroupList : IUtf8JsonSerializable, IJsonModel + internal partial class VolumeList : 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,26 +28,23 @@ 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(ElasticSanVolumeGroupList)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VolumeList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -66,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanVolumeGroupList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VolumeList 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(ElasticSanVolumeGroupList)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VolumeList)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanVolumeGroupList(document.RootElement, options); + return DeserializeVolumeList(document.RootElement, options); } - internal static ElasticSanVolumeGroupList DeserializeElasticSanVolumeGroupList(JsonElement element, ModelReaderWriterOptions options = null) + internal static VolumeList DeserializeVolumeList(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,29 +83,29 @@ internal static ElasticSanVolumeGroupList DeserializeElasticSanVolumeGroupList(J { return null; } - IReadOnlyList value = default; - string nextLink = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ElasticSanVolumeGroupData.DeserializeElasticSanVolumeGroupData(item, options)); + array.Add(VolumeData.DeserializeVolumeData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,38 +114,38 @@ internal static ElasticSanVolumeGroupList DeserializeElasticSanVolumeGroupList(J } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanVolumeGroupList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new VolumeList(value, nextLink, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanVolumeGroupList)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeList)} does not support writing '{options.Format}' format."); } } - ElasticSanVolumeGroupList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VolumeList 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 DeserializeElasticSanVolumeGroupList(document.RootElement, options); + return DeserializeVolumeList(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanVolumeGroupList)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeList)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeList.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeList.cs similarity index 61% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeList.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeList.cs index 4a949562d2e2..35def90b97c4 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeList.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeList.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ElasticSan.Models { /// List of Volumes. - internal partial class ElasticSanVolumeList + internal partial class VolumeList { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +46,35 @@ internal partial class ElasticSanVolumeList /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticSanVolumeList() + /// Initializes a new instance of . + /// The Volume items on this page. + /// is null. + internal VolumeList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } - /// Initializes a new instance of . - /// An array of Volume objects. - /// URI to fetch the next section of the paginated response. + /// Initializes a new instance of . + /// The Volume items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ElasticSanVolumeList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal VolumeList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// An array of Volume objects. - public IReadOnlyList Value { get; } - /// URI to fetch the next section of the paginated response. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal VolumeList() + { + } + + /// The Volume items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeNameListContent.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeNameList.Serialization.cs similarity index 64% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeNameListContent.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeNameList.Serialization.cs index ff39ed3056c1..e4d75af4726c 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeNameListContent.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeNameList.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanVolumeNameListContent : IUtf8JsonSerializable, IJsonModel + public partial class VolumeNameList : 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(ElasticSanVolumeNameListContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VolumeNameList)} does not support writing '{format}' format."); } writer.WritePropertyName("volumeNames"u8); @@ -58,19 +58,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanVolumeNameListContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VolumeNameList 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(ElasticSanVolumeNameListContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VolumeNameList)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanVolumeNameListContent(document.RootElement, options); + return DeserializeVolumeNameList(document.RootElement, options); } - internal static ElasticSanVolumeNameListContent DeserializeElasticSanVolumeNameListContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static VolumeNameList DeserializeVolumeNameList(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -99,38 +99,38 @@ internal static ElasticSanVolumeNameListContent DeserializeElasticSanVolumeNameL } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanVolumeNameListContent(volumeNames, serializedAdditionalRawData); + return new VolumeNameList(volumeNames, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanVolumeNameListContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeNameList)} does not support writing '{options.Format}' format."); } } - ElasticSanVolumeNameListContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VolumeNameList 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 DeserializeElasticSanVolumeNameListContent(document.RootElement, options); + return DeserializeVolumeNameList(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanVolumeNameListContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeNameList)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeNameListContent.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeNameList.cs similarity index 78% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeNameListContent.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeNameList.cs index f2a67803b164..df0a4210c509 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeNameListContent.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumeNameList.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.ElasticSan.Models { /// object to hold array of volume names. - public partial class ElasticSanVolumeNameListContent + public partial class VolumeNameList { /// /// Keeps track of any properties unknown to the library. @@ -46,27 +46,27 @@ public partial class ElasticSanVolumeNameListContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// array of volume names. /// is null. - public ElasticSanVolumeNameListContent(IEnumerable volumeNames) + public VolumeNameList(IEnumerable volumeNames) { Argument.AssertNotNull(volumeNames, nameof(volumeNames)); VolumeNames = volumeNames.ToList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// array of volume names. /// Keeps track of any properties unknown to the library. - internal ElasticSanVolumeNameListContent(IList volumeNames, IDictionary serializedAdditionalRawData) + internal VolumeNameList(IList volumeNames, IDictionary serializedAdditionalRawData) { VolumeNames = volumeNames; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ElasticSanVolumeNameListContent() + /// Initializes a new instance of for deserialization. + internal VolumeNameList() { } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumePatch.Serialization.cs similarity index 72% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumePatch.Serialization.cs index 03977aeafe6d..5cf5905e7bf8 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumePatch.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ElasticSan.Models { - public partial class ElasticSanVolumePatch : IUtf8JsonSerializable, IJsonModel + public partial class VolumePatch : 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, ModelReaderW /// 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(ElasticSanVolumePatch)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VolumePatch)} does not support writing '{format}' format."); } writer.WritePropertyName("properties"u8); @@ -64,19 +64,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSanVolumePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VolumePatch 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(ElasticSanVolumePatch)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VolumePatch)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanVolumePatch(document.RootElement, options); + return DeserializeVolumePatch(document.RootElement, options); } - internal static ElasticSanVolumePatch DeserializeElasticSanVolumePatch(JsonElement element, ModelReaderWriterOptions options = null) + internal static VolumePatch DeserializeVolumePatch(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -126,38 +126,38 @@ internal static ElasticSanVolumePatch DeserializeElasticSanVolumePatch(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanVolumePatch(sizeGiB, managedBy, serializedAdditionalRawData); + return new VolumePatch(sizeGiB, managedBy, 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanVolumePatch)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumePatch)} does not support writing '{options.Format}' format."); } } - ElasticSanVolumePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VolumePatch 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 DeserializeElasticSanVolumePatch(document.RootElement, options); + return DeserializeVolumePatch(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanVolumePatch)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumePatch)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumePatch.cs similarity index 84% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumePatch.cs index 2ef4ca79fd3f..9ad6f22a8256 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/VolumePatch.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ElasticSan.Models { /// Response for Volume request. - public partial class ElasticSanVolumePatch + public partial class VolumePatch { /// /// Keeps track of any properties unknown to the library. @@ -46,16 +45,16 @@ public partial class ElasticSanVolumePatch /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanVolumePatch() + /// Initializes a new instance of . + public VolumePatch() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Volume size. /// Parent resource information. /// Keeps track of any properties unknown to the library. - internal ElasticSanVolumePatch(long? sizeGiB, ManagedByInfo managedBy, IDictionary serializedAdditionalRawData) + internal VolumePatch(long? sizeGiB, ManagedByInfo managedBy, IDictionary serializedAdditionalRawData) { SizeGiB = sizeGiB; ManagedBy = managedBy; @@ -67,7 +66,7 @@ internal ElasticSanVolumePatch(long? sizeGiB, ManagedByInfo managedBy, IDictiona /// Parent resource information. internal ManagedByInfo ManagedBy { get; set; } /// Resource ID of the resource managing the volume, this is a restricted field and can only be set for internal use. - public ResourceIdentifier ManagedByResourceId + public string ManagedByResourceId { get => ManagedBy is null ? default : ManagedBy.ResourceId; set diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsAccessSoftDeletedResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsAccessSoftDeletedResource.cs new file mode 100644 index 000000000000..96bb6f32a120 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsAccessSoftDeletedResource.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.ElasticSan.Models +{ + /// The x-ms-access-soft-deleted-resources. + public readonly partial struct XMsAccessSoftDeletedResource : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public XMsAccessSoftDeletedResource(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "true"; + private const string FalseValue = "false"; + + /// true. + public static XMsAccessSoftDeletedResource True { get; } = new XMsAccessSoftDeletedResource(TrueValue); + /// false. + public static XMsAccessSoftDeletedResource False { get; } = new XMsAccessSoftDeletedResource(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(XMsAccessSoftDeletedResource left, XMsAccessSoftDeletedResource right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(XMsAccessSoftDeletedResource left, XMsAccessSoftDeletedResource right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator XMsAccessSoftDeletedResource(string value) => new XMsAccessSoftDeletedResource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is XMsAccessSoftDeletedResource other && Equals(other); + /// + public bool Equals(XMsAccessSoftDeletedResource 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsDeleteSnapshot.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsDeleteSnapshot.cs new file mode 100644 index 000000000000..85dfd736c0d1 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsDeleteSnapshot.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.ElasticSan.Models +{ + /// The x-ms-delete-snapshots. + public readonly partial struct XMsDeleteSnapshot : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public XMsDeleteSnapshot(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "true"; + private const string FalseValue = "false"; + + /// true. + public static XMsDeleteSnapshot True { get; } = new XMsDeleteSnapshot(TrueValue); + /// false. + public static XMsDeleteSnapshot False { get; } = new XMsDeleteSnapshot(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(XMsDeleteSnapshot left, XMsDeleteSnapshot right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(XMsDeleteSnapshot left, XMsDeleteSnapshot right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator XMsDeleteSnapshot(string value) => new XMsDeleteSnapshot(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is XMsDeleteSnapshot other && Equals(other); + /// + public bool Equals(XMsDeleteSnapshot 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsForceDelete.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsForceDelete.cs new file mode 100644 index 000000000000..b7d411c9b510 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsForceDelete.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.ElasticSan.Models +{ + /// The x-ms-force-delete. + public readonly partial struct XMsForceDelete : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public XMsForceDelete(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "true"; + private const string FalseValue = "false"; + + /// true. + public static XMsForceDelete True { get; } = new XMsForceDelete(TrueValue); + /// false. + public static XMsForceDelete False { get; } = new XMsForceDelete(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(XMsForceDelete left, XMsForceDelete right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(XMsForceDelete left, XMsForceDelete right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator XMsForceDelete(string value) => new XMsForceDelete(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is XMsForceDelete other && Equals(other); + /// + public bool Equals(XMsForceDelete 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSanManagementRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSanManagementRestOperations.cs deleted file mode 100644 index b7571ef2fe7c..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSanManagementRestOperations.cs +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.ElasticSan -{ - internal partial class ElasticSanManagementRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of ElasticSanManagementRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public ElasticSanManagementRestOperations(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-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateRestoreVolumeRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) - { - 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.ElasticSan/elasticSans/", false); - uri.AppendPath(elasticSanName, true); - uri.AppendPath("/volumegroups/", false); - uri.AppendPath(volumeGroupName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/restore", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateRestoreVolumeRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); - uri.AppendPath(elasticSanName, true); - uri.AppendPath("/volumegroups/", false); - uri.AppendPath(volumeGroupName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/restore", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Restore Soft Deleted Volumes. The volume name is obtained by using the API to list soft deleted volumes by volume group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the ElasticSan. - /// The name of the VolumeGroup. - /// The name of the Volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task RestoreVolumeAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateRestoreVolumeRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Restore Soft Deleted Volumes. The volume name is obtained by using the API to list soft deleted volumes by volume group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the ElasticSan. - /// The name of the VolumeGroup. - /// The name of the Volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response RestoreVolume(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateRestoreVolumeRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSansRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSansRestOperations.cs index 0d99a2becdaa..61867da46dbb 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSansRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSansRestOperations.cs @@ -25,8 +25,8 @@ internal partial class ElasticSansRestOperations /// Initializes a new instance of ElasticSansRestOperations. /// 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 ElasticSansRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { @@ -36,85 +36,7 @@ public ElasticSansRestOperations(HttpPipeline pipeline, string applicationId, Ur _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListBySubscriptionRequest(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.ElasticSan/elasticSans", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets a list of ElasticSans in a subscription. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ElasticSanList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanList.DeserializeElasticSanList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of ElasticSans in a subscription. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ElasticSanList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanList.DeserializeElasticSanList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -122,12 +44,13 @@ internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscripti uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans", false); + uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); + uri.AppendPath(elasticSanName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -138,7 +61,8 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans", false); + uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); + uri.AppendPath(elasticSanName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -146,55 +70,63 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str return message; } - /// Gets a list of ElasticSan in a resource group. - /// The ID of the target subscription. + /// Get a ElasticSan. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string elasticSanName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticSanList value = default; + ElasticSanData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanList.DeserializeElasticSanList(document.RootElement); + value = ElasticSanData.DeserializeElasticSanData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ElasticSanData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets a list of ElasticSan in a resource group. - /// The ID of the target subscription. + /// Get a ElasticSan. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string elasticSanName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticSanList value = default; + ElasticSanData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanList.DeserializeElasticSanList(document.RootElement); + value = ElasticSanData.DeserializeElasticSanData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ElasticSanData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -239,7 +171,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Create ElasticSan. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// Elastic San object. @@ -266,7 +198,7 @@ public async Task CreateAsync(string subscriptionId, string resourceGr } /// Create ElasticSan. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// Elastic San object. @@ -331,7 +263,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update a Elastic San. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// Elastic San object. @@ -358,7 +290,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update a Elastic San. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// Elastic San object. @@ -419,7 +351,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Delete a Elastic San. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The cancellation token to use. @@ -445,7 +377,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Delete a Elastic San. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The cancellation token to use. @@ -470,7 +402,171 @@ public Response Delete(string subscriptionId, string resourceGroupName, string e } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName) + internal RequestUriBuilder CreateListByResourceGroupRequestUri(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.ElasticSan/elasticSans", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + 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.ElasticSan/elasticSans", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of ElasticSan in a 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. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ElasticSanList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticSanList.DeserializeElasticSanList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of ElasticSan in a 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. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ElasticSanList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticSanList.DeserializeElasticSanList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(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.ElasticSan/elasticSans", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of ElasticSans in a subscription. + /// 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> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ElasticSanList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticSanList.DeserializeElasticSanList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of ElasticSans in a subscription. + /// 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 ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ElasticSanList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticSanList.DeserializeElasticSanList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByElasticSanRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -480,11 +576,12 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); uri.AppendPath(elasticSanName, true); + uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName) + internal HttpMessage CreateListByElasticSanRequest(string subscriptionId, string resourceGroupName, string elasticSanName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -497,6 +594,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); uri.AppendPath(elasticSanName, true); + uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -504,63 +602,139 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Get a ElasticSan. - /// The ID of the target subscription. + /// Gets the private link resources that need to be created for a elastic San. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// 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 elasticSanName, CancellationToken cancellationToken = default) + public async Task> ListByElasticSanAsync(string subscriptionId, string resourceGroupName, string elasticSanName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName); + using var message = CreateListByElasticSanRequest(subscriptionId, resourceGroupName, elasticSanName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticSanData value = default; + ElasticSanPrivateLinkResourceListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanData.DeserializeElasticSanData(document.RootElement); + value = ElasticSanPrivateLinkResourceListResult.DeserializeElasticSanPrivateLinkResourceListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ElasticSanData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a ElasticSan. - /// The ID of the target subscription. + /// Gets the private link resources that need to be created for a elastic San. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// 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 elasticSanName, CancellationToken cancellationToken = default) + public Response ListByElasticSan(string subscriptionId, string resourceGroupName, string elasticSanName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName); + using var message = CreateListByElasticSanRequest(subscriptionId, resourceGroupName, elasticSanName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticSanData value = default; + ElasticSanPrivateLinkResourceListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanData.DeserializeElasticSanData(document.RootElement); + value = ElasticSanPrivateLinkResourceListResult.DeserializeElasticSanPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + 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; + } + + /// Gets a list of ElasticSan in a 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. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ElasticSanList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticSanList.DeserializeElasticSanList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of ElasticSan in a 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. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(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 = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ElasticSanList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticSanList.DeserializeElasticSanList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ElasticSanData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -590,7 +764,7 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st /// Gets a list of ElasticSans in a subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// 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. @@ -617,7 +791,7 @@ public async Task> ListBySubscriptionNextPageAsync(stri /// Gets a list of ElasticSans in a subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// 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. @@ -642,7 +816,7 @@ public Response ListBySubscriptionNextPage(string nextLink, stri } } - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + internal RequestUriBuilder CreateListByElasticSanNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -650,7 +824,7 @@ internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string ne return uri; } - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + internal HttpMessage CreateListByElasticSanNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -664,28 +838,30 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s return message; } - /// Gets a list of ElasticSan in a resource group. + /// Gets the private link resources that need to be created for a elastic San. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByElasticSanNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + using var message = CreateListByElasticSanNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticSanList value = default; + ElasticSanPrivateLinkResourceListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanList.DeserializeElasticSanList(document.RootElement); + value = ElasticSanPrivateLinkResourceListResult.DeserializeElasticSanPrivateLinkResourceListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -693,28 +869,30 @@ public async Task> ListByResourceGroupNextPageAsync(str } } - /// Gets a list of ElasticSan in a resource group. + /// Gets the private link resources that need to be created for a elastic San. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByElasticSanNextPage(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + using var message = CreateListByElasticSanNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticSanList value = default; + ElasticSanPrivateLinkResourceListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanList.DeserializeElasticSanList(document.RootElement); + value = ElasticSanPrivateLinkResourceListResult.DeserializeElasticSanPrivateLinkResourceListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 66c3b1916943..12822dfc5413 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -25,8 +25,8 @@ internal partial class PrivateEndpointConnectionsRestOperations /// Initializes a new instance of PrivateEndpointConnectionsRestOperations. /// 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 PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { @@ -36,7 +36,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -52,11 +52,11 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -70,73 +70,77 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG 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 the state of specified private endpoint connection associated with the Elastic San. - /// The ID of the target subscription. + /// Gets the specified private endpoint connection associated with the Elastic San. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the Private Endpoint connection. - /// Private Endpoint Connection Approval object. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, elasticSanName, privateEndpointConnectionName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, privateEndpointConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + ElasticSanPrivateEndpointConnectionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticSanPrivateEndpointConnectionData.DeserializeElasticSanPrivateEndpointConnectionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ElasticSanPrivateEndpointConnectionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Update the state of specified private endpoint connection associated with the Elastic San. - /// The ID of the target subscription. + /// Gets the specified private endpoint connection associated with the Elastic San. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the Private Endpoint connection. - /// Private Endpoint Connection Approval object. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, elasticSanName, privateEndpointConnectionName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, privateEndpointConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + ElasticSanPrivateEndpointConnectionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticSanPrivateEndpointConnectionData.DeserializeElasticSanPrivateEndpointConnectionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ElasticSanPrivateEndpointConnectionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -152,11 +156,11 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -170,71 +174,67 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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; } - /// Gets the specified private endpoint connection associated with the Elastic San. - /// The ID of the target subscription. + /// Update the state of specified private endpoint connection associated with the Elastic San. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the Private Endpoint connection. + /// Private Endpoint Connection Approval object. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, privateEndpointConnectionName); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, elasticSanName, privateEndpointConnectionName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ElasticSanPrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanPrivateEndpointConnectionData.DeserializeElasticSanPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ElasticSanPrivateEndpointConnectionData)null, message.Response); + case 201: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets the specified private endpoint connection associated with the Elastic San. - /// The ID of the target subscription. + /// Update the state of specified private endpoint connection associated with the Elastic San. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the Private Endpoint connection. + /// Private Endpoint Connection Approval object. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public Response Create(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName, ElasticSanPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, privateEndpointConnectionName); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, elasticSanName, privateEndpointConnectionName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ElasticSanPrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanPrivateEndpointConnectionData.DeserializeElasticSanPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ElasticSanPrivateEndpointConnectionData)null, message.Response); + case 201: + return message.Response; default: throw new RequestFailedException(message.Response); } @@ -279,7 +279,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified private endpoint connection associated with the Elastic San. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the Private Endpoint connection. @@ -307,7 +307,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified private endpoint connection associated with the Elastic San. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the Private Endpoint connection. @@ -371,7 +371,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// List all Private Endpoint Connections associated with the Elastic San. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The cancellation token to use. @@ -400,7 +400,7 @@ public async Task> ListA } /// List all Private Endpoint Connections associated with the Elastic San. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The cancellation token to use. @@ -427,5 +427,89 @@ public Response List(string subsc throw new RequestFailedException(message.Response); } } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName) + { + 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 all Private Endpoint Connections associated with the Elastic San. + /// 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 name of the ElasticSan. + /// 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 elasticSanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ElasticSanPrivateEndpointConnectionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticSanPrivateEndpointConnectionListResult.DeserializeElasticSanPrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all Private Endpoint Connections associated with the Elastic San. + /// 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 name of the ElasticSan. + /// 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 elasticSanName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ElasticSanPrivateEndpointConnectionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticSanPrivateEndpointConnectionListResult.DeserializeElasticSanPrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs deleted file mode 100644 index 5c737432467d..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.ElasticSan.Models; - -namespace Azure.ResourceManager.ElasticSan -{ - internal partial class PrivateLinkResourcesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of PrivateLinkResourcesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public PrivateLinkResourcesRestOperations(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-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListByElasticSanRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName) - { - 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.ElasticSan/elasticSans/", false); - uri.AppendPath(elasticSanName, true); - uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByElasticSanRequest(string subscriptionId, string resourceGroupName, string elasticSanName) - { - 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.ElasticSan/elasticSans/", false); - uri.AppendPath(elasticSanName, true); - uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets the private link resources that need to be created for a elastic San. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the ElasticSan. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByElasticSanAsync(string subscriptionId, string resourceGroupName, string elasticSanName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - - using var message = CreateListByElasticSanRequest(subscriptionId, resourceGroupName, elasticSanName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ElasticSanPrivateLinkResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanPrivateLinkResourceListResult.DeserializeElasticSanPrivateLinkResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the private link resources that need to be created for a elastic San. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the ElasticSan. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByElasticSan(string subscriptionId, string resourceGroupName, string elasticSanName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - - using var message = CreateListByElasticSanRequest(subscriptionId, resourceGroupName, elasticSanName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ElasticSanPrivateLinkResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanPrivateLinkResourceListResult.DeserializeElasticSanPrivateLinkResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SkusOperationGroupRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SkusOperationGroupRestOperations.cs new file mode 100644 index 000000000000..d09eea1ea001 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SkusOperationGroupRestOperations.cs @@ -0,0 +1,205 @@ +// 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.ElasticSan.Models; + +namespace Azure.ResourceManager.ElasticSan +{ + internal partial class SkusOperationGroupRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SkusOperationGroupRestOperations. + /// 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 SkusOperationGroupRestOperations(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-07-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ElasticSan/skus", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string filter) + { + 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.ElasticSan/skus", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the available Skus in the region and information related to them. + /// The ID of the target subscription. The value must be an UUID. + /// Specify $filter='location eq <location>' to filter on location. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SkuInformationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SkuInformationList.DeserializeSkuInformationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the available Skus in the region and information related to them. + /// The ID of the target subscription. The value must be an UUID. + /// Specify $filter='location eq <location>' to filter on location. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SkuInformationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SkuInformationList.DeserializeSkuInformationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string filter) + { + 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 all the available Skus in the region and information related to them. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Specify $filter='location eq <location>' to filter on location. + /// 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, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SkuInformationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SkuInformationList.DeserializeSkuInformationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the available Skus in the region and information related to them. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Specify $filter='location eq <location>' to filter on location. + /// 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, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SkuInformationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SkuInformationList.DeserializeSkuInformationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SkusRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SkusRestOperations.cs deleted file mode 100644 index d6584367e0c5..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SkusRestOperations.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.ElasticSan.Models; - -namespace Azure.ResourceManager.ElasticSan -{ - 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. - /// server parameter. - /// Api Version. - /// 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-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string filter) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.ElasticSan/skus", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string filter) - { - 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.ElasticSan/skus", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List all the available Skus in the region and information related to them. - /// The ID of the target subscription. - /// Specify $filter='location eq <location>' to filter on location. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ElasticSanSkuInformationList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanSkuInformationList.DeserializeElasticSanSkuInformationList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List all the available Skus in the region and information related to them. - /// The ID of the target subscription. - /// Specify $filter='location eq <location>' to filter on location. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ElasticSanSkuInformationList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanSkuInformationList.DeserializeElasticSanSkuInformationList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeSnapshotsRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SnapshotsRestOperations.cs similarity index 94% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeSnapshotsRestOperations.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SnapshotsRestOperations.cs index e332490a61d2..245c0816cde3 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeSnapshotsRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SnapshotsRestOperations.cs @@ -15,20 +15,20 @@ namespace Azure.ResourceManager.ElasticSan { - internal partial class VolumeSnapshotsRestOperations + internal partial class SnapshotsRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of VolumeSnapshotsRestOperations. + /// Initializes a new instance of SnapshotsRestOperations. /// 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 VolumeSnapshotsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public SnapshotsRestOperations(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"); @@ -36,7 +36,7 @@ public VolumeSnapshotsRestOperations(HttpPipeline pipeline, string applicationId _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByVolumeGroupRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -48,16 +48,13 @@ internal RequestUriBuilder CreateListByVolumeGroupRequestUri(string subscription uri.AppendPath(elasticSanName, true); uri.AppendPath("/volumegroups/", false); uri.AppendPath(volumeGroupName, true); - uri.AppendPath("/snapshots", false); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } + uri.AppendPath("/snapshots/", false); + uri.AppendPath(snapshotName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListByVolumeGroupRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -72,11 +69,8 @@ internal HttpMessage CreateListByVolumeGroupRequest(string subscriptionId, strin uri.AppendPath(elasticSanName, true); uri.AppendPath("/volumegroups/", false); uri.AppendPath(volumeGroupName, true); - uri.AppendPath("/snapshots", false); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } + uri.AppendPath("/snapshots/", false); + uri.AppendPath(snapshotName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -84,71 +78,77 @@ internal HttpMessage CreateListByVolumeGroupRequest(string subscriptionId, strin return message; } - /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter. - /// The ID of the target subscription. + /// Get a Volume Snapshot. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. - /// Specify $filter='volumeName eq <volume name>' to filter on volume. + /// The name of the volume snapshot within the given volume group. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByVolumeGroupAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter = null, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - using var message = CreateListByVolumeGroupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, filter); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - SnapshotList value = default; + SnapshotData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SnapshotList.DeserializeSnapshotList(document.RootElement); + value = SnapshotData.DeserializeSnapshotData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((SnapshotData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter. - /// The ID of the target subscription. + /// Get a Volume Snapshot. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. - /// Specify $filter='volumeName eq <volume name>' to filter on volume. + /// The name of the volume snapshot within the given volume group. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListByVolumeGroup(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter = null, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - using var message = CreateListByVolumeGroupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, filter); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - SnapshotList value = default; + SnapshotData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SnapshotList.DeserializeSnapshotList(document.RootElement); + value = SnapshotData.DeserializeSnapshotData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((SnapshotData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, ElasticSanSnapshotData data) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, SnapshotData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -166,7 +166,7 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, ElasticSanSnapshotData data) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, SnapshotData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -195,7 +195,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Create a Volume Snapshot. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -204,7 +204,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG /// 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 elasticSanName, string volumeGroupName, string snapshotName, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, SnapshotData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -226,7 +226,7 @@ public async Task CreateAsync(string subscriptionId, string resourceGr } /// Create a Volume Snapshot. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -235,7 +235,7 @@ public async Task CreateAsync(string subscriptionId, string resourceGr /// 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 elasticSanName, string volumeGroupName, string snapshotName, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + public Response Create(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, SnapshotData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -299,7 +299,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Delete a Volume Snapshot. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -329,7 +329,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Delete a Volume Snapshot. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -358,7 +358,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string e } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName) + internal RequestUriBuilder CreateListByVolumeGroupRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -370,13 +370,16 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(elasticSanName, true); uri.AppendPath("/volumegroups/", false); uri.AppendPath(volumeGroupName, true); - uri.AppendPath("/snapshots/", false); - uri.AppendPath(snapshotName, true); + uri.AppendPath("/snapshots", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName) + internal HttpMessage CreateListByVolumeGroupRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -391,80 +394,77 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(elasticSanName, true); uri.AppendPath("/volumegroups/", false); uri.AppendPath(volumeGroupName, true); - uri.AppendPath("/snapshots/", false); - uri.AppendPath(snapshotName, true); + uri.AppendPath("/snapshots", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get a Volume Snapshot. - /// The ID of the target subscription. + /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. - /// The name of the volume snapshot within the given volume group. + /// Specify $filter='volumeName eq <volume name>' to filter on volume. /// 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 elasticSanName, string volumeGroupName, string snapshotName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByVolumeGroupAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + using var message = CreateListByVolumeGroupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticSanSnapshotData value = default; + SnapshotList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(document.RootElement); + value = SnapshotList.DeserializeSnapshotList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ElasticSanSnapshotData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a Volume Snapshot. - /// The ID of the target subscription. + /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. - /// The name of the volume snapshot within the given volume group. + /// Specify $filter='volumeName eq <volume name>' to filter on volume. /// 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 elasticSanName, string volumeGroupName, string snapshotName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByVolumeGroup(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + using var message = CreateListByVolumeGroupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticSanSnapshotData value = default; + SnapshotList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(document.RootElement); + value = SnapshotList.DeserializeSnapshotList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ElasticSanSnapshotData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -494,7 +494,7 @@ internal HttpMessage CreateListByVolumeGroupNextPageRequest(string nextLink, str /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -528,7 +528,7 @@ public async Task> ListByVolumeGroupNextPageAsync(string /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeGroupsRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeGroupsRestOperations.cs index 7bf77da70200..f2d03d7f136d 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeGroupsRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeGroupsRestOperations.cs @@ -25,8 +25,8 @@ internal partial class VolumeGroupsRestOperations /// Initializes a new instance of VolumeGroupsRestOperations. /// 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 VolumeGroupsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { @@ -36,7 +36,7 @@ public VolumeGroupsRestOperations(HttpPipeline pipeline, string applicationId, U _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByElasticSanRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,12 +46,13 @@ internal RequestUriBuilder CreateListByElasticSanRequestUri(string subscriptionI uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); uri.AppendPath(elasticSanName, true); - uri.AppendPath("/volumeGroups", false); + uri.AppendPath("/volumegroups/", false); + uri.AppendPath(volumeGroupName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListByElasticSanRequest(string subscriptionId, string resourceGroupName, string elasticSanName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -64,79 +65,82 @@ internal HttpMessage CreateListByElasticSanRequest(string subscriptionId, string uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); uri.AppendPath(elasticSanName, true); - uri.AppendPath("/volumeGroups", false); + uri.AppendPath("/volumegroups/", false); + uri.AppendPath(volumeGroupName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - if (accessSoftDeletedResources != null) - { - request.Headers.Add("x-ms-access-soft-deleted-resources", accessSoftDeletedResources.Value.ToString()); - } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List VolumeGroups. - /// The ID of the target subscription. + /// Get an VolumeGroups. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. - /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. + /// The name of the VolumeGroup. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByElasticSanAsync(string subscriptionId, string resourceGroupName, string elasticSanName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var message = CreateListByElasticSanRequest(subscriptionId, resourceGroupName, elasticSanName, accessSoftDeletedResources); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticSanVolumeGroupList value = default; + VolumeGroupData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanVolumeGroupList.DeserializeElasticSanVolumeGroupList(document.RootElement); + value = VolumeGroupData.DeserializeVolumeGroupData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((VolumeGroupData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// List VolumeGroups. - /// The ID of the target subscription. + /// Get an VolumeGroups. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. - /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. + /// The name of the VolumeGroup. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByElasticSan(string subscriptionId, string resourceGroupName, string elasticSanName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var message = CreateListByElasticSanRequest(subscriptionId, resourceGroupName, elasticSanName, accessSoftDeletedResources); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticSanVolumeGroupList value = default; + VolumeGroupData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanVolumeGroupList.DeserializeElasticSanVolumeGroupList(document.RootElement); + value = VolumeGroupData.DeserializeVolumeGroupData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((VolumeGroupData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanVolumeGroupData data) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeGroupData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -152,7 +156,7 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanVolumeGroupData data) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeGroupData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -179,7 +183,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Create a Volume Group. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -187,7 +191,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG /// 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 elasticSanName, string volumeGroupName, ElasticSanVolumeGroupData data, CancellationToken cancellationToken = default) + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeGroupData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -208,7 +212,7 @@ public async Task CreateAsync(string subscriptionId, string resourceGr } /// Create a Volume Group. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -216,7 +220,7 @@ public async Task CreateAsync(string subscriptionId, string resourceGr /// 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 elasticSanName, string volumeGroupName, ElasticSanVolumeGroupData data, CancellationToken cancellationToken = default) + public Response Create(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeGroupData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -236,7 +240,7 @@ public Response Create(string subscriptionId, string resourceGroupName, string e } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanVolumeGroupPatch patch) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeGroupPatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -252,7 +256,7 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanVolumeGroupPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeGroupPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -279,7 +283,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update an VolumeGroup. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -287,7 +291,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// 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 elasticSanName, string volumeGroupName, ElasticSanVolumeGroupPatch patch, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeGroupPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -308,7 +312,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update an VolumeGroup. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -316,7 +320,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr /// 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 elasticSanName, string volumeGroupName, ElasticSanVolumeGroupPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeGroupPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -375,7 +379,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Delete an VolumeGroup. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -403,7 +407,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Delete an VolumeGroup. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. @@ -430,7 +434,107 @@ public Response Delete(string subscriptionId, string resourceGroupName, string e } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName) + internal RequestUriBuilder CreateListByElasticSanRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources) + { + 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.ElasticSan/elasticSans/", false); + uri.AppendPath(elasticSanName, true); + uri.AppendPath("/volumegroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByElasticSanRequest(string subscriptionId, string resourceGroupName, string elasticSanName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources) + { + 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.ElasticSan/elasticSans/", false); + uri.AppendPath(elasticSanName, true); + uri.AppendPath("/volumegroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (xMsAccessSoftDeletedResources != null) + { + request.Headers.Add("x-ms-access-soft-deleted-resources", xMsAccessSoftDeletedResources.Value.ToString()); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List VolumeGroups. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByElasticSanAsync(string subscriptionId, string resourceGroupName, string elasticSanName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + + using var message = CreateListByElasticSanRequest(subscriptionId, resourceGroupName, elasticSanName, xMsAccessSoftDeletedResources); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + VolumeGroupList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = VolumeGroupList.DeserializeVolumeGroupList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List VolumeGroups. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByElasticSan(string subscriptionId, string resourceGroupName, string elasticSanName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + + using var message = CreateListByElasticSanRequest(subscriptionId, resourceGroupName, elasticSanName, xMsAccessSoftDeletedResources); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + VolumeGroupList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = VolumeGroupList.DeserializeVolumeGroupList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreatePreBackupRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeNameList volumeNameList) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -442,15 +546,16 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(elasticSanName, true); uri.AppendPath("/volumegroups/", false); uri.AppendPath(volumeGroupName, true); + uri.AppendPath("/preBackup", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName) + internal HttpMessage CreatePreBackupRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeNameList volumeNameList) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -461,80 +566,179 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(elasticSanName, true); uri.AppendPath("/volumegroups/", false); uri.AppendPath(volumeGroupName, true); + uri.AppendPath("/preBackup", false); 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(volumeNameList, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Get an VolumeGroups. - /// The ID of the target subscription. + /// Validate whether a disk snapshot backup can be taken for list of volumes. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. + /// Volume Name List (currently only one volume name in the list is supported. Server would return error if list is bigger). /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, CancellationToken cancellationToken = default) + public async Task PreBackupAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeNameList volumeNameList, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNull(volumeNameList, nameof(volumeNameList)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + using var message = CreatePreBackupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeNameList); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { + case 202: case 200: - { - ElasticSanVolumeGroupData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanVolumeGroupData.DeserializeElasticSanVolumeGroupData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ElasticSanVolumeGroupData)null, message.Response); + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Get an VolumeGroups. - /// The ID of the target subscription. + /// Validate whether a disk snapshot backup can be taken for list of volumes. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. + /// Volume Name List (currently only one volume name in the list is supported. Server would return error if list is bigger). /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, CancellationToken cancellationToken = default) + public Response PreBackup(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, VolumeNameList volumeNameList, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNull(volumeNameList, nameof(volumeNameList)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + using var message = CreatePreBackupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeNameList); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { + case 202: case 200: - { - ElasticSanVolumeGroupData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanVolumeGroupData.DeserializeElasticSanVolumeGroupData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ElasticSanVolumeGroupData)null, message.Response); + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreatePreRestoreRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, DiskSnapshotList diskSnapshotList) + { + 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.ElasticSan/elasticSans/", false); + uri.AppendPath(elasticSanName, true); + uri.AppendPath("/volumegroups/", false); + uri.AppendPath(volumeGroupName, true); + uri.AppendPath("/preRestore", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreatePreRestoreRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, DiskSnapshotList diskSnapshotList) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); + uri.AppendPath(elasticSanName, true); + uri.AppendPath("/volumegroups/", false); + uri.AppendPath(volumeGroupName, true); + uri.AppendPath("/preRestore", false); + 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(diskSnapshotList, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Validate whether a list of backed up disk snapshots can be restored into ElasticSan volumes. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// Disk Snapshot List (currently only one Disk Snapshot in the list is supported and that the Disk Snapshot must be in same azure region as the ElasticSan. Server would return error if list is bigger). + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task PreRestoreAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, DiskSnapshotList diskSnapshotList, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNull(diskSnapshotList, nameof(diskSnapshotList)); + + using var message = CreatePreRestoreRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, diskSnapshotList); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Validate whether a list of backed up disk snapshots can be restored into ElasticSan volumes. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// Disk Snapshot List (currently only one Disk Snapshot in the list is supported and that the Disk Snapshot must be in same azure region as the ElasticSan. Server would return error if list is bigger). + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response PreRestore(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, DiskSnapshotList diskSnapshotList, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNull(diskSnapshotList, nameof(diskSnapshotList)); + + using var message = CreatePreRestoreRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, diskSnapshotList); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByElasticSanNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources) + internal RequestUriBuilder CreateListByElasticSanNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -542,7 +746,7 @@ internal RequestUriBuilder CreateListByElasticSanNextPageRequestUri(string nextL return uri; } - internal HttpMessage CreateListByElasticSanNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources) + internal HttpMessage CreateListByElasticSanNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -551,9 +755,9 @@ internal HttpMessage CreateListByElasticSanNextPageRequest(string nextLink, stri uri.Reset(_endpoint); uri.AppendRawNextLink(nextLink, false); request.Uri = uri; - if (accessSoftDeletedResources != null) + if (xMsAccessSoftDeletedResources != null) { - request.Headers.Add("x-ms-access-soft-deleted-resources", accessSoftDeletedResources.Value.ToString()); + request.Headers.Add("x-ms-access-soft-deleted-resources", xMsAccessSoftDeletedResources.Value.ToString()); } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -562,29 +766,29 @@ internal HttpMessage CreateListByElasticSanNextPageRequest(string nextLink, stri /// List VolumeGroups. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. - /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. + /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByElasticSanNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + public async Task> ListByElasticSanNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - using var message = CreateListByElasticSanNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName, accessSoftDeletedResources); + using var message = CreateListByElasticSanNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName, xMsAccessSoftDeletedResources); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticSanVolumeGroupList value = default; + VolumeGroupList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanVolumeGroupList.DeserializeElasticSanVolumeGroupList(document.RootElement); + value = VolumeGroupList.DeserializeVolumeGroupList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -594,29 +798,29 @@ public async Task> ListByElasticSanNextPageA /// List VolumeGroups. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. - /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. + /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListByElasticSanNextPage(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + public Response ListByElasticSanNextPage(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - using var message = CreateListByElasticSanNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName, accessSoftDeletedResources); + using var message = CreateListByElasticSanNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName, xMsAccessSoftDeletedResources); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticSanVolumeGroupList value = default; + VolumeGroupList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanVolumeGroupList.DeserializeElasticSanVolumeGroupList(document.RootElement); + value = VolumeGroupList.DeserializeVolumeGroupList(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumesRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumesRestOperations.cs index 08032368909e..e360481694c6 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumesRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumesRestOperations.cs @@ -25,8 +25,8 @@ internal partial class VolumesRestOperations /// Initializes a new instance of VolumesRestOperations. /// 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 VolumesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { @@ -36,7 +36,7 @@ public VolumesRestOperations(HttpPipeline pipeline, string applicationId, Uri en _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanVolumeData data) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -54,11 +54,11 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanVolumeData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -74,77 +74,81 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG 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 Volume. - /// The ID of the target subscription. + /// Get an Volume. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. /// The name of the Volume. - /// Volume object. /// The cancellation token to use. - /// , , , , or is null. + /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanVolumeData data, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + VolumeData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = VolumeData.DeserializeVolumeData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((VolumeData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Create a Volume. - /// The ID of the target subscription. + /// Get an Volume. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. /// The name of the Volume. - /// Volume object. /// The cancellation token to use. - /// , , , , or is null. + /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanVolumeData data, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + VolumeData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = VolumeData.DeserializeVolumeData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((VolumeData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanVolumePatch patch) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, VolumeData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -162,11 +166,11 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanVolumePatch patch) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, VolumeData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -184,75 +188,75 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); request.Content = content; _userAgent.Apply(message); return message; } - /// Update an Volume. - /// The ID of the target subscription. + /// Create a Volume. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. /// The name of the Volume. - /// Volume object. + /// Volume object. /// The cancellation token to use. - /// , , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanVolumePatch patch, CancellationToken cancellationToken = default) + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, VolumeData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, patch); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Update an Volume. - /// The ID of the target subscription. + /// Create a Volume. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. /// The name of the Volume. - /// Volume object. + /// Volume object. /// The cancellation token to use. - /// , , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanVolumePatch patch, CancellationToken cancellationToken = default) + public Response Create(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, VolumeData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, patch); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanDeleteSnapshotsUnderVolume? deleteSnapshots, ElasticSanForceDeleteVolume? forceDelete, ElasticSanDeleteType? deleteType) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, VolumePatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -267,18 +271,14 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (deleteType != null) - { - uri.AppendQuery("deleteType", deleteType.Value.ToString(), true); - } return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanDeleteSnapshotsUnderVolume? deleteSnapshots, ElasticSanForceDeleteVolume? forceDelete, ElasticSanDeleteType? deleteType) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, VolumePatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -292,91 +292,79 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (deleteType != null) - { - uri.AppendQuery("deleteType", deleteType.Value.ToString(), true); - } request.Uri = uri; - if (deleteSnapshots != null) - { - request.Headers.Add("x-ms-delete-snapshots", deleteSnapshots.Value.ToString()); - } - if (forceDelete != null) - { - request.Headers.Add("x-ms-force-delete", forceDelete.Value.ToString()); - } request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Delete an Volume. - /// The ID of the target subscription. + /// Update an Volume. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. /// The name of the Volume. - /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. - /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. - /// Optional. Specifies that the delete operation should be a permanent delete for the soft deleted volume. The value of deleteType can only be 'permanent'. + /// Volume object. /// The cancellation token to use. - /// , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanDeleteSnapshotsUnderVolume? deleteSnapshots = null, ElasticSanForceDeleteVolume? forceDelete = null, ElasticSanDeleteType? deleteType = null, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, VolumePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, deleteSnapshots, forceDelete, deleteType); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, patch); 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 an Volume. - /// The ID of the target subscription. + /// Update an Volume. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. /// The name of the Volume. - /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. - /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. - /// Optional. Specifies that the delete operation should be a permanent delete for the soft deleted volume. The value of deleteType can only be 'permanent'. + /// Volume object. /// The cancellation token to use. - /// , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, ElasticSanDeleteSnapshotsUnderVolume? deleteSnapshots = null, ElasticSanForceDeleteVolume? forceDelete = null, ElasticSanDeleteType? deleteType = null, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, VolumePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, deleteSnapshots, forceDelete, deleteType); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, patch); _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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, XMsDeleteSnapshot? xMsDeleteSnapshots, XMsForceDelete? xMsForceDelete, DeleteType? deleteType) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -391,14 +379,18 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (deleteType != null) + { + uri.AppendQuery("deleteType", deleteType.Value.ToString(), true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, XMsDeleteSnapshot? xMsDeleteSnapshots, XMsForceDelete? xMsForceDelete, DeleteType? deleteType) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -412,22 +404,37 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (deleteType != null) + { + uri.AppendQuery("deleteType", deleteType.Value.ToString(), true); + } request.Uri = uri; + if (xMsDeleteSnapshots != null) + { + request.Headers.Add("x-ms-delete-snapshots", xMsDeleteSnapshots.Value.ToString()); + } + if (xMsForceDelete != null) + { + request.Headers.Add("x-ms-force-delete", xMsForceDelete.Value.ToString()); + } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get an Volume. - /// The ID of the target subscription. + /// Delete an Volume. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. /// The name of the Volume. + /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. + /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. + /// Optional. Specifies that the delete operation should be a permanent delete for the soft deleted volume. The value of deleteType can only be 'permanent'. /// 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 elasticSanName, string volumeGroupName, string volumeName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, XMsDeleteSnapshot? xMsDeleteSnapshots = null, XMsForceDelete? xMsForceDelete = null, DeleteType? deleteType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -435,34 +442,32 @@ public async Task> GetAsync(string subscriptionId Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, xMsDeleteSnapshots, xMsForceDelete, deleteType); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ElasticSanVolumeData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanVolumeData.DeserializeElasticSanVolumeData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ElasticSanVolumeData)null, message.Response); + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Get an Volume. - /// The ID of the target subscription. + /// Delete an Volume. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. /// The name of the Volume. + /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. + /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. + /// Optional. Specifies that the delete operation should be a permanent delete for the soft deleted volume. The value of deleteType can only be 'permanent'. /// 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 elasticSanName, string volumeGroupName, string volumeName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, XMsDeleteSnapshot? xMsDeleteSnapshots = null, XMsForceDelete? xMsForceDelete = null, DeleteType? deleteType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -470,25 +475,20 @@ public Response Get(string subscriptionId, string resource Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, xMsDeleteSnapshots, xMsForceDelete, deleteType); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ElasticSanVolumeData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanVolumeData.DeserializeElasticSanVolumeData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ElasticSanVolumeData)null, message.Response); + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByVolumeGroupRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources) + internal RequestUriBuilder CreateListByVolumeGroupRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -505,7 +505,7 @@ internal RequestUriBuilder CreateListByVolumeGroupRequestUri(string subscription return uri; } - internal HttpMessage CreateListByVolumeGroupRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources) + internal HttpMessage CreateListByVolumeGroupRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -523,9 +523,9 @@ internal HttpMessage CreateListByVolumeGroupRequest(string subscriptionId, strin uri.AppendPath("/volumes", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - if (accessSoftDeletedResources != null) + if (xMsAccessSoftDeletedResources != null) { - request.Headers.Add("x-ms-access-soft-deleted-resources", accessSoftDeletedResources.Value.ToString()); + request.Headers.Add("x-ms-access-soft-deleted-resources", xMsAccessSoftDeletedResources.Value.ToString()); } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -533,30 +533,30 @@ internal HttpMessage CreateListByVolumeGroupRequest(string subscriptionId, strin } /// List Volumes in a VolumeGroup. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. - /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. + /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByVolumeGroupAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + public async Task> ListByVolumeGroupAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var message = CreateListByVolumeGroupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, accessSoftDeletedResources); + using var message = CreateListByVolumeGroupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, xMsAccessSoftDeletedResources); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticSanVolumeList value = default; + VolumeList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanVolumeList.DeserializeElasticSanVolumeList(document.RootElement); + value = VolumeList.DeserializeVolumeList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -565,30 +565,30 @@ public async Task> ListByVolumeGroupAsync(string } /// List Volumes in a VolumeGroup. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. - /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. + /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListByVolumeGroup(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + public Response ListByVolumeGroup(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var message = CreateListByVolumeGroupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, accessSoftDeletedResources); + using var message = CreateListByVolumeGroupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, xMsAccessSoftDeletedResources); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticSanVolumeList value = default; + VolumeList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanVolumeList.DeserializeElasticSanVolumeList(document.RootElement); + value = VolumeList.DeserializeVolumeList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -596,7 +596,7 @@ public Response ListByVolumeGroup(string subscriptionId, s } } - internal RequestUriBuilder CreatePreBackupRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanVolumeNameListContent content) + internal RequestUriBuilder CreateRestoreVolumeRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -608,12 +608,14 @@ internal RequestUriBuilder CreatePreBackupRequestUri(string subscriptionId, stri uri.AppendPath(elasticSanName, true); uri.AppendPath("/volumegroups/", false); uri.AppendPath(volumeGroupName, true); - uri.AppendPath("/preBackup", false); + uri.AppendPath("/volumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/restore", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreatePreBackupRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanVolumeNameListContent content) + internal HttpMessage CreateRestoreVolumeRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -628,179 +630,75 @@ internal HttpMessage CreatePreBackupRequest(string subscriptionId, string resour uri.AppendPath(elasticSanName, true); uri.AppendPath("/volumegroups/", false); uri.AppendPath(volumeGroupName, true); - uri.AppendPath("/preBackup", false); + uri.AppendPath("/volumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/restore", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; _userAgent.Apply(message); return message; } - /// Validate whether a disk snapshot backup can be taken for list of volumes. - /// The ID of the target subscription. + /// Restore Soft Deleted Volumes. The volume name is obtained by using the API to list soft deleted volumes by volume 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 name of the ElasticSan. /// The name of the VolumeGroup. - /// Volume Name List (currently only one volume name in the list is supported. Server would return error if list is bigger). + /// The name of the Volume. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task PreBackupAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanVolumeNameListContent content, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task RestoreVolumeAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var message = CreatePreBackupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, content); + using var message = CreateRestoreVolumeRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Validate whether a disk snapshot backup can be taken for list of volumes. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the ElasticSan. - /// The name of the VolumeGroup. - /// Volume Name List (currently only one volume name in the list is supported. Server would return error if list is bigger). - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response PreBackup(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanVolumeNameListContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreatePreBackupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreatePreRestoreRequestUri(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, DiskSnapshotListContent content) - { - 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.ElasticSan/elasticSans/", false); - uri.AppendPath(elasticSanName, true); - uri.AppendPath("/volumegroups/", false); - uri.AppendPath(volumeGroupName, true); - uri.AppendPath("/preRestore", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreatePreRestoreRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, DiskSnapshotListContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); - uri.AppendPath(elasticSanName, true); - uri.AppendPath("/volumegroups/", false); - uri.AppendPath(volumeGroupName, true); - uri.AppendPath("/preRestore", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Validate whether a list of backed up disk snapshots can be restored into ElasticSan volumes. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the ElasticSan. - /// The name of the VolumeGroup. - /// Disk Snapshot List (currently only one Disk Snapshot in the list is supported and that the Disk Snapshot must be in same azure region as the ElasticSan. Server would return error if list is bigger). - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task PreRestoreAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, DiskSnapshotListContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreatePreRestoreRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { case 200: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Validate whether a list of backed up disk snapshots can be restored into ElasticSan volumes. - /// The ID of the target subscription. + /// Restore Soft Deleted Volumes. The volume name is obtained by using the API to list soft deleted volumes by volume 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 name of the ElasticSan. /// The name of the VolumeGroup. - /// Disk Snapshot List (currently only one Disk Snapshot in the list is supported and that the Disk Snapshot must be in same azure region as the ElasticSan. Server would return error if list is bigger). + /// The name of the Volume. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response PreRestore(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, DiskSnapshotListContent content, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response RestoreVolume(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var message = CreatePreRestoreRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, content); + using var message = CreateRestoreVolumeRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: case 202: + case 200: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByVolumeGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources) + internal RequestUriBuilder CreateListByVolumeGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -808,7 +706,7 @@ internal RequestUriBuilder CreateListByVolumeGroupNextPageRequestUri(string next return uri; } - internal HttpMessage CreateListByVolumeGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources) + internal HttpMessage CreateListByVolumeGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -817,9 +715,9 @@ internal HttpMessage CreateListByVolumeGroupNextPageRequest(string nextLink, str uri.Reset(_endpoint); uri.AppendRawNextLink(nextLink, false); request.Uri = uri; - if (accessSoftDeletedResources != null) + if (xMsAccessSoftDeletedResources != null) { - request.Headers.Add("x-ms-access-soft-deleted-resources", accessSoftDeletedResources.Value.ToString()); + request.Headers.Add("x-ms-access-soft-deleted-resources", xMsAccessSoftDeletedResources.Value.ToString()); } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -828,15 +726,15 @@ internal HttpMessage CreateListByVolumeGroupNextPageRequest(string nextLink, str /// List Volumes in a VolumeGroup. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. - /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. + /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByVolumeGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + public async Task> ListByVolumeGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -844,15 +742,15 @@ public async Task> ListByVolumeGroupNextPageAsync Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var message = CreateListByVolumeGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, accessSoftDeletedResources); + using var message = CreateListByVolumeGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, xMsAccessSoftDeletedResources); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticSanVolumeList value = default; + VolumeList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticSanVolumeList.DeserializeElasticSanVolumeList(document.RootElement); + value = VolumeList.DeserializeVolumeList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -862,15 +760,15 @@ public async Task> ListByVolumeGroupNextPageAsync /// List Volumes in a VolumeGroup. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the ElasticSan. /// The name of the VolumeGroup. - /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. + /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListByVolumeGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + public Response ListByVolumeGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -878,15 +776,15 @@ public Response ListByVolumeGroupNextPage(string nextLink, Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var message = CreateListByVolumeGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, accessSoftDeletedResources); + using var message = CreateListByVolumeGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, xMsAccessSoftDeletedResources); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticSanVolumeList value = default; + VolumeList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticSanVolumeList.DeserializeElasticSanVolumeList(document.RootElement); + value = VolumeList.DeserializeVolumeList(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotCollection.cs similarity index 62% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotCollection.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotCollection.cs index 14e9eff392e6..88119ca8e127 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotCollection.cs @@ -18,28 +18,28 @@ namespace Azure.ResourceManager.ElasticSan { /// - /// 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 GetElasticSanSnapshots 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 GetSnapshots method from an instance of . /// - public partial class ElasticSanSnapshotCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class SnapshotCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _elasticSanSnapshotVolumeSnapshotsClientDiagnostics; - private readonly VolumeSnapshotsRestOperations _elasticSanSnapshotVolumeSnapshotsRestClient; + private readonly ClientDiagnostics _snapshotClientDiagnostics; + private readonly SnapshotsRestOperations _snapshotRestClient; - /// Initializes a new instance of the class for mocking. - protected ElasticSanSnapshotCollection() + /// Initializes a new instance of the class for mocking. + protected SnapshotCollection() { } - /// 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 ElasticSanSnapshotCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal SnapshotCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticSanSnapshotVolumeSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ElasticSanSnapshotResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ElasticSanSnapshotResource.ResourceType, out string elasticSanSnapshotVolumeSnapshotsApiVersion); - _elasticSanSnapshotVolumeSnapshotsRestClient = new VolumeSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticSanSnapshotVolumeSnapshotsApiVersion); + _snapshotClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", SnapshotResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SnapshotResource.ResourceType, out string snapshotApiVersion); + _snapshotRestClient = new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, snapshotApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -47,8 +47,8 @@ internal ElasticSanSnapshotCollection(ArmClient client, ResourceIdentifier id) : internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ElasticSanVolumeGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ElasticSanVolumeGroupResource.ResourceType), nameof(id)); + if (id.ResourceType != VolumeGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, VolumeGroupResource.ResourceType), nameof(id)); } /// @@ -60,7 +60,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// VolumeSnapshots_Create + /// Snapshot_Create /// /// /// Default Api Version @@ -68,7 +68,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Resource - /// + /// /// /// /// @@ -78,19 +78,19 @@ 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 snapshotName, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + public virtual async Task CreateOrUpdateAsync(WaitUntil waitUntil, string snapshotName, SnapshotData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.CreateOrUpdate"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(new ElasticSanSnapshotOperationSource(Client), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data).Request, response, OperationFinalStateVia.Location); + var response = await _snapshotRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(_snapshotClientDiagnostics, Pipeline, _snapshotRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data).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) @@ -109,7 +109,7 @@ public virtual async Task> CreateOrUpda /// /// /// Operation Id - /// VolumeSnapshots_Create + /// Snapshot_Create /// /// /// Default Api Version @@ -117,7 +117,7 @@ public virtual async Task> CreateOrUpda /// /// /// Resource - /// + /// /// /// /// @@ -127,19 +127,19 @@ public virtual async Task> CreateOrUpda /// 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 snapshotName, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string snapshotName, SnapshotData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.CreateOrUpdate"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotCollection.CreateOrUpdate"); scope.Start(); try { - var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanSnapshotOperationSource(Client), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data).Request, response, OperationFinalStateVia.Location); + var response = _snapshotRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data, cancellationToken); + var operation = new ElasticSanArmOperation(_snapshotClientDiagnostics, Pipeline, _snapshotRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) @@ -158,7 +158,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Operation Id - /// VolumeSnapshots_Get + /// Snapshot_Get /// /// /// Default Api Version @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Resource - /// + /// /// /// /// @@ -174,18 +174,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string snapshotName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string snapshotName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.Get"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotCollection.Get"); scope.Start(); try { - var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken).ConfigureAwait(false); + var response = await _snapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -203,7 +203,7 @@ public virtual async Task> GetAsync(string /// /// /// Operation Id - /// VolumeSnapshots_Get + /// Snapshot_Get /// /// /// Default Api Version @@ -211,7 +211,7 @@ public virtual async Task> GetAsync(string /// /// /// Resource - /// + /// /// /// /// @@ -219,18 +219,18 @@ public virtual async Task> GetAsync(string /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string snapshotName, CancellationToken cancellationToken = default) + public virtual Response Get(string snapshotName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.Get"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotCollection.Get"); scope.Start(); try { - var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken); + var response = _snapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -248,7 +248,7 @@ public virtual Response Get(string snapshotName, Can /// /// /// Operation Id - /// VolumeSnapshots_ListByVolumeGroup + /// Snapshot_ListByVolumeGroup /// /// /// Default Api Version @@ -256,18 +256,18 @@ public virtual Response Get(string snapshotName, Can /// /// /// Resource - /// + /// /// /// /// /// Specify $filter='volumeName eq <volume name>' to filter on volume. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanSnapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanSnapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticSanSnapshotResource(Client, ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(e)), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, "ElasticSanSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _snapshotRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _snapshotRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), _snapshotClientDiagnostics, Pipeline, "SnapshotCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -279,7 +279,7 @@ public virtual AsyncPageable GetAllAsync(string filt /// /// /// Operation Id - /// VolumeSnapshots_ListByVolumeGroup + /// Snapshot_ListByVolumeGroup /// /// /// Default Api Version @@ -287,18 +287,18 @@ public virtual AsyncPageable GetAllAsync(string filt /// /// /// Resource - /// + /// /// /// /// /// Specify $filter='volumeName eq <volume name>' to filter on volume. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanSnapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanSnapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticSanSnapshotResource(Client, ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(e)), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, "ElasticSanSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _snapshotRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _snapshotRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), _snapshotClientDiagnostics, Pipeline, "SnapshotCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -310,7 +310,7 @@ public virtual Pageable GetAll(string filter = null, /// /// /// Operation Id - /// VolumeSnapshots_Get + /// Snapshot_Get /// /// /// Default Api Version @@ -318,7 +318,7 @@ public virtual Pageable GetAll(string filter = null, /// /// /// Resource - /// + /// /// /// /// @@ -330,11 +330,11 @@ public virtual async Task> ExistsAsync(string snapshotName, Cance { Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.Exists"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotCollection.Exists"); scope.Start(); try { - var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _snapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -353,7 +353,7 @@ public virtual async Task> ExistsAsync(string snapshotName, Cance /// /// /// Operation Id - /// VolumeSnapshots_Get + /// Snapshot_Get /// /// /// Default Api Version @@ -361,7 +361,7 @@ public virtual async Task> ExistsAsync(string snapshotName, Cance /// /// /// Resource - /// + /// /// /// /// @@ -373,11 +373,11 @@ public virtual Response Exists(string snapshotName, CancellationToken canc { Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.Exists"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotCollection.Exists"); scope.Start(); try { - var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken); + var response = _snapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -396,7 +396,7 @@ public virtual Response Exists(string snapshotName, CancellationToken canc /// /// /// Operation Id - /// VolumeSnapshots_Get + /// Snapshot_Get /// /// /// Default Api Version @@ -404,7 +404,7 @@ public virtual Response Exists(string snapshotName, CancellationToken canc /// /// /// Resource - /// + /// /// /// /// @@ -412,18 +412,18 @@ public virtual Response Exists(string snapshotName, CancellationToken canc /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string snapshotName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string snapshotName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.GetIfExists"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotCollection.GetIfExists"); scope.Start(); try { - var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _snapshotRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -441,7 +441,7 @@ public virtual async Task> GetIfExi /// /// /// Operation Id - /// VolumeSnapshots_Get + /// Snapshot_Get /// /// /// Default Api Version @@ -449,7 +449,7 @@ public virtual async Task> GetIfExi /// /// /// Resource - /// + /// /// /// /// @@ -457,18 +457,18 @@ public virtual async Task> GetIfExi /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string snapshotName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string snapshotName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.GetIfExists"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotCollection.GetIfExists"); scope.Start(); try { - var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken); + var response = _snapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -477,7 +477,7 @@ public virtual NullableResponse GetIfExists(string s } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -487,7 +487,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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotData.Serialization.cs similarity index 74% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotData.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotData.Serialization.cs index dcd44ff01771..2a030a47af3e 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotData.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ElasticSan { - public partial class ElasticSanSnapshotData : IUtf8JsonSerializable, IJsonModel + public partial class SnapshotData : 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, ModelReader /// 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(ElasticSanSnapshotData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(SnapshotData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -59,19 +59,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteEndObject(); } - ElasticSanSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + SnapshotData 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(ElasticSanSnapshotData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(SnapshotData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanSnapshotData(document.RootElement, options); + return DeserializeSnapshotData(document.RootElement, options); } - internal static ElasticSanSnapshotData DeserializeElasticSanSnapshotData(JsonElement element, ModelReaderWriterOptions options = null) + internal static SnapshotData DeserializeSnapshotData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -83,8 +83,8 @@ internal static ElasticSanSnapshotData DeserializeElasticSanSnapshotData(JsonEle string name = default; ResourceType type = default; SystemData systemData = default; - SnapshotCreationInfo creationData = default; - ElasticSanProvisioningState? provisioningState = default; + SnapshotCreationContent creationData = default; + ProvisioningState? provisioningState = default; long? sourceVolumeSizeGiB = default; string volumeName = default; IDictionary serializedAdditionalRawData = default; @@ -126,7 +126,7 @@ internal static ElasticSanSnapshotData DeserializeElasticSanSnapshotData(JsonEle { if (property0.NameEquals("creationData"u8)) { - creationData = SnapshotCreationInfo.DeserializeSnapshotCreationInfo(property0.Value, options); + creationData = SnapshotCreationContent.DeserializeSnapshotCreationContent(property0.Value, options); continue; } if (property0.NameEquals("provisioningState"u8)) @@ -135,7 +135,7 @@ internal static ElasticSanSnapshotData DeserializeElasticSanSnapshotData(JsonEle { continue; } - provisioningState = new ElasticSanProvisioningState(property0.Value.GetString()); + provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("sourceVolumeSizeGiB"u8)) @@ -161,7 +161,7 @@ internal static ElasticSanSnapshotData DeserializeElasticSanSnapshotData(JsonEle } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanSnapshotData( + return new SnapshotData( id, name, type, @@ -173,35 +173,35 @@ internal static ElasticSanSnapshotData DeserializeElasticSanSnapshotData(JsonEle 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanSnapshotData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(SnapshotData)} does not support writing '{options.Format}' format."); } } - ElasticSanSnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + SnapshotData 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 DeserializeElasticSanSnapshotData(document.RootElement, options); + return DeserializeSnapshotData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanSnapshotData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(SnapshotData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotData.cs similarity index 76% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotData.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotData.cs index 3b46c18ba214..95c36f3eaadf 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotData.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotData.cs @@ -14,10 +14,10 @@ namespace Azure.ResourceManager.ElasticSan { /// - /// A class representing the ElasticSanSnapshot data model. + /// A class representing the Snapshot data model. /// Response for Volume Snapshot request. /// - public partial class ElasticSanSnapshotData : ResourceData + public partial class SnapshotData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,17 +51,17 @@ public partial class ElasticSanSnapshotData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Data used when creating a volume snapshot. /// is null. - public ElasticSanSnapshotData(SnapshotCreationInfo creationData) + public SnapshotData(SnapshotCreationContent creationData) { Argument.AssertNotNull(creationData, nameof(creationData)); CreationData = creationData; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -71,7 +71,7 @@ public ElasticSanSnapshotData(SnapshotCreationInfo creationData) /// Size of Source Volume. /// Source Volume Name of a snapshot. /// Keeps track of any properties unknown to the library. - internal ElasticSanSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SnapshotCreationInfo creationData, ElasticSanProvisioningState? provisioningState, long? sourceVolumeSizeGiB, string volumeName, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal SnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SnapshotCreationContent creationData, ProvisioningState? provisioningState, long? sourceVolumeSizeGiB, string volumeName, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { CreationData = creationData; ProvisioningState = provisioningState; @@ -80,22 +80,22 @@ internal ElasticSanSnapshotData(ResourceIdentifier id, string name, ResourceType _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ElasticSanSnapshotData() + /// Initializes a new instance of for deserialization. + internal SnapshotData() { } /// Data used when creating a volume snapshot. - internal SnapshotCreationInfo CreationData { get; set; } + internal SnapshotCreationContent CreationData { get; set; } /// Fully qualified resource ID of the volume. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". - public ResourceIdentifier CreationDataSourceId + public string CreationDataSourceId { get => CreationData is null ? default : CreationData.SourceId; - set => CreationData = new SnapshotCreationInfo(value); + set => CreationData = new SnapshotCreationContent(value); } /// State of the operation on the resource. - public ElasticSanProvisioningState? ProvisioningState { get; } + public ProvisioningState? ProvisioningState { get; } /// Size of Source Volume. public long? SourceVolumeSizeGiB { get; } /// Source Volume Name of a snapshot. diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotResource.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotResource.Serialization.cs new file mode 100644 index 000000000000..b4f74abdaec8 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotResource.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.ElasticSan +{ + public partial class SnapshotResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticSanContext.Default); + + SnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticSanContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotResource.cs similarity index 64% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotResource.cs index 33c1d2090fda..2afa2ad2cef9 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotResource.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.ElasticSan { /// - /// A Class representing an ElasticSanSnapshot 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 GetElasticSanSnapshotResource method. - /// Otherwise you can get one from its parent resource using the GetElasticSanSnapshot method. + /// A Class representing a Snapshot 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 GetSnapshotResource method. + /// Otherwise you can get one from its parent resource using the GetSnapshot method. /// - public partial class ElasticSanSnapshotResource : ArmResource + public partial class SnapshotResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The elasticSanName. @@ -34,35 +34,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _elasticSanSnapshotVolumeSnapshotsClientDiagnostics; - private readonly VolumeSnapshotsRestOperations _elasticSanSnapshotVolumeSnapshotsRestClient; - private readonly ElasticSanSnapshotData _data; + private readonly ClientDiagnostics _snapshotClientDiagnostics; + private readonly SnapshotsRestOperations _snapshotRestClient; + private readonly SnapshotData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ElasticSan/elasticSans/volumegroups/snapshots"; - /// Initializes a new instance of the class for mocking. - protected ElasticSanSnapshotResource() + /// Initializes a new instance of the class for mocking. + protected SnapshotResource() { } - /// 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 ElasticSanSnapshotResource(ArmClient client, ElasticSanSnapshotData data) : this(client, data.Id) + internal SnapshotResource(ArmClient client, SnapshotData 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 ElasticSanSnapshotResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal SnapshotResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticSanSnapshotVolumeSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string elasticSanSnapshotVolumeSnapshotsApiVersion); - _elasticSanSnapshotVolumeSnapshotsRestClient = new VolumeSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticSanSnapshotVolumeSnapshotsApiVersion); + _snapshotClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string snapshotApiVersion); + _snapshotRestClient = new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, snapshotApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -73,7 +73,7 @@ internal ElasticSanSnapshotResource(ArmClient client, ResourceIdentifier id) : b /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual ElasticSanSnapshotData Data + public virtual SnapshotData Data { get { @@ -98,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// VolumeSnapshots_Get + /// Snapshot_Get /// /// /// Default Api Version @@ -106,21 +106,21 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// 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 = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Get"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotResource.Get"); scope.Start(); try { - var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _snapshotRestClient.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 ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -138,7 +138,7 @@ public virtual async Task> GetAsync(Cancell /// /// /// Operation Id - /// VolumeSnapshots_Get + /// Snapshot_Get /// /// /// Default Api Version @@ -146,21 +146,21 @@ public virtual async Task> GetAsync(Cancell /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Get"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotResource.Get"); scope.Start(); try { - var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _snapshotRestClient.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 ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -178,7 +178,7 @@ public virtual Response Get(CancellationToken cancel /// /// /// Operation Id - /// VolumeSnapshots_Delete + /// Snapshot_Delete /// /// /// Default Api Version @@ -186,7 +186,7 @@ public virtual Response Get(CancellationToken cancel /// /// /// Resource - /// + /// /// /// /// @@ -194,12 +194,12 @@ public virtual Response Get(CancellationToken cancel /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Delete"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotResource.Delete"); scope.Start(); try { - var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(_elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _snapshotRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(_snapshotClientDiagnostics, Pipeline, _snapshotRestClient.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,7 +220,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// VolumeSnapshots_Delete + /// Snapshot_Delete /// /// /// Default Api Version @@ -228,7 +228,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// 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 = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Delete"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotResource.Delete"); scope.Start(); try { - var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ElasticSanArmOperation(_elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _snapshotRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ElasticSanArmOperation(_snapshotClientDiagnostics, Pipeline, _snapshotRestClient.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,7 +262,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// VolumeSnapshots_Create + /// Snapshot_Create /// /// /// Default Api Version @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Resource - /// + /// /// /// /// @@ -278,18 +278,18 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Snapshot object. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + public virtual async Task UpdateAsync(WaitUntil waitUntil, SnapshotData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Update"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotResource.Update"); scope.Start(); try { - var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(new ElasticSanSnapshotOperationSource(Client), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = await _snapshotRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(_snapshotClientDiagnostics, Pipeline, _snapshotRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).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) @@ -308,7 +308,7 @@ public virtual async Task> UpdateAsync( /// /// /// Operation Id - /// VolumeSnapshots_Create + /// Snapshot_Create /// /// /// Default Api Version @@ -316,7 +316,7 @@ public virtual async Task> UpdateAsync( /// /// /// Resource - /// + /// /// /// /// @@ -324,18 +324,18 @@ public virtual async Task> UpdateAsync( /// Snapshot object. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, SnapshotData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Update"); + using var scope = _snapshotClientDiagnostics.CreateScope("SnapshotResource.Update"); scope.Start(); try { - var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanSnapshotOperationSource(Client), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = _snapshotRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ElasticSanArmOperation(_snapshotClientDiagnostics, Pipeline, _snapshotRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeCollection.cs similarity index 61% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeCollection.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeCollection.cs index 19bc81fd7cce..0242a718397c 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.ElasticSan { /// - /// 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 GetElasticSanVolumes 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 GetVolumes method from an instance of . /// - public partial class ElasticSanVolumeCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class VolumeCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _elasticSanVolumeVolumesClientDiagnostics; - private readonly VolumesRestOperations _elasticSanVolumeVolumesRestClient; + private readonly ClientDiagnostics _volumeClientDiagnostics; + private readonly VolumesRestOperations _volumeRestClient; - /// Initializes a new instance of the class for mocking. - protected ElasticSanVolumeCollection() + /// Initializes a new instance of the class for mocking. + protected VolumeCollection() { } - /// 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 ElasticSanVolumeCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal VolumeCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticSanVolumeVolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ElasticSanVolumeResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ElasticSanVolumeResource.ResourceType, out string elasticSanVolumeVolumesApiVersion); - _elasticSanVolumeVolumesRestClient = new VolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticSanVolumeVolumesApiVersion); + _volumeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", VolumeResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(VolumeResource.ResourceType, out string volumeApiVersion); + _volumeRestClient = new VolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, volumeApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -48,8 +48,8 @@ internal ElasticSanVolumeCollection(ArmClient client, ResourceIdentifier id) : b internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ElasticSanVolumeGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ElasticSanVolumeGroupResource.ResourceType), nameof(id)); + if (id.ResourceType != VolumeGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, VolumeGroupResource.ResourceType), nameof(id)); } /// @@ -61,7 +61,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Volumes_Create + /// Volume_Create /// /// /// Default Api Version @@ -69,7 +69,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Resource - /// + /// /// /// /// @@ -79,19 +79,19 @@ 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 volumeName, ElasticSanVolumeData data, CancellationToken cancellationToken = default) + public virtual async Task CreateOrUpdateAsync(WaitUntil waitUntil, string volumeName, VolumeData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeCollection.CreateOrUpdate"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _elasticSanVolumeVolumesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(new ElasticSanVolumeOperationSource(Client), _elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data).Request, response, OperationFinalStateVia.Location); + var response = await _volumeRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(_volumeClientDiagnostics, Pipeline, _volumeRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data).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) @@ -110,7 +110,7 @@ public virtual async Task> CreateOrUpdate /// /// /// Operation Id - /// Volumes_Create + /// Volume_Create /// /// /// Default Api Version @@ -118,7 +118,7 @@ public virtual async Task> CreateOrUpdate /// /// /// Resource - /// + /// /// /// /// @@ -128,19 +128,19 @@ public virtual async Task> CreateOrUpdate /// 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 volumeName, ElasticSanVolumeData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string volumeName, VolumeData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeCollection.CreateOrUpdate"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeCollection.CreateOrUpdate"); scope.Start(); try { - var response = _elasticSanVolumeVolumesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanVolumeOperationSource(Client), _elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data).Request, response, OperationFinalStateVia.Location); + var response = _volumeRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data, cancellationToken); + var operation = new ElasticSanArmOperation(_volumeClientDiagnostics, Pipeline, _volumeRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) @@ -159,7 +159,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// /// /// Operation Id - /// Volumes_Get + /// Volume_Get /// /// /// Default Api Version @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// /// /// Resource - /// + /// /// /// /// @@ -175,18 +175,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string volumeName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string volumeName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeCollection.Get"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeCollection.Get"); scope.Start(); try { - var response = await _elasticSanVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken).ConfigureAwait(false); + var response = await _volumeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticSanVolumeResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -204,7 +204,7 @@ public virtual async Task> GetAsync(string vo /// /// /// Operation Id - /// Volumes_Get + /// Volume_Get /// /// /// Default Api Version @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string vo /// /// /// Resource - /// + /// /// /// /// @@ -220,18 +220,18 @@ public virtual async Task> GetAsync(string vo /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string volumeName, CancellationToken cancellationToken = default) + public virtual Response Get(string volumeName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeCollection.Get"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeCollection.Get"); scope.Start(); try { - var response = _elasticSanVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken); + var response = _volumeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticSanVolumeResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -249,7 +249,7 @@ public virtual Response Get(string volumeName, Cancell /// /// /// Operation Id - /// Volumes_ListByVolumeGroup + /// Volume_ListByVolumeGroup /// /// /// Default Api Version @@ -257,18 +257,18 @@ public virtual Response Get(string volumeName, Cancell /// /// /// Resource - /// + /// /// /// /// - /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. + /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanVolumeVolumesRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, accessSoftDeletedResources); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanVolumeVolumesRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, accessSoftDeletedResources); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticSanVolumeResource(Client, ElasticSanVolumeData.DeserializeElasticSanVolumeData(e)), _elasticSanVolumeVolumesClientDiagnostics, Pipeline, "ElasticSanVolumeCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _volumeRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, xMsAccessSoftDeletedResources); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _volumeRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, xMsAccessSoftDeletedResources); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VolumeResource(Client, VolumeData.DeserializeVolumeData(e)), _volumeClientDiagnostics, Pipeline, "VolumeCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -280,7 +280,7 @@ public virtual AsyncPageable GetAllAsync(ElasticSanAcc /// /// /// Operation Id - /// Volumes_ListByVolumeGroup + /// Volume_ListByVolumeGroup /// /// /// Default Api Version @@ -288,18 +288,18 @@ public virtual AsyncPageable GetAllAsync(ElasticSanAcc /// /// /// Resource - /// + /// /// /// /// - /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. + /// Optional, returns only soft deleted volumes if set to true. If set to false or if not specified, returns only active volumes. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanVolumeVolumesRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, accessSoftDeletedResources); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanVolumeVolumesRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, accessSoftDeletedResources); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticSanVolumeResource(Client, ElasticSanVolumeData.DeserializeElasticSanVolumeData(e)), _elasticSanVolumeVolumesClientDiagnostics, Pipeline, "ElasticSanVolumeCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _volumeRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, xMsAccessSoftDeletedResources); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _volumeRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, xMsAccessSoftDeletedResources); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VolumeResource(Client, VolumeData.DeserializeVolumeData(e)), _volumeClientDiagnostics, Pipeline, "VolumeCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -311,7 +311,7 @@ public virtual Pageable GetAll(ElasticSanAccessSoftDel /// /// /// Operation Id - /// Volumes_Get + /// Volume_Get /// /// /// Default Api Version @@ -319,7 +319,7 @@ public virtual Pageable GetAll(ElasticSanAccessSoftDel /// /// /// Resource - /// + /// /// /// /// @@ -331,11 +331,11 @@ public virtual async Task> ExistsAsync(string volumeName, Cancell { Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeCollection.Exists"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeCollection.Exists"); scope.Start(); try { - var response = await _elasticSanVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _volumeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -354,7 +354,7 @@ public virtual async Task> ExistsAsync(string volumeName, Cancell /// /// /// Operation Id - /// Volumes_Get + /// Volume_Get /// /// /// Default Api Version @@ -362,7 +362,7 @@ public virtual async Task> ExistsAsync(string volumeName, Cancell /// /// /// Resource - /// + /// /// /// /// @@ -374,11 +374,11 @@ public virtual Response Exists(string volumeName, CancellationToken cancel { Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeCollection.Exists"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeCollection.Exists"); scope.Start(); try { - var response = _elasticSanVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken); + var response = _volumeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -397,7 +397,7 @@ public virtual Response Exists(string volumeName, CancellationToken cancel /// /// /// Operation Id - /// Volumes_Get + /// Volume_Get /// /// /// Default Api Version @@ -405,7 +405,7 @@ public virtual Response Exists(string volumeName, CancellationToken cancel /// /// /// Resource - /// + /// /// /// /// @@ -413,18 +413,18 @@ public virtual Response Exists(string volumeName, CancellationToken cancel /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string volumeName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string volumeName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeCollection.GetIfExists"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeCollection.GetIfExists"); scope.Start(); try { - var response = await _elasticSanVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _volumeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ElasticSanVolumeResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -442,7 +442,7 @@ public virtual async Task> GetIfExist /// /// /// Operation Id - /// Volumes_Get + /// Volume_Get /// /// /// Default Api Version @@ -450,7 +450,7 @@ public virtual async Task> GetIfExist /// /// /// Resource - /// + /// /// /// /// @@ -458,18 +458,18 @@ public virtual async Task> GetIfExist /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string volumeName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string volumeName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeCollection.GetIfExists"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeCollection.GetIfExists"); scope.Start(); try { - var response = _elasticSanVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken); + var response = _volumeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ElasticSanVolumeResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -478,7 +478,7 @@ public virtual NullableResponse GetIfExists(string vol } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -488,7 +488,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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeData.Serialization.cs similarity index 74% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeData.Serialization.cs index 9606d0f36ff9..9a8ba5dad961 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ElasticSan { - public partial class ElasticSanVolumeData : IUtf8JsonSerializable, IJsonModel + public partial class VolumeData : 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, ModelReaderWr /// 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(ElasticSanVolumeData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VolumeData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -42,7 +42,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (options.Format != "W" && Optional.IsDefined(VolumeId)) { writer.WritePropertyName("volumeId"u8); - writer.WriteStringValue(VolumeId.Value); + writer.WriteStringValue(VolumeId); } if (Optional.IsDefined(CreationData)) { @@ -51,7 +51,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } writer.WritePropertyName("sizeGiB"u8); writer.WriteNumberValue(SizeGiB); - if (options.Format != "W" && Optional.IsDefined(StorageTarget)) + if (Optional.IsDefined(StorageTarget)) { writer.WritePropertyName("storageTarget"u8); writer.WriteObjectValue(StorageTarget, options); @@ -69,19 +69,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteEndObject(); } - ElasticSanVolumeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VolumeData 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(ElasticSanVolumeData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VolumeData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanVolumeData(document.RootElement, options); + return DeserializeVolumeData(document.RootElement, options); } - internal static ElasticSanVolumeData DeserializeElasticSanVolumeData(JsonElement element, ModelReaderWriterOptions options = null) + internal static VolumeData DeserializeVolumeData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -93,12 +93,12 @@ internal static ElasticSanVolumeData DeserializeElasticSanVolumeData(JsonElement string name = default; ResourceType type = default; SystemData systemData = default; - Guid? volumeId = default; - ElasticSanVolumeDataSourceInfo creationData = default; + string volumeId = default; + SourceCreationContent creationData = default; long sizeGiB = default; IscsiTargetInfo storageTarget = default; ManagedByInfo managedBy = default; - ElasticSanProvisioningState? provisioningState = default; + ProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -138,11 +138,7 @@ internal static ElasticSanVolumeData DeserializeElasticSanVolumeData(JsonElement { if (property0.NameEquals("volumeId"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - volumeId = property0.Value.GetGuid(); + volumeId = property0.Value.GetString(); continue; } if (property0.NameEquals("creationData"u8)) @@ -151,7 +147,7 @@ internal static ElasticSanVolumeData DeserializeElasticSanVolumeData(JsonElement { continue; } - creationData = ElasticSanVolumeDataSourceInfo.DeserializeElasticSanVolumeDataSourceInfo(property0.Value, options); + creationData = SourceCreationContent.DeserializeSourceCreationContent(property0.Value, options); continue; } if (property0.NameEquals("sizeGiB"u8)) @@ -183,7 +179,7 @@ internal static ElasticSanVolumeData DeserializeElasticSanVolumeData(JsonElement { continue; } - provisioningState = new ElasticSanProvisioningState(property0.Value.GetString()); + provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } } @@ -195,7 +191,7 @@ internal static ElasticSanVolumeData DeserializeElasticSanVolumeData(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanVolumeData( + return new VolumeData( id, name, type, @@ -209,35 +205,35 @@ internal static ElasticSanVolumeData DeserializeElasticSanVolumeData(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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanVolumeData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeData)} does not support writing '{options.Format}' format."); } } - ElasticSanVolumeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VolumeData 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 DeserializeElasticSanVolumeData(document.RootElement, options); + return DeserializeVolumeData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanVolumeData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeData.cs similarity index 76% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeData.cs index 31899ec6122b..0ecb0b5a2148 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeData.cs @@ -14,10 +14,10 @@ namespace Azure.ResourceManager.ElasticSan { /// - /// A class representing the ElasticSanVolume data model. + /// A class representing the Volume data model. /// Response for Volume request. /// - public partial class ElasticSanVolumeData : ResourceData + public partial class VolumeData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,14 +51,14 @@ public partial class ElasticSanVolumeData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Volume size. - public ElasticSanVolumeData(long sizeGiB) + public VolumeData(long sizeGiB) { SizeGiB = sizeGiB; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -70,7 +70,7 @@ public ElasticSanVolumeData(long sizeGiB) /// Parent resource information. /// State of the operation on the resource. /// Keeps track of any properties unknown to the library. - internal ElasticSanVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? volumeId, ElasticSanVolumeDataSourceInfo creationData, long sizeGiB, IscsiTargetInfo storageTarget, ManagedByInfo managedBy, ElasticSanProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal VolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string volumeId, SourceCreationContent creationData, long sizeGiB, IscsiTargetInfo storageTarget, ManagedByInfo managedBy, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { VolumeId = volumeId; CreationData = creationData; @@ -81,23 +81,23 @@ internal ElasticSanVolumeData(ResourceIdentifier id, string name, ResourceType r _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ElasticSanVolumeData() + /// Initializes a new instance of for deserialization. + internal VolumeData() { } /// Unique Id of the volume in GUID format. - public Guid? VolumeId { get; } + public string VolumeId { get; } /// State of the operation on the resource. - public ElasticSanVolumeDataSourceInfo CreationData { get; set; } + public SourceCreationContent CreationData { get; set; } /// Volume size. public long SizeGiB { get; set; } /// Storage target information. - public IscsiTargetInfo StorageTarget { get; } + public IscsiTargetInfo StorageTarget { get; set; } /// Parent resource information. internal ManagedByInfo ManagedBy { get; set; } /// Resource ID of the resource managing the volume, this is a restricted field and can only be set for internal use. - public ResourceIdentifier ManagedByResourceId + public string ManagedByResourceId { get => ManagedBy is null ? default : ManagedBy.ResourceId; set @@ -109,6 +109,6 @@ public ResourceIdentifier ManagedByResourceId } /// State of the operation on the resource. - public ElasticSanProvisioningState? ProvisioningState { get; } + public ProvisioningState? ProvisioningState { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupCollection.cs similarity index 60% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupCollection.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupCollection.cs index b485d51decbe..401fb7b03189 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.ElasticSan { /// - /// 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 GetElasticSanVolumeGroups 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 GetVolumeGroups method from an instance of . /// - public partial class ElasticSanVolumeGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class VolumeGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _elasticSanVolumeGroupVolumeGroupsClientDiagnostics; - private readonly VolumeGroupsRestOperations _elasticSanVolumeGroupVolumeGroupsRestClient; + private readonly ClientDiagnostics _volumeGroupClientDiagnostics; + private readonly VolumeGroupsRestOperations _volumeGroupRestClient; - /// Initializes a new instance of the class for mocking. - protected ElasticSanVolumeGroupCollection() + /// Initializes a new instance of the class for mocking. + protected VolumeGroupCollection() { } - /// 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 ElasticSanVolumeGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal VolumeGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticSanVolumeGroupVolumeGroupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ElasticSanVolumeGroupResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ElasticSanVolumeGroupResource.ResourceType, out string elasticSanVolumeGroupVolumeGroupsApiVersion); - _elasticSanVolumeGroupVolumeGroupsRestClient = new VolumeGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticSanVolumeGroupVolumeGroupsApiVersion); + _volumeGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", VolumeGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(VolumeGroupResource.ResourceType, out string volumeGroupApiVersion); + _volumeGroupRestClient = new VolumeGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, volumeGroupApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -61,7 +61,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// VolumeGroups_Create + /// VolumeGroup_Create /// /// /// Default Api Version @@ -69,7 +69,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Resource - /// + /// /// /// /// @@ -79,19 +79,19 @@ 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 volumeGroupName, ElasticSanVolumeGroupData data, CancellationToken cancellationToken = default) + public virtual async Task CreateOrUpdateAsync(WaitUntil waitUntil, string volumeGroupName, VolumeGroupData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.CreateOrUpdate"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _elasticSanVolumeGroupVolumeGroupsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(new ElasticSanVolumeGroupOperationSource(Client), _elasticSanVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _elasticSanVolumeGroupVolumeGroupsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data).Request, response, OperationFinalStateVia.Location); + var response = await _volumeGroupRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(_volumeGroupClientDiagnostics, Pipeline, _volumeGroupRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data).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) @@ -110,7 +110,7 @@ public virtual async Task> CreateOrU /// /// /// Operation Id - /// VolumeGroups_Create + /// VolumeGroup_Create /// /// /// Default Api Version @@ -118,7 +118,7 @@ public virtual async Task> CreateOrU /// /// /// Resource - /// + /// /// /// /// @@ -128,19 +128,19 @@ public virtual async Task> CreateOrU /// 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 volumeGroupName, ElasticSanVolumeGroupData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string volumeGroupName, VolumeGroupData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.CreateOrUpdate"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupCollection.CreateOrUpdate"); scope.Start(); try { - var response = _elasticSanVolumeGroupVolumeGroupsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanVolumeGroupOperationSource(Client), _elasticSanVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _elasticSanVolumeGroupVolumeGroupsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data).Request, response, OperationFinalStateVia.Location); + var response = _volumeGroupRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data, cancellationToken); + var operation = new ElasticSanArmOperation(_volumeGroupClientDiagnostics, Pipeline, _volumeGroupRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) @@ -159,7 +159,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// /// /// Operation Id - /// VolumeGroups_Get + /// VolumeGroup_Get /// /// /// Default Api Version @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// /// /// Resource - /// + /// /// /// /// @@ -175,18 +175,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string volumeGroupName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string volumeGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.Get"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupCollection.Get"); scope.Start(); try { - var response = await _elasticSanVolumeGroupVolumeGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken).ConfigureAwait(false); + var response = await _volumeGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticSanVolumeGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VolumeGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -204,7 +204,7 @@ public virtual async Task> GetAsync(stri /// /// /// Operation Id - /// VolumeGroups_Get + /// VolumeGroup_Get /// /// /// Default Api Version @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(stri /// /// /// Resource - /// + /// /// /// /// @@ -220,18 +220,18 @@ public virtual async Task> GetAsync(stri /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string volumeGroupName, CancellationToken cancellationToken = default) + public virtual Response Get(string volumeGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.Get"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupCollection.Get"); scope.Start(); try { - var response = _elasticSanVolumeGroupVolumeGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken); + var response = _volumeGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticSanVolumeGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VolumeGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -245,11 +245,11 @@ public virtual Response Get(string volumeGroupNam /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumeGroups + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups /// /// /// Operation Id - /// VolumeGroups_ListByElasticSan + /// VolumeGroup_ListByElasticSan /// /// /// Default Api Version @@ -257,18 +257,18 @@ public virtual Response Get(string volumeGroupNam /// /// /// Resource - /// + /// /// /// /// - /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. + /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanVolumeGroupVolumeGroupsRestClient.CreateListByElasticSanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessSoftDeletedResources); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanVolumeGroupVolumeGroupsRestClient.CreateListByElasticSanNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessSoftDeletedResources); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticSanVolumeGroupResource(Client, ElasticSanVolumeGroupData.DeserializeElasticSanVolumeGroupData(e)), _elasticSanVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, "ElasticSanVolumeGroupCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _volumeGroupRestClient.CreateListByElasticSanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsAccessSoftDeletedResources); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _volumeGroupRestClient.CreateListByElasticSanNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsAccessSoftDeletedResources); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VolumeGroupResource(Client, VolumeGroupData.DeserializeVolumeGroupData(e)), _volumeGroupClientDiagnostics, Pipeline, "VolumeGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -276,11 +276,11 @@ public virtual AsyncPageable GetAllAsync(ElasticS /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumeGroups + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups /// /// /// Operation Id - /// VolumeGroups_ListByElasticSan + /// VolumeGroup_ListByElasticSan /// /// /// Default Api Version @@ -288,18 +288,18 @@ public virtual AsyncPageable GetAllAsync(ElasticS /// /// /// Resource - /// + /// /// /// /// - /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. + /// Optional, returns only soft deleted volume groups if set to true. If set to false or if not specified, returns only active volume groups. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(ElasticSanAccessSoftDeletedVolume? accessSoftDeletedResources = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(XMsAccessSoftDeletedResource? xMsAccessSoftDeletedResources = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanVolumeGroupVolumeGroupsRestClient.CreateListByElasticSanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessSoftDeletedResources); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanVolumeGroupVolumeGroupsRestClient.CreateListByElasticSanNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessSoftDeletedResources); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticSanVolumeGroupResource(Client, ElasticSanVolumeGroupData.DeserializeElasticSanVolumeGroupData(e)), _elasticSanVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, "ElasticSanVolumeGroupCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _volumeGroupRestClient.CreateListByElasticSanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsAccessSoftDeletedResources); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _volumeGroupRestClient.CreateListByElasticSanNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsAccessSoftDeletedResources); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VolumeGroupResource(Client, VolumeGroupData.DeserializeVolumeGroupData(e)), _volumeGroupClientDiagnostics, Pipeline, "VolumeGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -311,7 +311,7 @@ public virtual Pageable GetAll(ElasticSanAccessSo /// /// /// Operation Id - /// VolumeGroups_Get + /// VolumeGroup_Get /// /// /// Default Api Version @@ -319,7 +319,7 @@ public virtual Pageable GetAll(ElasticSanAccessSo /// /// /// Resource - /// + /// /// /// /// @@ -331,11 +331,11 @@ public virtual async Task> ExistsAsync(string volumeGroupName, Ca { Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.Exists"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupCollection.Exists"); scope.Start(); try { - var response = await _elasticSanVolumeGroupVolumeGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _volumeGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -354,7 +354,7 @@ public virtual async Task> ExistsAsync(string volumeGroupName, Ca /// /// /// Operation Id - /// VolumeGroups_Get + /// VolumeGroup_Get /// /// /// Default Api Version @@ -362,7 +362,7 @@ public virtual async Task> ExistsAsync(string volumeGroupName, Ca /// /// /// Resource - /// + /// /// /// /// @@ -374,11 +374,11 @@ public virtual Response Exists(string volumeGroupName, CancellationToken c { Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.Exists"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupCollection.Exists"); scope.Start(); try { - var response = _elasticSanVolumeGroupVolumeGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken); + var response = _volumeGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -397,7 +397,7 @@ public virtual Response Exists(string volumeGroupName, CancellationToken c /// /// /// Operation Id - /// VolumeGroups_Get + /// VolumeGroup_Get /// /// /// Default Api Version @@ -405,7 +405,7 @@ public virtual Response Exists(string volumeGroupName, CancellationToken c /// /// /// Resource - /// + /// /// /// /// @@ -413,18 +413,18 @@ public virtual Response Exists(string volumeGroupName, CancellationToken c /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string volumeGroupName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string volumeGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.GetIfExists"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupCollection.GetIfExists"); scope.Start(); try { - var response = await _elasticSanVolumeGroupVolumeGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _volumeGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ElasticSanVolumeGroupResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VolumeGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -442,7 +442,7 @@ public virtual async Task> GetIf /// /// /// Operation Id - /// VolumeGroups_Get + /// VolumeGroup_Get /// /// /// Default Api Version @@ -450,7 +450,7 @@ public virtual async Task> GetIf /// /// /// Resource - /// + /// /// /// /// @@ -458,18 +458,18 @@ public virtual async Task> GetIf /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string volumeGroupName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string volumeGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.GetIfExists"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupCollection.GetIfExists"); scope.Start(); try { - var response = _elasticSanVolumeGroupVolumeGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken); + var response = _volumeGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ElasticSanVolumeGroupResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new VolumeGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -478,7 +478,7 @@ public virtual NullableResponse GetIfExists(strin } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -488,7 +488,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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupData.Serialization.cs similarity index 78% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupData.Serialization.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupData.Serialization.cs index 86294ae8add6..3bbe6a1dc760 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupData.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ElasticSan { - public partial class ElasticSanVolumeGroupData : IUtf8JsonSerializable, IJsonModel + public partial class VolumeGroupData : 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, ModelRea /// 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(ElasticSanVolumeGroupData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -92,19 +92,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteEndObject(); } - ElasticSanVolumeGroupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VolumeGroupData 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(ElasticSanVolumeGroupData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSanVolumeGroupData(document.RootElement, options); + return DeserializeVolumeGroupData(document.RootElement, options); } - internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(JsonElement element, ModelReaderWriterOptions options = null) + internal static VolumeGroupData DeserializeVolumeGroupData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -117,14 +117,14 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J string name = default; ResourceType type = default; SystemData systemData = default; - ElasticSanProvisioningState? provisioningState = default; - ElasticSanStorageTargetType? protocolType = default; - ElasticSanEncryptionType? encryption = default; - ElasticSanEncryptionProperties encryptionProperties = default; - ElasticSanNetworkRuleSet networkAcls = default; + ProvisioningState? provisioningState = default; + StorageTargetType? protocolType = default; + EncryptionType? encryption = default; + Models.EncryptionProperties encryptionProperties = default; + NetworkRuleSet networkAcls = default; IReadOnlyList privateEndpointConnections = default; bool? enforceDataIntegrityCheckForIscsi = default; - ElasticSanDeleteRetentionPolicy deleteRetentionPolicy = default; + DeleteRetentionPolicy deleteRetentionPolicy = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -177,7 +177,7 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J { continue; } - provisioningState = new ElasticSanProvisioningState(property0.Value.GetString()); + provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("protocolType"u8)) @@ -186,7 +186,7 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J { continue; } - protocolType = new ElasticSanStorageTargetType(property0.Value.GetString()); + protocolType = new StorageTargetType(property0.Value.GetString()); continue; } if (property0.NameEquals("encryption"u8)) @@ -195,7 +195,7 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J { continue; } - encryption = new ElasticSanEncryptionType(property0.Value.GetString()); + encryption = new EncryptionType(property0.Value.GetString()); continue; } if (property0.NameEquals("encryptionProperties"u8)) @@ -204,7 +204,7 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J { continue; } - encryptionProperties = ElasticSanEncryptionProperties.DeserializeElasticSanEncryptionProperties(property0.Value, options); + encryptionProperties = Models.EncryptionProperties.DeserializeEncryptionProperties(property0.Value, options); continue; } if (property0.NameEquals("networkAcls"u8)) @@ -213,7 +213,7 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J { continue; } - networkAcls = ElasticSanNetworkRuleSet.DeserializeElasticSanNetworkRuleSet(property0.Value, options); + networkAcls = NetworkRuleSet.DeserializeNetworkRuleSet(property0.Value, options); continue; } if (property0.NameEquals("privateEndpointConnections"u8)) @@ -245,7 +245,7 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J { continue; } - deleteRetentionPolicy = ElasticSanDeleteRetentionPolicy.DeserializeElasticSanDeleteRetentionPolicy(property0.Value, options); + deleteRetentionPolicy = DeleteRetentionPolicy.DeserializeDeleteRetentionPolicy(property0.Value, options); continue; } } @@ -257,7 +257,7 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSanVolumeGroupData( + return new VolumeGroupData( id, name, type, @@ -274,35 +274,35 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J 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, AzureResourceManagerElasticSanContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSanVolumeGroupData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupData)} does not support writing '{options.Format}' format."); } } - ElasticSanVolumeGroupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VolumeGroupData 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 DeserializeElasticSanVolumeGroupData(document.RootElement, options); + return DeserializeVolumeGroupData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSanVolumeGroupData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VolumeGroupData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupData.cs similarity index 76% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupData.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupData.cs index 6363c1212f50..666098acb9b9 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupData.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupData.cs @@ -14,10 +14,10 @@ namespace Azure.ResourceManager.ElasticSan { /// - /// A class representing the ElasticSanVolumeGroup data model. + /// A class representing the VolumeGroup data model. /// Response for Volume Group request. /// - public partial class ElasticSanVolumeGroupData : ResourceData + public partial class VolumeGroupData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,13 +51,13 @@ public partial class ElasticSanVolumeGroupData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticSanVolumeGroupData() + /// Initializes a new instance of . + public VolumeGroupData() { PrivateEndpointConnections = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -72,7 +72,7 @@ public ElasticSanVolumeGroupData() /// A boolean indicating whether or not Data Integrity Check is enabled. /// The retention policy for the soft deleted volume group and its associated resources. /// Keeps track of any properties unknown to the library. - internal ElasticSanVolumeGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, ElasticSanProvisioningState? provisioningState, ElasticSanStorageTargetType? protocolType, ElasticSanEncryptionType? encryption, ElasticSanEncryptionProperties encryptionProperties, ElasticSanNetworkRuleSet networkAcls, IReadOnlyList privateEndpointConnections, bool? enforceDataIntegrityCheckForIscsi, ElasticSanDeleteRetentionPolicy deleteRetentionPolicy, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal VolumeGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, ProvisioningState? provisioningState, StorageTargetType? protocolType, EncryptionType? encryption, Models.EncryptionProperties encryptionProperties, NetworkRuleSet networkAcls, IReadOnlyList privateEndpointConnections, bool? enforceDataIntegrityCheckForIscsi, DeleteRetentionPolicy deleteRetentionPolicy, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Identity = identity; ProvisioningState = provisioningState; @@ -89,22 +89,22 @@ internal ElasticSanVolumeGroupData(ResourceIdentifier id, string name, ResourceT /// The identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. public ManagedServiceIdentity Identity { get; set; } /// State of the operation on the resource. - public ElasticSanProvisioningState? ProvisioningState { get; } + public ProvisioningState? ProvisioningState { get; } /// Type of storage target. - public ElasticSanStorageTargetType? ProtocolType { get; set; } + public StorageTargetType? ProtocolType { get; set; } /// Type of encryption. - public ElasticSanEncryptionType? Encryption { get; set; } + public EncryptionType? Encryption { get; set; } /// Encryption Properties describing Key Vault and Identity information. - public ElasticSanEncryptionProperties EncryptionProperties { get; set; } + public Models.EncryptionProperties EncryptionProperties { get; set; } /// A collection of rules governing the accessibility from specific network locations. - internal ElasticSanNetworkRuleSet NetworkAcls { get; set; } + internal NetworkRuleSet NetworkAcls { get; set; } /// The list of virtual network rules. - public IList VirtualNetworkRules + public IList VirtualNetworkRules { get { if (NetworkAcls is null) - NetworkAcls = new ElasticSanNetworkRuleSet(); + NetworkAcls = new NetworkRuleSet(); return NetworkAcls.VirtualNetworkRules; } } @@ -114,6 +114,6 @@ public IList VirtualNetworkRules /// A boolean indicating whether or not Data Integrity Check is enabled. public bool? EnforceDataIntegrityCheckForIscsi { get; set; } /// The retention policy for the soft deleted volume group and its associated resources. - public ElasticSanDeleteRetentionPolicy DeleteRetentionPolicy { get; set; } + public DeleteRetentionPolicy DeleteRetentionPolicy { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupResource.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupResource.Serialization.cs new file mode 100644 index 000000000000..1ded25a33161 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupResource.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.ElasticSan +{ + public partial class VolumeGroupResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + VolumeGroupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticSanContext.Default); + + VolumeGroupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticSanContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupResource.cs similarity index 63% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupResource.cs index 22da195ec04f..c3dbaab91734 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeGroupResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ElasticSan { /// - /// A Class representing an ElasticSanVolumeGroup 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 GetElasticSanVolumeGroupResource method. - /// Otherwise you can get one from its parent resource using the GetElasticSanVolumeGroup method. + /// A Class representing a VolumeGroup 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 GetVolumeGroupResource method. + /// Otherwise you can get one from its parent resource using the GetVolumeGroup method. /// - public partial class ElasticSanVolumeGroupResource : ArmResource + public partial class VolumeGroupResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The elasticSanName. @@ -34,40 +34,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _elasticSanVolumeGroupVolumeGroupsClientDiagnostics; - private readonly VolumeGroupsRestOperations _elasticSanVolumeGroupVolumeGroupsRestClient; - private readonly ClientDiagnostics _elasticSanVolumeVolumesClientDiagnostics; - private readonly VolumesRestOperations _elasticSanVolumeVolumesRestClient; - private readonly ElasticSanVolumeGroupData _data; + private readonly ClientDiagnostics _volumeGroupClientDiagnostics; + private readonly VolumeGroupsRestOperations _volumeGroupRestClient; + private readonly VolumeGroupData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ElasticSan/elasticSans/volumegroups"; - /// Initializes a new instance of the class for mocking. - protected ElasticSanVolumeGroupResource() + /// Initializes a new instance of the class for mocking. + protected VolumeGroupResource() { } - /// 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 ElasticSanVolumeGroupResource(ArmClient client, ElasticSanVolumeGroupData data) : this(client, data.Id) + internal VolumeGroupResource(ArmClient client, VolumeGroupData 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 ElasticSanVolumeGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal VolumeGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticSanVolumeGroupVolumeGroupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string elasticSanVolumeGroupVolumeGroupsApiVersion); - _elasticSanVolumeGroupVolumeGroupsRestClient = new VolumeGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticSanVolumeGroupVolumeGroupsApiVersion); - _elasticSanVolumeVolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ElasticSanVolumeResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ElasticSanVolumeResource.ResourceType, out string elasticSanVolumeVolumesApiVersion); - _elasticSanVolumeVolumesRestClient = new VolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticSanVolumeVolumesApiVersion); + _volumeGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string volumeGroupApiVersion); + _volumeGroupRestClient = new VolumeGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, volumeGroupApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -78,7 +73,7 @@ internal ElasticSanVolumeGroupResource(ArmClient client, ResourceIdentifier id) /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual ElasticSanVolumeGroupData Data + public virtual VolumeGroupData Data { get { @@ -94,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 ElasticSanVolumeResources in the ElasticSanVolumeGroup. - /// An object representing collection of ElasticSanVolumeResources and their operations over a ElasticSanVolumeResource. - public virtual ElasticSanVolumeCollection GetElasticSanVolumes() + /// Gets a collection of VolumeResources in the VolumeGroup. + /// An object representing collection of VolumeResources and their operations over a VolumeResource. + public virtual VolumeCollection GetVolumes() { - return GetCachedClient(client => new ElasticSanVolumeCollection(client, Id)); + return GetCachedClient(client => new VolumeCollection(client, Id)); } /// @@ -110,7 +105,7 @@ public virtual ElasticSanVolumeCollection GetElasticSanVolumes() /// /// /// Operation Id - /// Volumes_Get + /// Volume_Get /// /// /// Default Api Version @@ -118,7 +113,7 @@ public virtual ElasticSanVolumeCollection GetElasticSanVolumes() /// /// /// Resource - /// + /// /// /// /// @@ -127,9 +122,9 @@ public virtual ElasticSanVolumeCollection GetElasticSanVolumes() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetElasticSanVolumeAsync(string volumeName, CancellationToken cancellationToken = default) + public virtual async Task> GetVolumeAsync(string volumeName, CancellationToken cancellationToken = default) { - return await GetElasticSanVolumes().GetAsync(volumeName, cancellationToken).ConfigureAwait(false); + return await GetVolumes().GetAsync(volumeName, cancellationToken).ConfigureAwait(false); } /// @@ -141,7 +136,7 @@ public virtual async Task> GetElasticSanVolum /// /// /// Operation Id - /// Volumes_Get + /// Volume_Get /// /// /// Default Api Version @@ -149,7 +144,7 @@ public virtual async Task> GetElasticSanVolum /// /// /// Resource - /// + /// /// /// /// @@ -158,16 +153,16 @@ public virtual async Task> GetElasticSanVolum /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetElasticSanVolume(string volumeName, CancellationToken cancellationToken = default) + public virtual Response GetVolume(string volumeName, CancellationToken cancellationToken = default) { - return GetElasticSanVolumes().Get(volumeName, cancellationToken); + return GetVolumes().Get(volumeName, cancellationToken); } - /// Gets a collection of ElasticSanSnapshotResources in the ElasticSanVolumeGroup. - /// An object representing collection of ElasticSanSnapshotResources and their operations over a ElasticSanSnapshotResource. - public virtual ElasticSanSnapshotCollection GetElasticSanSnapshots() + /// Gets a collection of SnapshotResources in the VolumeGroup. + /// An object representing collection of SnapshotResources and their operations over a SnapshotResource. + public virtual SnapshotCollection GetSnapshots() { - return GetCachedClient(client => new ElasticSanSnapshotCollection(client, Id)); + return GetCachedClient(client => new SnapshotCollection(client, Id)); } /// @@ -179,7 +174,7 @@ public virtual ElasticSanSnapshotCollection GetElasticSanSnapshots() /// /// /// Operation Id - /// VolumeSnapshots_Get + /// Snapshot_Get /// /// /// Default Api Version @@ -187,7 +182,7 @@ public virtual ElasticSanSnapshotCollection GetElasticSanSnapshots() /// /// /// Resource - /// + /// /// /// /// @@ -196,9 +191,9 @@ public virtual ElasticSanSnapshotCollection GetElasticSanSnapshots() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetElasticSanSnapshotAsync(string snapshotName, CancellationToken cancellationToken = default) + public virtual async Task> GetSnapshotAsync(string snapshotName, CancellationToken cancellationToken = default) { - return await GetElasticSanSnapshots().GetAsync(snapshotName, cancellationToken).ConfigureAwait(false); + return await GetSnapshots().GetAsync(snapshotName, cancellationToken).ConfigureAwait(false); } /// @@ -210,7 +205,7 @@ public virtual async Task> GetElasticSanSna /// /// /// Operation Id - /// VolumeSnapshots_Get + /// Snapshot_Get /// /// /// Default Api Version @@ -218,7 +213,7 @@ public virtual async Task> GetElasticSanSna /// /// /// Resource - /// + /// /// /// /// @@ -227,9 +222,9 @@ public virtual async Task> GetElasticSanSna /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetElasticSanSnapshot(string snapshotName, CancellationToken cancellationToken = default) + public virtual Response GetSnapshot(string snapshotName, CancellationToken cancellationToken = default) { - return GetElasticSanSnapshots().Get(snapshotName, cancellationToken); + return GetSnapshots().Get(snapshotName, cancellationToken); } /// @@ -241,7 +236,7 @@ public virtual Response GetElasticSanSnapshot(string /// /// /// Operation Id - /// VolumeGroups_Get + /// VolumeGroup_Get /// /// /// Default Api Version @@ -249,21 +244,21 @@ public virtual Response GetElasticSanSnapshot(string /// /// /// 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 = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupResource.Get"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupResource.Get"); scope.Start(); try { - var response = await _elasticSanVolumeGroupVolumeGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _volumeGroupRestClient.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 ElasticSanVolumeGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VolumeGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -281,7 +276,7 @@ public virtual async Task> GetAsync(Canc /// /// /// Operation Id - /// VolumeGroups_Get + /// VolumeGroup_Get /// /// /// Default Api Version @@ -289,21 +284,21 @@ public virtual async Task> GetAsync(Canc /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupResource.Get"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupResource.Get"); scope.Start(); try { - var response = _elasticSanVolumeGroupVolumeGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _volumeGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticSanVolumeGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VolumeGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -321,7 +316,7 @@ public virtual Response Get(CancellationToken can /// /// /// Operation Id - /// VolumeGroups_Delete + /// VolumeGroup_Delete /// /// /// Default Api Version @@ -329,7 +324,7 @@ public virtual Response Get(CancellationToken can /// /// /// Resource - /// + /// /// /// /// @@ -337,12 +332,12 @@ public virtual Response Get(CancellationToken can /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupResource.Delete"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupResource.Delete"); scope.Start(); try { - var response = await _elasticSanVolumeGroupVolumeGroupsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(_elasticSanVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _elasticSanVolumeGroupVolumeGroupsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _volumeGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(_volumeGroupClientDiagnostics, Pipeline, _volumeGroupRestClient.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; @@ -363,7 +358,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// VolumeGroups_Delete + /// VolumeGroup_Delete /// /// /// Default Api Version @@ -371,7 +366,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Resource - /// + /// /// /// /// @@ -379,12 +374,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 = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupResource.Delete"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupResource.Delete"); scope.Start(); try { - var response = _elasticSanVolumeGroupVolumeGroupsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ElasticSanArmOperation(_elasticSanVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _elasticSanVolumeGroupVolumeGroupsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _volumeGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ElasticSanArmOperation(_volumeGroupClientDiagnostics, Pipeline, _volumeGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -405,7 +400,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// VolumeGroups_Update + /// VolumeGroup_Update /// /// /// Default Api Version @@ -413,7 +408,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Resource - /// + /// /// /// /// @@ -421,16 +416,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Volume Group object. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticSanVolumeGroupPatch patch, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, VolumeGroupPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupResource.Update"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupResource.Update"); scope.Start(); try { - var response = await _elasticSanVolumeGroupVolumeGroupsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(new ElasticSanVolumeGroupOperationSource(Client), _elasticSanVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _elasticSanVolumeGroupVolumeGroupsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = await _volumeGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(new VolumeGroupOperationSource(Client), _volumeGroupClientDiagnostics, Pipeline, _volumeGroupRestClient.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; @@ -451,7 +446,7 @@ public virtual async Task> UpdateAsy /// /// /// Operation Id - /// VolumeGroups_Update + /// VolumeGroup_Update /// /// /// Default Api Version @@ -459,7 +454,7 @@ public virtual async Task> UpdateAsy /// /// /// Resource - /// + /// /// /// /// @@ -467,16 +462,16 @@ public virtual async Task> UpdateAsy /// Volume Group object. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ElasticSanVolumeGroupPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, VolumeGroupPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupResource.Update"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupResource.Update"); scope.Start(); try { - var response = _elasticSanVolumeGroupVolumeGroupsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanVolumeGroupOperationSource(Client), _elasticSanVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _elasticSanVolumeGroupVolumeGroupsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = _volumeGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new ElasticSanArmOperation(new VolumeGroupOperationSource(Client), _volumeGroupClientDiagnostics, Pipeline, _volumeGroupRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -497,7 +492,7 @@ public virtual ArmOperation Update(WaitUntil wait /// /// /// Operation Id - /// Volumes_PreBackup + /// VolumeGroups_PreBackup /// /// /// Default Api Version @@ -505,24 +500,24 @@ public virtual ArmOperation Update(WaitUntil wait /// /// /// 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. - /// Volume Name List (currently only one volume name in the list is supported. Server would return error if list is bigger). + /// Volume Name List (currently only one volume name in the list is supported. Server would return error if list is bigger). /// The cancellation token to use. - /// is null. - public virtual async Task> PreBackupVolumeAsync(WaitUntil waitUntil, ElasticSanVolumeNameListContent content, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> PreBackupAsync(WaitUntil waitUntil, VolumeNameList volumeNameList, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(volumeNameList, nameof(volumeNameList)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeGroupResource.PreBackupVolume"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupResource.PreBackup"); scope.Start(); try { - var response = await _elasticSanVolumeVolumesRestClient.PreBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(new ElasticSanPreValidationResultOperationSource(), _elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreatePreBackupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = await _volumeGroupRestClient.PreBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeNameList, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(new PreValidationResultOperationSource(), _volumeGroupClientDiagnostics, Pipeline, _volumeGroupRestClient.CreatePreBackupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeNameList).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -543,7 +538,7 @@ public virtual async Task> PreBackup /// /// /// Operation Id - /// Volumes_PreBackup + /// VolumeGroups_PreBackup /// /// /// Default Api Version @@ -551,24 +546,24 @@ public virtual async Task> PreBackup /// /// /// 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. - /// Volume Name List (currently only one volume name in the list is supported. Server would return error if list is bigger). + /// Volume Name List (currently only one volume name in the list is supported. Server would return error if list is bigger). /// The cancellation token to use. - /// is null. - public virtual ArmOperation PreBackupVolume(WaitUntil waitUntil, ElasticSanVolumeNameListContent content, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation PreBackup(WaitUntil waitUntil, VolumeNameList volumeNameList, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(volumeNameList, nameof(volumeNameList)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeGroupResource.PreBackupVolume"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupResource.PreBackup"); scope.Start(); try { - var response = _elasticSanVolumeVolumesRestClient.PreBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanPreValidationResultOperationSource(), _elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreatePreBackupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = _volumeGroupRestClient.PreBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeNameList, cancellationToken); + var operation = new ElasticSanArmOperation(new PreValidationResultOperationSource(), _volumeGroupClientDiagnostics, Pipeline, _volumeGroupRestClient.CreatePreBackupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeNameList).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -589,7 +584,7 @@ public virtual ArmOperation PreBackupVolume(WaitU /// /// /// Operation Id - /// Volumes_PreRestore + /// VolumeGroups_PreRestore /// /// /// Default Api Version @@ -597,24 +592,24 @@ public virtual ArmOperation PreBackupVolume(WaitU /// /// /// 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. - /// Disk Snapshot List (currently only one Disk Snapshot in the list is supported and that the Disk Snapshot must be in same azure region as the ElasticSan. Server would return error if list is bigger). + /// Disk Snapshot List (currently only one Disk Snapshot in the list is supported and that the Disk Snapshot must be in same azure region as the ElasticSan. Server would return error if list is bigger). /// The cancellation token to use. - /// is null. - public virtual async Task> PreRestoreVolumeAsync(WaitUntil waitUntil, DiskSnapshotListContent content, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> PreRestoreAsync(WaitUntil waitUntil, DiskSnapshotList diskSnapshotList, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(diskSnapshotList, nameof(diskSnapshotList)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeGroupResource.PreRestoreVolume"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupResource.PreRestore"); scope.Start(); try { - var response = await _elasticSanVolumeVolumesRestClient.PreRestoreAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(new ElasticSanPreValidationResultOperationSource(), _elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreatePreRestoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = await _volumeGroupRestClient.PreRestoreAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, diskSnapshotList, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(new PreValidationResultOperationSource(), _volumeGroupClientDiagnostics, Pipeline, _volumeGroupRestClient.CreatePreRestoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, diskSnapshotList).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -635,7 +630,7 @@ public virtual async Task> PreRestor /// /// /// Operation Id - /// Volumes_PreRestore + /// VolumeGroups_PreRestore /// /// /// Default Api Version @@ -643,24 +638,24 @@ public virtual async Task> PreRestor /// /// /// 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. - /// Disk Snapshot List (currently only one Disk Snapshot in the list is supported and that the Disk Snapshot must be in same azure region as the ElasticSan. Server would return error if list is bigger). + /// Disk Snapshot List (currently only one Disk Snapshot in the list is supported and that the Disk Snapshot must be in same azure region as the ElasticSan. Server would return error if list is bigger). /// The cancellation token to use. - /// is null. - public virtual ArmOperation PreRestoreVolume(WaitUntil waitUntil, DiskSnapshotListContent content, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation PreRestore(WaitUntil waitUntil, DiskSnapshotList diskSnapshotList, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(diskSnapshotList, nameof(diskSnapshotList)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeGroupResource.PreRestoreVolume"); + using var scope = _volumeGroupClientDiagnostics.CreateScope("VolumeGroupResource.PreRestore"); scope.Start(); try { - var response = _elasticSanVolumeVolumesRestClient.PreRestore(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanPreValidationResultOperationSource(), _elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreatePreRestoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = _volumeGroupRestClient.PreRestore(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, diskSnapshotList, cancellationToken); + var operation = new ElasticSanArmOperation(new PreValidationResultOperationSource(), _volumeGroupClientDiagnostics, Pipeline, _volumeGroupRestClient.CreatePreRestoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, diskSnapshotList).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeResource.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeResource.Serialization.cs new file mode 100644 index 000000000000..67abdf879925 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeResource.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.ElasticSan +{ + public partial class VolumeResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + VolumeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticSanContext.Default); + + VolumeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticSanContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeResource.cs similarity index 63% rename from sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs rename to sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeResource.cs index a70822812c50..99201f7251ed 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/VolumeResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.ElasticSan { /// - /// A Class representing an ElasticSanVolume 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 GetElasticSanVolumeResource method. - /// Otherwise you can get one from its parent resource using the GetElasticSanVolume method. + /// A Class representing a Volume 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 GetVolumeResource method. + /// Otherwise you can get one from its parent resource using the GetVolume method. /// - public partial class ElasticSanVolumeResource : ArmResource + public partial class VolumeResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The elasticSanName. @@ -35,39 +35,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _elasticSanVolumeVolumesClientDiagnostics; - private readonly VolumesRestOperations _elasticSanVolumeVolumesRestClient; - private readonly ClientDiagnostics _defaultClientDiagnostics; - private readonly ElasticSanManagementRestOperations _defaultRestClient; - private readonly ElasticSanVolumeData _data; + private readonly ClientDiagnostics _volumeClientDiagnostics; + private readonly VolumesRestOperations _volumeRestClient; + private readonly VolumeData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.ElasticSan/elasticSans/volumegroups/volumes"; - /// Initializes a new instance of the class for mocking. - protected ElasticSanVolumeResource() + /// Initializes a new instance of the class for mocking. + protected VolumeResource() { } - /// 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 ElasticSanVolumeResource(ArmClient client, ElasticSanVolumeData data) : this(client, data.Id) + internal VolumeResource(ArmClient client, VolumeData 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 ElasticSanVolumeResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal VolumeResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticSanVolumeVolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string elasticSanVolumeVolumesApiVersion); - _elasticSanVolumeVolumesRestClient = new VolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticSanVolumeVolumesApiVersion); - _defaultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _defaultRestClient = new ElasticSanManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _volumeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string volumeApiVersion); + _volumeRestClient = new VolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, volumeApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -78,7 +74,7 @@ internal ElasticSanVolumeResource(ArmClient client, ResourceIdentifier id) : bas /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual ElasticSanVolumeData Data + public virtual VolumeData Data { get { @@ -103,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Volumes_Get + /// Volume_Get /// /// /// Default Api Version @@ -111,21 +107,21 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// 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 = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeResource.Get"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeResource.Get"); scope.Start(); try { - var response = await _elasticSanVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _volumeRestClient.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 ElasticSanVolumeResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -143,7 +139,7 @@ public virtual async Task> GetAsync(Cancellat /// /// /// Operation Id - /// Volumes_Get + /// Volume_Get /// /// /// Default Api Version @@ -151,21 +147,21 @@ public virtual async Task> GetAsync(Cancellat /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeResource.Get"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeResource.Get"); scope.Start(); try { - var response = _elasticSanVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _volumeRestClient.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 ElasticSanVolumeResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -183,7 +179,7 @@ public virtual Response Get(CancellationToken cancella /// /// /// Operation Id - /// Volumes_Delete + /// Volume_Delete /// /// /// Default Api Version @@ -191,23 +187,23 @@ public virtual Response Get(CancellationToken cancella /// /// /// 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. - /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. - /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. + /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. + /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. /// Optional. Specifies that the delete operation should be a permanent delete for the soft deleted volume. The value of deleteType can only be 'permanent'. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, ElasticSanDeleteSnapshotsUnderVolume? deleteSnapshots = null, ElasticSanForceDeleteVolume? forceDelete = null, ElasticSanDeleteType? deleteType = null, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, XMsDeleteSnapshot? xMsDeleteSnapshots = null, XMsForceDelete? xMsForceDelete = null, DeleteType? deleteType = null, CancellationToken cancellationToken = default) { - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeResource.Delete"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeResource.Delete"); scope.Start(); try { - var response = await _elasticSanVolumeVolumesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, deleteSnapshots, forceDelete, deleteType, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(_elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, deleteSnapshots, forceDelete, deleteType).Request, response, OperationFinalStateVia.Location); + var response = await _volumeRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, xMsDeleteSnapshots, xMsForceDelete, deleteType, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(_volumeClientDiagnostics, Pipeline, _volumeRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, xMsDeleteSnapshots, xMsForceDelete, deleteType).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -228,7 +224,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Elastic /// /// /// Operation Id - /// Volumes_Delete + /// Volume_Delete /// /// /// Default Api Version @@ -236,23 +232,23 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Elastic /// /// /// 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. - /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. - /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. + /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. + /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. /// Optional. Specifies that the delete operation should be a permanent delete for the soft deleted volume. The value of deleteType can only be 'permanent'. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, ElasticSanDeleteSnapshotsUnderVolume? deleteSnapshots = null, ElasticSanForceDeleteVolume? forceDelete = null, ElasticSanDeleteType? deleteType = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, XMsDeleteSnapshot? xMsDeleteSnapshots = null, XMsForceDelete? xMsForceDelete = null, DeleteType? deleteType = null, CancellationToken cancellationToken = default) { - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeResource.Delete"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeResource.Delete"); scope.Start(); try { - var response = _elasticSanVolumeVolumesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, deleteSnapshots, forceDelete, deleteType, cancellationToken); - var operation = new ElasticSanArmOperation(_elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, deleteSnapshots, forceDelete, deleteType).Request, response, OperationFinalStateVia.Location); + var response = _volumeRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, xMsDeleteSnapshots, xMsForceDelete, deleteType, cancellationToken); + var operation = new ElasticSanArmOperation(_volumeClientDiagnostics, Pipeline, _volumeRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, xMsDeleteSnapshots, xMsForceDelete, deleteType).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -273,7 +269,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ElasticSanDeleteSnapshot /// /// /// Operation Id - /// Volumes_Update + /// Volume_Update /// /// /// Default Api Version @@ -281,7 +277,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ElasticSanDeleteSnapshot /// /// /// Resource - /// + /// /// /// /// @@ -289,16 +285,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ElasticSanDeleteSnapshot /// Volume object. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticSanVolumePatch patch, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, VolumePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeResource.Update"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeResource.Update"); scope.Start(); try { - var response = await _elasticSanVolumeVolumesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(new ElasticSanVolumeOperationSource(Client), _elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = await _volumeRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(new VolumeOperationSource(Client), _volumeClientDiagnostics, Pipeline, _volumeRestClient.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); return operation; @@ -319,7 +315,7 @@ public virtual async Task> UpdateAsync(Wa /// /// /// Operation Id - /// Volumes_Update + /// Volume_Update /// /// /// Default Api Version @@ -327,7 +323,7 @@ public virtual async Task> UpdateAsync(Wa /// /// /// Resource - /// + /// /// /// /// @@ -335,16 +331,16 @@ public virtual async Task> UpdateAsync(Wa /// Volume object. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ElasticSanVolumePatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, VolumePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeResource.Update"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeResource.Update"); scope.Start(); try { - var response = _elasticSanVolumeVolumesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanVolumeOperationSource(Client), _elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = _volumeRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new ElasticSanArmOperation(new VolumeOperationSource(Client), _volumeClientDiagnostics, Pipeline, _volumeRestClient.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); return operation; @@ -365,24 +361,28 @@ public virtual ArmOperation Update(WaitUntil waitUntil /// /// /// Operation Id - /// RestoreVolume + /// Volumes_RestoreVolume /// /// /// Default Api Version /// 2024-07-01-preview /// + /// + /// 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> RestoreVolumeAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task> RestoreVolumeAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _defaultClientDiagnostics.CreateScope("ElasticSanVolumeResource.RestoreVolume"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeResource.RestoreVolume"); scope.Start(); try { - var response = await _defaultRestClient.RestoreVolumeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(new ElasticSanVolumeOperationSource(Client), _defaultClientDiagnostics, Pipeline, _defaultRestClient.CreateRestoreVolumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _volumeRestClient.RestoreVolumeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(new VolumeOperationSource(Client), _volumeClientDiagnostics, Pipeline, _volumeRestClient.CreateRestoreVolumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -403,24 +403,28 @@ public virtual async Task> RestoreVolumeA /// /// /// Operation Id - /// RestoreVolume + /// Volumes_RestoreVolume /// /// /// Default Api Version /// 2024-07-01-preview /// + /// + /// 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 RestoreVolume(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation RestoreVolume(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _defaultClientDiagnostics.CreateScope("ElasticSanVolumeResource.RestoreVolume"); + using var scope = _volumeClientDiagnostics.CreateScope("VolumeResource.RestoreVolume"); scope.Start(); try { - var response = _defaultRestClient.RestoreVolume(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ElasticSanArmOperation(new ElasticSanVolumeOperationSource(Client), _defaultClientDiagnostics, Pipeline, _defaultRestClient.CreateRestoreVolumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _volumeRestClient.RestoreVolume(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ElasticSanArmOperation(new VolumeOperationSource(Client), _volumeClientDiagnostics, Pipeline, _volumeRestClient.CreateRestoreVolumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/autorest.md b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/autorest.md deleted file mode 100644 index e6a49d53fb43..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/autorest.md +++ /dev/null @@ -1,124 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml - -azure-arm: true -csharp: true -library-name: ElasticSan -namespace: Azure.ResourceManager.ElasticSan -require: https://github.com/Azure/azure-rest-api-specs/blob/3db6867b8e524ea6d1bc7a3bbb989fe50dd2f184/specification/elasticsan/resource-manager/readme.md -#tag: package-2024-07-01-preview -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 - -#mgmt-debug: -# show-serialized-names: true - -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 - MBps: Mbps - LRS: Lrs - ZRS: Zrs - XMs: Xms - -prepend-rp-prefix: - - EncryptionType - - Name - - Tier - - Volume - - VolumeCreateOption - - VolumeGroup - - VolumeGroupList - - VolumeList - - SkuInformationList - - SkuLocationInfo - - Snapshot - - KeyVaultProperties - - EncryptionProperties - - PublicNetworkAccess - - StorageTargetType - - DeleteType - - VirtualNetworkRule - - EncryptionIdentity - - NetworkRuleSet - - ScaleUpProperties - - DeleteRetentionPolicy - -rename-mapping: - Volume.properties.volumeId: -|uuid - VirtualNetworkRule.id: -|arm-id - EncryptionIdentity.userAssignedIdentity: -|arm-id - Action: ElasticSanVirtualNetworkRuleAction - OperationalStatus: ResourceOperationalStatus - ProvisioningStates: ElasticSanProvisioningState - State: ElasticSanVirtualNetworkRuleState - SKUCapability: ElasticSanSkuCapability - SourceCreationData: ElasticSanVolumeDataSourceInfo - SnapshotCreationData: SnapshotCreationInfo - DiskSnapshotList: DiskSnapshotListContent - PolicyState: ElasticSanDeleteRetentionPolicyState - PreValidationResponse: ElasticSanPreValidationResult - VolumeNameList: ElasticSanVolumeNameListContent - XMsDeleteSnapshots: ElasticSanDeleteSnapshotsUnderVolume - XMsAccessSoftDeletedResources: ElasticSanAccessSoftDeletedVolume - XMsForceDelete: ElasticSanForceDeleteVolume - -directive: -- from: elasticsan.json - where: $.definitions.SourceCreationData.properties.sourceId - transform: $["x-ms-format"] = "arm-id"; -- from: elasticsan.json - where: $.definitions.SnapshotCreationData.properties.sourceId - transform: $["x-ms-format"] = "arm-id"; -- from: elasticsan.json - where: $.definitions.ManagedByInfo.properties.resourceId - transform: $["x-ms-format"] = "arm-id"; -- from: elasticsan.json - where: $.paths..parameters[?(@.name=='x-ms-force-delete')] - transform: > - $['x-ms-client-name'] = 'ForceDelete'; -- from: elasticsan.json - where: $.paths..parameters[?(@.name=='x-ms-access-soft-deleted-resources')] - transform: > - $['x-ms-client-name'] = 'AccessSoftDeletedResources'; -- from: elasticsan.json - where: $.paths..parameters[?(@.name=='x-ms-delete-snapshots')] - transform: > - $['x-ms-client-name'] = 'DeleteSnapshots'; -``` diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tsp-location.yaml b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tsp-location.yaml new file mode 100644 index 000000000000..c7ca598fc88f --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/elasticsan/ElasticSan.Management +commit: 0e8a60212052dc13f9d071cbc573dedf07234699 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/