diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResource.cs index 740ee0b1ade0..fc403c2a103f 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResource.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResource.cs @@ -20,8 +20,8 @@ public partial class Sample_ElasticMonitorResource [Ignore("Only validating compilation of examples")] public async Task Get_MonitorsGet() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Get.json - // this example is just showing the usage of "Monitors_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/Monitors_Get.json + // this example is just showing the usage of "ElasticMonitorResource_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(); @@ -34,14 +34,14 @@ public async Task Get_MonitorsGet() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - ElasticMonitorResource result = await elasticMonitor.GetAsync(); + ElasticMonitorResource result = await elasticMonitorResource.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 - ElasticMonitorData resourceData = result.Data; + ElasticMonitorResourceData resourceData = result.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -50,8 +50,8 @@ public async Task Get_MonitorsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_MonitorsDelete() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Delete.json - // this example is just showing the usage of "Monitors_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/Monitors_Delete.json + // this example is just showing the usage of "ElasticMonitorResource_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(); @@ -64,10 +64,10 @@ public async Task Delete_MonitorsDelete() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - await elasticMonitor.DeleteAsync(WaitUntil.Completed); + await elasticMonitorResource.DeleteAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } @@ -76,8 +76,8 @@ public async Task Delete_MonitorsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_MonitorsUpdate() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Update.json - // this example is just showing the usage of "Monitors_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/Monitors_Update.json + // this example is just showing the usage of "ElasticMonitorResource_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(); @@ -90,25 +90,21 @@ public async Task Update_MonitorsUpdate() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - ElasticMonitorPatch patch = new ElasticMonitorPatch(); - ElasticMonitorResource result = await elasticMonitor.UpdateAsync(patch); + ElasticMonitorResourcePatch patch = new ElasticMonitorResourcePatch(); + await elasticMonitorResource.UpdateAsync(WaitUntil.Completed, patch); - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ElasticMonitorData 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 GetMonitoredResources_MonitoredResourcesList() + public async Task MonitoredResourcesList_MonitoredResourcesList() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/MonitoredResources_List.json - // this example is just showing the usage of "MonitoredResources_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/MonitoredResources_List.json + // this example is just showing the usage of "ElasticMonitorResources_MonitoredResourcesList" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -121,10 +117,10 @@ public async Task GetMonitoredResources_MonitoredResourcesList() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation and iterate over the result - await foreach (MonitoredResourceInfo item in elasticMonitor.GetMonitoredResourcesAsync()) + await foreach (MonitoredResource item in elasticMonitorResource.MonitoredResourcesListAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -134,10 +130,10 @@ public async Task GetMonitoredResources_MonitoredResourcesList() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetDeploymentInfo_DeploymentInfoList() + public async Task DeploymentInfoList_DeploymentInfoList() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/DeploymentInfo_List.json - // this example is just showing the usage of "DeploymentInfo_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/DeploymentInfo_List.json + // this example is just showing the usage of "ElasticMonitorResources_DeploymentInfoList" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -150,20 +146,20 @@ public async Task GetDeploymentInfo_DeploymentInfoList() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - ElasticDeploymentInfoResult result = await elasticMonitor.GetDeploymentInfoAsync(); + DeploymentInfoResponse result = await elasticMonitorResource.DeploymentInfoListAsync(); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdateExternalUser_ExternalUserCreateOrUpdate() + public async Task CreateOrUpdate_ExternalUserCreateOrUpdate() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ExternalUserInfo.json - // this example is just showing the usage of "ExternalUser_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/ExternalUserInfo.json + // this example is just showing the usage of "ElasticMonitorResources_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -176,20 +172,20 @@ public async Task CreateOrUpdateExternalUser_ExternalUserCreateOrUpdate() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - ElasticExternalUserCreationResult result = await elasticMonitor.CreateOrUpdateExternalUserAsync(); + ExternalUserCreationResponse result = await elasticMonitorResource.CreateOrUpdateAsync(); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task GetBillingInfo_BillingInfoGet() + public async Task BillingInfoGet_BillingInfoGet() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/BillingInfo_Get.json - // this example is just showing the usage of "BillingInfo_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/BillingInfo_Get.json + // this example is just showing the usage of "ElasticMonitorResources_BillingInfoGet" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -202,20 +198,20 @@ public async Task GetBillingInfo_BillingInfoGet() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - ElasticBillingInfoResult result = await elasticMonitor.GetBillingInfoAsync(); + BillingInfoResponse result = await elasticMonitorResource.BillingInfoGetAsync(); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task GetConnectedPartnerResources_ConnectedPartnerResourcesList() + public async Task ConnectedPartnerResourcesList_ConnectedPartnerResourcesList() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ConnectedPartnerResources_List.json - // this example is just showing the usage of "ConnectedPartnerResources_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/ConnectedPartnerResources_List.json + // this example is just showing the usage of "ElasticMonitorResources_ConnectedPartnerResourcesList" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -228,10 +224,10 @@ public async Task GetConnectedPartnerResources_ConnectedPartnerResourcesList() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation and iterate over the result - await foreach (ConnectedPartnerResourceInfo item in elasticMonitor.GetConnectedPartnerResourcesAsync()) + await foreach (ConnectedPartnerResourcesListFormat item in elasticMonitorResource.ConnectedPartnerResourcesListAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -241,10 +237,10 @@ public async Task GetConnectedPartnerResources_ConnectedPartnerResourcesList() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetVmHosts_VMHostList() + public async Task VmHostList_VMHostList() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMHost_List.json - // this example is just showing the usage of "VMHost_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/VMHost_List.json + // this example is just showing the usage of "ElasticMonitorResources_VmHostList" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -257,10 +253,10 @@ public async Task GetVmHosts_VMHostList() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation and iterate over the result - await foreach (ElasticVmResourceInfo item in elasticMonitor.GetVmHostsAsync()) + await foreach (VmResources item in elasticMonitorResource.VmHostListAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -270,10 +266,10 @@ public async Task GetVmHosts_VMHostList() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetVmIngestionDetails_VMIngestionDetails() + public async Task Details_VMIngestionDetails() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMIngestion_Details.json - // this example is just showing the usage of "VMIngestion_Details" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/VMIngestion_Details.json + // this example is just showing the usage of "ElasticMonitorResources_Details" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -286,20 +282,20 @@ public async Task GetVmIngestionDetails_VMIngestionDetails() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - VmIngestionDetailsResult result = await elasticMonitor.GetVmIngestionDetailsAsync(); + VmIngestionDetailsResponse result = await elasticMonitorResource.DetailsAsync(); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task UpdateVmCollection_VMCollectionUpdate() + public async Task VmCollectionUpdate_VMCollectionUpdate() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMCollection_Update.json - // this example is just showing the usage of "VMCollection_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/VMCollection_Update.json + // this example is just showing the usage of "ElasticMonitorResources_VmCollectionUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -312,20 +308,20 @@ public async Task UpdateVmCollection_VMCollectionUpdate() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - await elasticMonitor.UpdateVmCollectionAsync(); + await elasticMonitorResource.VmCollectionUpdateAsync(); Console.WriteLine("Succeeded"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task GetUpgradableVersionDetails_UpgradableVersionsDetails() + public async Task UpgradableVersionsDetails_UpgradableVersionsDetails() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/UpgradableVersions_Details.json - // this example is just showing the usage of "UpgradableVersions_Details" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/UpgradableVersions_Details.json + // this example is just showing the usage of "ElasticMonitorResources_UpgradableVersionsDetails" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -338,20 +334,20 @@ public async Task GetUpgradableVersionDetails_UpgradableVersionsDetails() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - UpgradableVersionListResult result = await elasticMonitor.GetUpgradableVersionDetailsAsync(); + UpgradableVersionsList result = await elasticMonitorResource.UpgradableVersionsDetailsAsync(); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task UpgradeMonitor_MonitorUpgrade() + public async Task Upgrade_MonitorUpgrade() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitor_Upgrade.json - // this example is just showing the usage of "Monitor_Upgrade" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/Monitor_Upgrade.json + // this example is just showing the usage of "ElasticMonitorResources_Upgrade" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -364,20 +360,20 @@ public async Task UpgradeMonitor_MonitorUpgrade() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - await elasticMonitor.UpgradeMonitorAsync(WaitUntil.Completed); + await elasticMonitorResource.UpgradeAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAllTrafficFilter_AllTrafficFiltersList() + public async Task AllTrafficFiltersList_AllTrafficFiltersList() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/AllTrafficFilters_list.json - // this example is just showing the usage of "AllTrafficFilters_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/AllTrafficFilters_list.json + // this example is just showing the usage of "ElasticMonitorResources_AllTrafficFiltersList" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -390,20 +386,20 @@ public async Task GetAllTrafficFilter_AllTrafficFiltersList() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - ElasticTrafficFilterListResult result = await elasticMonitor.GetAllTrafficFilterAsync(); + ElasticTrafficFilterResponse result = await elasticMonitorResource.AllTrafficFiltersListAsync(); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAssociatedTrafficFilters_ListAssociatedTrafficFiltersList() + public async Task GetAssociatedTrafficFiltersList_ListAssociatedTrafficFiltersList() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/AssociatedFiltersForDeployment_list.json - // this example is just showing the usage of "listAssociatedTrafficFilters_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/AssociatedFiltersForDeployment_list.json + // this example is just showing the usage of "ElasticMonitorResources_ListAssociatedTrafficFiltersList" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -416,20 +412,20 @@ public async Task GetAssociatedTrafficFilters_ListAssociatedTrafficFiltersList() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation - ElasticTrafficFilterListResult result = await elasticMonitor.GetAssociatedTrafficFiltersAsync(); + ElasticTrafficFilterResponse result = await elasticMonitorResource.GetAssociatedTrafficFiltersListAsync(); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateAndAssociateIPFilter_CreateAndAssociateIPFilterCreate() + public async Task CreateAndAssociateIPFilterCreate_CreateAndAssociateIPFilterCreate() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/IPTrafficFilter_Create.json - // this example is just showing the usage of "createAndAssociateIPFilter_Create" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/IPTrafficFilter_Create.json + // this example is just showing the usage of "ElasticMonitorResources_CreateAndAssociateIPFilterCreate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -442,21 +438,22 @@ public async Task CreateAndAssociateIPFilter_CreateAndAssociateIPFilterCreate() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation string ips = "192.168.131.0, 192.168.132.6/22"; - await elasticMonitor.CreateAndAssociateIPFilterAsync(WaitUntil.Completed, ips: ips); + ArmOperation lro = await elasticMonitorResource.CreateAndAssociateIPFilterCreateAsync(WaitUntil.Completed, ips: ips); + OkResponse result = lro.Value; - Console.WriteLine("Succeeded"); + Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateAndAssociatePrivateLinkFilter_CreateAndAssociatePLFilterCreate() + public async Task CreateAndAssociatePLFilterCreate_CreateAndAssociatePLFilterCreate() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/PrivateLinkTrafficFilters_Create.json - // this example is just showing the usage of "createAndAssociatePLFilter_Create" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/PrivateLinkTrafficFilters_Create.json + // this example is just showing the usage of "ElasticMonitorResources_CreateAndAssociatePLFilterCreate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -469,22 +466,23 @@ public async Task CreateAndAssociatePrivateLinkFilter_CreateAndAssociatePLFilter string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation string privateEndpointGuid = "fdb54d3b-e85e-4d08-8958-0d2f7g523df9"; string privateEndpointName = "myPrivateEndpoint"; - await elasticMonitor.CreateAndAssociatePrivateLinkFilterAsync(WaitUntil.Completed, privateEndpointGuid: privateEndpointGuid, privateEndpointName: privateEndpointName); + ArmOperation lro = await elasticMonitorResource.CreateAndAssociatePLFilterCreateAsync(WaitUntil.Completed, privateEndpointGuid: privateEndpointGuid, privateEndpointName: privateEndpointName); + OkResponse result = lro.Value; - Console.WriteLine("Succeeded"); + Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task AssociateTrafficFilter_AssociateTrafficFilterAssociate() + public async Task Associate_AssociateTrafficFilterAssociate() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/AssociateTrafficFilter_Update.json - // this example is just showing the usage of "AssociateTrafficFilter_Associate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/AssociateTrafficFilter_Update.json + // this example is just showing the usage of "ElasticMonitorResources_Associate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -497,21 +495,21 @@ public async Task AssociateTrafficFilter_AssociateTrafficFilterAssociate() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation string rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; - await elasticMonitor.AssociateTrafficFilterAsync(WaitUntil.Completed, rulesetId: rulesetId); + await elasticMonitorResource.AssociateAsync(WaitUntil.Completed, rulesetId: rulesetId); Console.WriteLine("Succeeded"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task DetachAndDeleteTrafficFilter_DetachAndDeleteTrafficFilterDelete() + public async Task DetachAndDeleteTrafficFilterDelete_DetachAndDeleteTrafficFilterDelete() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/DetachAndDeleteTrafficFilter_Delete.json - // this example is just showing the usage of "DetachAndDeleteTrafficFilter_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/DetachAndDeleteTrafficFilter_Delete.json + // this example is just showing the usage of "ElasticMonitorResources_DetachAndDeleteTrafficFilterDelete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -524,21 +522,21 @@ public async Task DetachAndDeleteTrafficFilter_DetachAndDeleteTrafficFilterDelet string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation string rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; - await elasticMonitor.DetachAndDeleteTrafficFilterAsync(rulesetId: rulesetId); + await elasticMonitorResource.DetachAndDeleteTrafficFilterDeleteAsync(rulesetId: rulesetId); Console.WriteLine("Succeeded"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task DetachTrafficFilter_DetachTrafficFilterUpdate() + public async Task DetachTrafficFilterUpdate_DetachTrafficFilterUpdate() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/DetachTrafficFilters_Update.json - // this example is just showing the usage of "DetachTrafficFilter_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/DetachTrafficFilters_Update.json + // this example is just showing the usage of "ElasticMonitorResources_DetachTrafficFilterUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -551,21 +549,21 @@ public async Task DetachTrafficFilter_DetachTrafficFilterUpdate() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation string rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; - await elasticMonitor.DetachTrafficFilterAsync(WaitUntil.Completed, rulesetId: rulesetId); + await elasticMonitorResource.DetachTrafficFilterUpdateAsync(WaitUntil.Completed, rulesetId: rulesetId); Console.WriteLine("Succeeded"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task DeleteTrafficFilter_TrafficFiltersDelete() + public async Task TrafficFiltersDelete_TrafficFiltersDelete() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TrafficFilters_Delete.json - // this example is just showing the usage of "TrafficFilters_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/TrafficFilters_Delete.json + // this example is just showing the usage of "ElasticMonitorResources_TrafficFiltersDelete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -578,13 +576,40 @@ public async Task DeleteTrafficFilter_TrafficFiltersDelete() string resourceGroupName = "myResourceGroup"; string monitorName = "myMonitor"; ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); - ElasticMonitorResource elasticMonitor = client.GetElasticMonitorResource(elasticMonitorResourceId); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); // invoke the operation string rulesetId = "31d91b5afb6f4c2eaaf104c97b1991dd"; - await elasticMonitor.DeleteTrafficFilterAsync(rulesetId: rulesetId); + await elasticMonitorResource.TrafficFiltersDeleteAsync(rulesetId: rulesetId); Console.WriteLine("Succeeded"); } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Resubscribe_OrganizationsResubscribe() + { + // Generated from example definition: 2025-01-15-preview/Organizations_Resubscribe.json + // this example is just showing the usage of "ElasticMonitorResources_Resubscribe" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK 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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // invoke the operation + ArmOperation lro = await elasticMonitorResource.ResubscribeAsync(WaitUntil.Completed); + ArmResponseElasticMonitorResource result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResourceCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResourceCollection.cs new file mode 100644 index 000000000000..35afeb1754f1 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_ElasticMonitorResourceCollection.cs @@ -0,0 +1,192 @@ +// 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.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Elastic.Samples +{ + public partial class Sample_ElasticMonitorResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_MonitorsCreate() + { + // Generated from example definition: 2025-01-15-preview/Monitors_Create.json + // this example is just showing the usage of "ElasticMonitorResource_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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ElasticMonitorResource + ElasticMonitorResourceCollection collection = resourceGroupResource.GetElasticMonitorResources(); + + // invoke the operation + string monitorName = "myMonitor"; + ElasticMonitorResourceData data = new ElasticMonitorResourceData(default); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, monitorName, data); + ElasticMonitorResource 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 + ElasticMonitorResourceData 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_MonitorsGet() + { + // Generated from example definition: 2025-01-15-preview/Monitors_Get.json + // this example is just showing the usage of "ElasticMonitorResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ElasticMonitorResource + ElasticMonitorResourceCollection collection = resourceGroupResource.GetElasticMonitorResources(); + + // invoke the operation + string monitorName = "myMonitor"; + ElasticMonitorResource result = await collection.GetAsync(monitorName); + + // 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 + ElasticMonitorResourceData 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_MonitorsListByResourceGroup() + { + // Generated from example definition: 2025-01-15-preview/Monitors_ListByResourceGroup.json + // this example is just showing the usage of "ElasticMonitorResource_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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ElasticMonitorResource + ElasticMonitorResourceCollection collection = resourceGroupResource.GetElasticMonitorResources(); + + // invoke the operation and iterate over the result + await foreach (ElasticMonitorResource 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 + ElasticMonitorResourceData 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_MonitorsGet() + { + // Generated from example definition: 2025-01-15-preview/Monitors_Get.json + // this example is just showing the usage of "ElasticMonitorResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ElasticMonitorResource + ElasticMonitorResourceCollection collection = resourceGroupResource.GetElasticMonitorResources(); + + // invoke the operation + string monitorName = "myMonitor"; + bool result = await collection.ExistsAsync(monitorName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_MonitorsGet() + { + // Generated from example definition: 2025-01-15-preview/Monitors_Get.json + // this example is just showing the usage of "ElasticMonitorResource_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ElasticMonitorResource + ElasticMonitorResourceCollection collection = resourceGroupResource.GetElasticMonitorResources(); + + // invoke the operation + string monitorName = "myMonitor"; + NullableResponse response = await collection.GetIfExistsAsync(monitorName); + ElasticMonitorResource 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 + ElasticMonitorResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoredSubscriptionPropertyCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoredSubscriptionPropertyCollection.cs new file mode 100644 index 000000000000..1b4dcb50a341 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoredSubscriptionPropertyCollection.cs @@ -0,0 +1,191 @@ +// 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.Elastic.Samples +{ + public partial class Sample_MonitoredSubscriptionPropertyCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_MonitorsAddMonitoredSubscriptions() + { + // Generated from example definition: 2025-01-15-preview/MonitoredSubscriptions_CreateorUpdate.json + // this example is just showing the usage of "MonitoredSubscriptionProperties_CreateorUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoredSubscriptionPropertyResource + MonitoredSubscriptionPropertyCollection collection = elasticMonitorResource.GetMonitoredSubscriptionProperties(); + + // invoke the operation + string configurationName = "default"; + MonitoredSubscriptionPropertyData data = new MonitoredSubscriptionPropertyData(); + await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationName, data); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_MonitorsGetMonitoredSubscriptions() + { + // Generated from example definition: 2025-01-15-preview/MonitoredSubscriptions_Get.json + // this example is just showing the usage of "MonitoredSubscriptionProperties_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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoredSubscriptionPropertyResource + MonitoredSubscriptionPropertyCollection collection = elasticMonitorResource.GetMonitoredSubscriptionProperties(); + + // invoke the operation + string configurationName = "default"; + MonitoredSubscriptionPropertyResource result = await collection.GetAsync(configurationName); + + // 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 + MonitoredSubscriptionPropertyData 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_MonitorsGetMonitoredSubscriptions() + { + // Generated from example definition: 2025-01-15-preview/MonitoredSubscriptions_List.json + // this example is just showing the usage of "MonitoredSubscriptionProperties_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoredSubscriptionPropertyResource + MonitoredSubscriptionPropertyCollection collection = elasticMonitorResource.GetMonitoredSubscriptionProperties(); + + // invoke the operation and iterate over the result + await foreach (MonitoredSubscriptionPropertyResource 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 + MonitoredSubscriptionPropertyData 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_MonitorsGetMonitoredSubscriptions() + { + // Generated from example definition: 2025-01-15-preview/MonitoredSubscriptions_Get.json + // this example is just showing the usage of "MonitoredSubscriptionProperties_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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoredSubscriptionPropertyResource + MonitoredSubscriptionPropertyCollection collection = elasticMonitorResource.GetMonitoredSubscriptionProperties(); + + // invoke the operation + string configurationName = "default"; + bool result = await collection.ExistsAsync(configurationName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_MonitorsGetMonitoredSubscriptions() + { + // Generated from example definition: 2025-01-15-preview/MonitoredSubscriptions_Get.json + // this example is just showing the usage of "MonitoredSubscriptionProperties_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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoredSubscriptionPropertyResource + MonitoredSubscriptionPropertyCollection collection = elasticMonitorResource.GetMonitoredSubscriptionProperties(); + + // invoke the operation + string configurationName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(configurationName); + MonitoredSubscriptionPropertyResource 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 + MonitoredSubscriptionPropertyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoredSubscriptionPropertyResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoredSubscriptionPropertyResource.cs new file mode 100644 index 000000000000..54cd8df3a219 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoredSubscriptionPropertyResource.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Elastic.Samples +{ + public partial class Sample_MonitoredSubscriptionPropertyResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_MonitorsGetMonitoredSubscriptions() + { + // Generated from example definition: 2025-01-15-preview/MonitoredSubscriptions_Get.json + // this example is just showing the usage of "MonitoredSubscriptionProperties_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 MonitoredSubscriptionPropertyResource created on azure + // for more information of creating MonitoredSubscriptionPropertyResource, please refer to the document of MonitoredSubscriptionPropertyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + string configurationName = "default"; + ResourceIdentifier monitoredSubscriptionPropertyResourceId = MonitoredSubscriptionPropertyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName, configurationName); + MonitoredSubscriptionPropertyResource monitoredSubscriptionProperty = client.GetMonitoredSubscriptionPropertyResource(monitoredSubscriptionPropertyResourceId); + + // invoke the operation + MonitoredSubscriptionPropertyResource result = await monitoredSubscriptionProperty.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 + MonitoredSubscriptionPropertyData 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_MonitorsDeleteMonitoredSubscriptions() + { + // Generated from example definition: 2025-01-15-preview/MonitoredSubscriptions_Delete.json + // this example is just showing the usage of "MonitoredSubscriptionProperties_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 MonitoredSubscriptionPropertyResource created on azure + // for more information of creating MonitoredSubscriptionPropertyResource, please refer to the document of MonitoredSubscriptionPropertyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + string configurationName = "default"; + ResourceIdentifier monitoredSubscriptionPropertyResourceId = MonitoredSubscriptionPropertyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName, configurationName); + MonitoredSubscriptionPropertyResource monitoredSubscriptionProperty = client.GetMonitoredSubscriptionPropertyResource(monitoredSubscriptionPropertyResourceId); + + // invoke the operation + await monitoredSubscriptionProperty.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_MonitorsUpdateMonitoredSubscriptions() + { + // Generated from example definition: 2025-01-15-preview/MonitoredSubscriptions_Update.json + // this example is just showing the usage of "MonitoredSubscriptionProperties_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 MonitoredSubscriptionPropertyResource created on azure + // for more information of creating MonitoredSubscriptionPropertyResource, please refer to the document of MonitoredSubscriptionPropertyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + string configurationName = "default"; + ResourceIdentifier monitoredSubscriptionPropertyResourceId = MonitoredSubscriptionPropertyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName, configurationName); + MonitoredSubscriptionPropertyResource monitoredSubscriptionProperty = client.GetMonitoredSubscriptionPropertyResource(monitoredSubscriptionPropertyResourceId); + + // invoke the operation + MonitoredSubscriptionPropertyData data = new MonitoredSubscriptionPropertyData(); + ArmOperation lro = await monitoredSubscriptionProperty.UpdateAsync(WaitUntil.Completed, data); + MonitoredSubscriptionPropertyResource 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 + MonitoredSubscriptionPropertyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs new file mode 100644 index 000000000000..b0ecb726361d --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoringTagRuleCollection.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Elastic.Samples +{ + public partial class Sample_MonitoringTagRuleCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_TagRulesCreateOrUpdate() + { + // Generated from example definition: 2025-01-15-preview/TagRules_CreateOrUpdate.json + // this example is just showing the usage of "MonitoringTagRules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoringTagRuleResource + MonitoringTagRuleCollection collection = elasticMonitorResource.GetMonitoringTagRules(); + + // invoke the operation + string ruleSetName = "default"; + MonitoringTagRuleData data = new MonitoringTagRuleData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, ruleSetName, data); + MonitoringTagRuleResource 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 + MonitoringTagRuleData 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_TagRulesGet() + { + // Generated from example definition: 2025-01-15-preview/TagRules_Get.json + // this example is just showing the usage of "MonitoringTagRules_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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoringTagRuleResource + MonitoringTagRuleCollection collection = elasticMonitorResource.GetMonitoringTagRules(); + + // invoke the operation + string ruleSetName = "default"; + MonitoringTagRuleResource result = await collection.GetAsync(ruleSetName); + + // 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 + MonitoringTagRuleData 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_TagRulesList() + { + // Generated from example definition: 2025-01-15-preview/TagRules_List.json + // this example is just showing the usage of "MonitoringTagRules_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoringTagRuleResource + MonitoringTagRuleCollection collection = elasticMonitorResource.GetMonitoringTagRules(); + + // invoke the operation and iterate over the result + await foreach (MonitoringTagRuleResource 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 + MonitoringTagRuleData 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_TagRulesGet() + { + // Generated from example definition: 2025-01-15-preview/TagRules_Get.json + // this example is just showing the usage of "MonitoringTagRules_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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoringTagRuleResource + MonitoringTagRuleCollection collection = elasticMonitorResource.GetMonitoringTagRules(); + + // invoke the operation + string ruleSetName = "default"; + bool result = await collection.ExistsAsync(ruleSetName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_TagRulesGet() + { + // Generated from example definition: 2025-01-15-preview/TagRules_Get.json + // this example is just showing the usage of "MonitoringTagRules_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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this MonitoringTagRuleResource + MonitoringTagRuleCollection collection = elasticMonitorResource.GetMonitoringTagRules(); + + // invoke the operation + string ruleSetName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(ruleSetName); + MonitoringTagRuleResource 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 + MonitoringTagRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoringTagRuleResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoringTagRuleResource.cs new file mode 100644 index 000000000000..c06142b4f434 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_MonitoringTagRuleResource.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Elastic.Samples +{ + public partial class Sample_MonitoringTagRuleResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_TagRulesGet() + { + // Generated from example definition: 2025-01-15-preview/TagRules_Get.json + // this example is just showing the usage of "MonitoringTagRules_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 MonitoringTagRuleResource created on azure + // for more information of creating MonitoringTagRuleResource, please refer to the document of MonitoringTagRuleResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + string ruleSetName = "default"; + ResourceIdentifier monitoringTagRuleResourceId = MonitoringTagRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName, ruleSetName); + MonitoringTagRuleResource monitoringTagRule = client.GetMonitoringTagRuleResource(monitoringTagRuleResourceId); + + // invoke the operation + MonitoringTagRuleResource result = await monitoringTagRule.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 + MonitoringTagRuleData 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_TagRulesDelete() + { + // Generated from example definition: 2025-01-15-preview/TagRules_Delete.json + // this example is just showing the usage of "MonitoringTagRules_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 MonitoringTagRuleResource created on azure + // for more information of creating MonitoringTagRuleResource, please refer to the document of MonitoringTagRuleResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + string ruleSetName = "default"; + ResourceIdentifier monitoringTagRuleResourceId = MonitoringTagRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName, ruleSetName); + MonitoringTagRuleResource monitoringTagRule = client.GetMonitoringTagRuleResource(monitoringTagRuleResourceId); + + // invoke the operation + await monitoringTagRule.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_TagRulesCreateOrUpdate() + { + // Generated from example definition: 2025-01-15-preview/TagRules_CreateOrUpdate.json + // this example is just showing the usage of "MonitoringTagRules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MonitoringTagRuleResource created on azure + // for more information of creating MonitoringTagRuleResource, please refer to the document of MonitoringTagRuleResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + string ruleSetName = "default"; + ResourceIdentifier monitoringTagRuleResourceId = MonitoringTagRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName, ruleSetName); + MonitoringTagRuleResource monitoringTagRule = client.GetMonitoringTagRuleResource(monitoringTagRuleResourceId); + + // invoke the operation + MonitoringTagRuleData data = new MonitoringTagRuleData(); + ArmOperation lro = await monitoringTagRule.UpdateAsync(WaitUntil.Completed, data); + MonitoringTagRuleResource 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 + MonitoringTagRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_OpenAIIntegrationRPModelCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_OpenAIIntegrationRPModelCollection.cs new file mode 100644 index 000000000000..f0530924ff9b --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_OpenAIIntegrationRPModelCollection.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.Elastic.Samples +{ + public partial class Sample_OpenAIIntegrationRPModelCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_OpenAICreateOrUpdate() + { + // Generated from example definition: 2025-01-15-preview/OpenAI_CreateOrUpdate.json + // this example is just showing the usage of "OpenAIIntegrationRPModel_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this OpenAIIntegrationRPModelResource + OpenAIIntegrationRPModelCollection collection = elasticMonitorResource.GetOpenAIIntegrationRPModels(); + + // invoke the operation + string integrationName = "default"; + OpenAIIntegrationRPModelData data = new OpenAIIntegrationRPModelData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, integrationName, data); + OpenAIIntegrationRPModelResource 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 + OpenAIIntegrationRPModelData 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_OpenAIGet() + { + // Generated from example definition: 2025-01-15-preview/OpenAI_Get.json + // this example is just showing the usage of "OpenAIIntegrationRPModel_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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this OpenAIIntegrationRPModelResource + OpenAIIntegrationRPModelCollection collection = elasticMonitorResource.GetOpenAIIntegrationRPModels(); + + // invoke the operation + string integrationName = "default"; + OpenAIIntegrationRPModelResource result = await collection.GetAsync(integrationName); + + // 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 + OpenAIIntegrationRPModelData 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_OpenAIList() + { + // Generated from example definition: 2025-01-15-preview/OpenAI_List.json + // this example is just showing the usage of "OpenAIIntegrationRPModel_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this OpenAIIntegrationRPModelResource + OpenAIIntegrationRPModelCollection collection = elasticMonitorResource.GetOpenAIIntegrationRPModels(); + + // invoke the operation and iterate over the result + await foreach (OpenAIIntegrationRPModelResource 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 + OpenAIIntegrationRPModelData 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_OpenAIGet() + { + // Generated from example definition: 2025-01-15-preview/OpenAI_Get.json + // this example is just showing the usage of "OpenAIIntegrationRPModel_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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this OpenAIIntegrationRPModelResource + OpenAIIntegrationRPModelCollection collection = elasticMonitorResource.GetOpenAIIntegrationRPModels(); + + // invoke the operation + string integrationName = "default"; + bool result = await collection.ExistsAsync(integrationName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_OpenAIGet() + { + // Generated from example definition: 2025-01-15-preview/OpenAI_Get.json + // this example is just showing the usage of "OpenAIIntegrationRPModel_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 ElasticMonitorResource created on azure + // for more information of creating ElasticMonitorResource, please refer to the document of ElasticMonitorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + ResourceIdentifier elasticMonitorResourceId = ElasticMonitorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName); + ElasticMonitorResource elasticMonitorResource = client.GetElasticMonitorResource(elasticMonitorResourceId); + + // get the collection of this OpenAIIntegrationRPModelResource + OpenAIIntegrationRPModelCollection collection = elasticMonitorResource.GetOpenAIIntegrationRPModels(); + + // invoke the operation + string integrationName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(integrationName); + OpenAIIntegrationRPModelResource 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 + OpenAIIntegrationRPModelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_OpenAIIntegrationRPModelResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_OpenAIIntegrationRPModelResource.cs new file mode 100644 index 000000000000..ea82a6a340e0 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_OpenAIIntegrationRPModelResource.cs @@ -0,0 +1,137 @@ +// 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.Elastic.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Elastic.Samples +{ + public partial class Sample_OpenAIIntegrationRPModelResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_OpenAIGet() + { + // Generated from example definition: 2025-01-15-preview/OpenAI_Get.json + // this example is just showing the usage of "OpenAIIntegrationRPModel_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 OpenAIIntegrationRPModelResource created on azure + // for more information of creating OpenAIIntegrationRPModelResource, please refer to the document of OpenAIIntegrationRPModelResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + string integrationName = "default"; + ResourceIdentifier openAIIntegrationRPModelResourceId = OpenAIIntegrationRPModelResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName, integrationName); + OpenAIIntegrationRPModelResource openAIIntegrationRPModel = client.GetOpenAIIntegrationRPModelResource(openAIIntegrationRPModelResourceId); + + // invoke the operation + OpenAIIntegrationRPModelResource result = await openAIIntegrationRPModel.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 + OpenAIIntegrationRPModelData 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_OpenAIDelete() + { + // Generated from example definition: 2025-01-15-preview/OpenAI_Delete.json + // this example is just showing the usage of "OpenAIIntegrationRPModel_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 OpenAIIntegrationRPModelResource created on azure + // for more information of creating OpenAIIntegrationRPModelResource, please refer to the document of OpenAIIntegrationRPModelResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + string integrationName = "default"; + ResourceIdentifier openAIIntegrationRPModelResourceId = OpenAIIntegrationRPModelResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName, integrationName); + OpenAIIntegrationRPModelResource openAIIntegrationRPModel = client.GetOpenAIIntegrationRPModelResource(openAIIntegrationRPModelResourceId); + + // invoke the operation + await openAIIntegrationRPModel.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_OpenAICreateOrUpdate() + { + // Generated from example definition: 2025-01-15-preview/OpenAI_CreateOrUpdate.json + // this example is just showing the usage of "OpenAIIntegrationRPModel_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this OpenAIIntegrationRPModelResource created on azure + // for more information of creating OpenAIIntegrationRPModelResource, please refer to the document of OpenAIIntegrationRPModelResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + string integrationName = "default"; + ResourceIdentifier openAIIntegrationRPModelResourceId = OpenAIIntegrationRPModelResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName, integrationName); + OpenAIIntegrationRPModelResource openAIIntegrationRPModel = client.GetOpenAIIntegrationRPModelResource(openAIIntegrationRPModelResourceId); + + // invoke the operation + OpenAIIntegrationRPModelData data = new OpenAIIntegrationRPModelData(); + ArmOperation lro = await openAIIntegrationRPModel.UpdateAsync(WaitUntil.Completed, data); + OpenAIIntegrationRPModelResource 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 + OpenAIIntegrationRPModelData 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 GetStatus_OpenAIGetStatus() + { + // Generated from example definition: 2025-01-15-preview/OpenAI_GetStatus.json + // this example is just showing the usage of "OpenAIIntegrationRPModels_GetStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK 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 OpenAIIntegrationRPModelResource created on azure + // for more information of creating OpenAIIntegrationRPModelResource, please refer to the document of OpenAIIntegrationRPModelResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string monitorName = "myMonitor"; + string integrationName = "default"; + ResourceIdentifier openAIIntegrationRPModelResourceId = OpenAIIntegrationRPModelResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, monitorName, integrationName); + OpenAIIntegrationRPModelResource openAIIntegrationRPModel = client.GetOpenAIIntegrationRPModelResource(openAIIntegrationRPModelResourceId); + + // invoke the operation + OpenAIIntegrationStatusResponse result = await openAIIntegrationRPModel.GetStatusAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index a43ad3b6964f..9a76d8671631 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/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 GetElasticMonitors_MonitorsList() + public async Task GetElasticMonitorResources_MonitorsList() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_List.json - // this example is just showing the usage of "Monitors_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/Monitors_List.json + // this example is just showing the usage of "ElasticMonitorResource_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(); @@ -36,11 +36,11 @@ public async Task GetElasticMonitors_MonitorsList() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (ElasticMonitorResource item in subscriptionResource.GetElasticMonitorsAsync()) + await foreach (ElasticMonitorResource item in subscriptionResource.GetElasticMonitorResourcesAsync()) { // 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 - ElasticMonitorData resourceData = item.Data; + ElasticMonitorResourceData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -50,10 +50,10 @@ public async Task GetElasticMonitors_MonitorsList() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetElasticVersions_ElasticVersionsList() + public async Task GetElasticVersionsOperationGroups_ElasticVersionsList() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ElasticVersions_List.json - // this example is just showing the usage of "ElasticVersions_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/ElasticVersions_List.json + // this example is just showing the usage of "ElasticVersionsOperationGroup_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(); @@ -68,7 +68,7 @@ public async Task GetElasticVersions_ElasticVersionsList() // invoke the operation and iterate over the result string region = "myregion"; - await foreach (ElasticVersion item in subscriptionResource.GetElasticVersionsAsync(region)) + await foreach (ElasticVersionListFormat item in subscriptionResource.GetElasticVersionsOperationGroupsAsync(region)) { Console.WriteLine($"Succeeded: {item}"); } @@ -78,10 +78,10 @@ public async Task GetElasticVersions_ElasticVersionsList() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetApiKey_OrganizationsGetApiKey() + public async Task GetApiKeyOrganizationsOperationGroup_OrganizationsGetApiKey() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Organizations_GetApiKey.json - // this example is just showing the usage of "Organizations_GetApiKey" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/Organizations_GetApiKey.json + // this example is just showing the usage of "OrganizationsOperationGroup_GetApiKey" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -95,17 +95,18 @@ public async Task GetApiKey_OrganizationsGetApiKey() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - ElasticUserApiKeyResult result = await subscriptionResource.GetApiKeyAsync(); + UserEmailId body = new UserEmailId(); + UserApiKeyResponse result = await subscriptionResource.GetApiKeyOrganizationsOperationGroupAsync(body); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task GetElasticToAzureSubscriptionMapping_OrganizationsGetElasticToAzureSubscriptionMapping() + public async Task GetElasticToAzureSubscriptionMappingOrganizationsOperationGroup_OrganizationsGetElasticToAzureSubscriptionMapping() { - // Generated from example definition: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Organizations_GetElasticToAzureSubscriptionMapping.json - // this example is just showing the usage of "Organizations_GetElasticToAzureSubscriptionMapping" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2025-01-15-preview/Organizations_GetElasticToAzureSubscriptionMapping.json + // this example is just showing the usage of "OrganizationsOperationGroup_GetElasticToAzureSubscriptionMapping" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -119,7 +120,7 @@ public async Task GetElasticToAzureSubscriptionMapping_OrganizationsGetElasticTo SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - ElasticOrganizationToAzureSubscriptionMappingResult result = await subscriptionResource.GetElasticToAzureSubscriptionMappingAsync(); + ElasticOrganizationToAzureSubscriptionMappingResponse result = await subscriptionResource.GetElasticToAzureSubscriptionMappingOrganizationsOperationGroupAsync(); Console.WriteLine($"Succeeded: {result}"); } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_TenantResourceExtensions.cs new file mode 100644 index 000000000000..4841d58c3f2c --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/samples/Generated/Samples/Sample_TenantResourceExtensions.cs @@ -0,0 +1,43 @@ +// 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.Elastic.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Elastic.Samples +{ + public partial class Sample_TenantResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetOperations_OperationsList() + { + // Generated from example definition: 2025-01-15-preview/Operations_List.json + // this example is just showing the usage of "Operations_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation and iterate over the result + await foreach (OperationResult item in tenantResource.GetOperationsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ArmElasticModelFactory.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ArmElasticModelFactory.cs index fcd8ed3bedd6..342488fffccc 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ArmElasticModelFactory.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ArmElasticModelFactory.cs @@ -16,35 +16,59 @@ namespace Azure.ResourceManager.Elastic.Models /// Model factory for models. public static partial class ArmElasticModelFactory { - /// Initializes a new instance of . + /// Initializes a new instance of . + /// Operation name, i.e., {provider}/{resource}/{operation}. + /// Indicates whether the operation is a data action. + /// The object that represents the operation. + /// Origin of the operation. + /// A new instance for mocking. + public static OperationResult OperationResult(string name = null, bool? isDataAction = null, OperationDisplay display = null, string origin = null) + { + return new OperationResult(name, isDataAction, display, origin, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The service provider of the operation. + /// The resource type of the operation. + /// The name of the operation. + /// A description of the operation. + /// A new instance for mocking. + public static OperationDisplay OperationDisplay(string provider = null, string resource = null, string operation = null, string description = null) + { + return new OperationDisplay(provider, resource, operation, description, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. - /// SKU of the monitor resource. /// Properties of the monitor resource. + /// The kind of the Elastic resource - observability, security, search etc. + /// SKU of the monitor resource. /// Identity properties of the monitor resource. Current supported identity types: SystemAssigned. - /// A new instance for mocking. - public static ElasticMonitorData ElasticMonitorData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string skuName = null, ElasticMonitorProperties properties = null, ManagedServiceIdentity identity = null) + /// A new instance for mocking. + public static ElasticMonitorResourceData ElasticMonitorResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, MonitorProperties properties = null, string kind = null, string skuName = null, ManagedServiceIdentity identity = null) { tags ??= new Dictionary(); - return new ElasticMonitorData( + return new ElasticMonitorResourceData( id, name, resourceType, systemData, tags, location, - skuName != null ? new ElasticSku(skuName, serializedAdditionalRawData: null) : null, properties, + kind, + skuName != null ? new ResourceSku(skuName, serializedAdditionalRawData: null) : null, identity, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Provisioning state of the monitor resource. /// Flag specifying if the resource monitoring is enabled or disabled. /// Elastic cloud properties. @@ -57,11 +81,13 @@ public static ElasticMonitorData ElasticMonitorData(ResourceIdentifier id = null /// A unique identifier associated with the campaign. /// /// The priority of the resource. - /// Flag to determine if User API Key has to be generated and shared. - /// A new instance for mocking. - public static ElasticMonitorProperties ElasticMonitorProperties(ElasticProvisioningState? provisioningState = null, ElasticMonitoringStatus? monitoringStatus = null, ElasticCloudProperties elasticProperties = null, ElasticUserInfo userInfo = null, ElasticPlanDetails planDetails = null, string version = null, string subscriptionState = null, string saaSAzureSubscriptionStatus = null, string sourceCampaignName = null, string sourceCampaignId = null, ElasticLiftrResourceCategory? liftrResourceCategory = null, int? liftrResourcePreference = null, bool? isApiKeyGenerated = null) + /// Flag to determine if User API Key has to be generated and shared. + /// Hosting type of the monitor resource - either Hosted deployments OR Serverless Projects. + /// Project details of the monitor resource IF it belongs to Serverless offer kind. + /// A new instance for mocking. + public static MonitorProperties MonitorProperties(ProvisioningState? provisioningState = null, MonitoringStatus? monitoringStatus = null, ElasticProperties elasticProperties = null, UserInfo userInfo = null, PlanDetails planDetails = null, string version = null, string subscriptionState = null, string saaSAzureSubscriptionStatus = null, string sourceCampaignName = null, string sourceCampaignId = null, LiftrResourceCategory? liftrResourceCategory = null, int? liftrResourcePreference = null, bool? generateApiKey = null, HostingType? hostingType = null, ProjectDetails projectDetails = null) { - return new ElasticMonitorProperties( + return new MonitorProperties( provisioningState, monitoringStatus, elasticProperties, @@ -74,7 +100,9 @@ public static ElasticMonitorProperties ElasticMonitorProperties(ElasticProvision sourceCampaignId, liftrResourceCategory, liftrResourcePreference, - isApiKeyGenerated, + generateApiKey, + hostingType, + projectDetails, serializedAdditionalRawData: null); } @@ -83,7 +111,7 @@ public static ElasticMonitorProperties ElasticMonitorProperties(ElasticProvision /// User Id of the elastic account of the User. /// Elastic cloud default dashboard sso URL of the Elastic user account. /// A new instance for mocking. - public static ElasticCloudUser ElasticCloudUser(string emailAddress = null, string id = null, Uri elasticCloudSsoDefaultUri = null) + public static ElasticCloudUser ElasticCloudUser(string emailAddress = null, string id = null, string elasticCloudSsoDefaultUri = null) { return new ElasticCloudUser(emailAddress, id, elasticCloudSsoDefaultUri, serializedAdditionalRawData: null); } @@ -97,7 +125,7 @@ public static ElasticCloudUser ElasticCloudUser(string emailAddress = null, stri /// Kibana endpoint of the Elastic deployment. /// Kibana dashboard sso URL of the Elastic deployment. /// A new instance for mocking. - public static ElasticCloudDeployment ElasticCloudDeployment(string name = null, string deploymentId = null, string azureSubscriptionId = null, string elasticsearchRegion = null, Uri elasticsearchServiceUri = null, Uri kibanaServiceUri = null, Uri kibanaSsoUri = null) + public static ElasticCloudDeployment ElasticCloudDeployment(string name = null, string deploymentId = null, string azureSubscriptionId = null, string elasticsearchRegion = null, string elasticsearchServiceUri = null, string kibanaServiceUri = null, string kibanaSsoUri = null) { return new ElasticCloudDeployment( name, @@ -110,25 +138,17 @@ public static ElasticCloudDeployment ElasticCloudDeployment(string name = null, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Elastic Version Properties. - /// A new instance for mocking. - public static ElasticVersion ElasticVersion(string availableVersion = null) - { - return new ElasticVersion(availableVersion != null ? new ElasticVersionProperties(availableVersion, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + /// Initializes a new instance of . /// The ARM id of the resource. /// Flag indicating the status of the resource for sending logs operation to Elastic. /// Reason for why the resource is sending logs (or why it is not sending). - /// A new instance for mocking. - public static MonitoredResourceInfo MonitoredResourceInfo(ResourceIdentifier id = null, SendingLogsStatus? sendingLogs = null, string reasonForLogsStatus = null) + /// A new instance for mocking. + public static MonitoredResource MonitoredResource(string id = null, SendingLog? sendingLogs = null, string reasonForLogsStatus = null) { - return new MonitoredResourceInfo(id, sendingLogs, reasonForLogsStatus, serializedAdditionalRawData: null); + return new MonitoredResource(id, sendingLogs, reasonForLogsStatus, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The Elastic deployment status. /// Version of the elasticsearch in Elastic cloud deployment. /// RAM capacity of the elasticsearch in Elastic cloud deployment. @@ -136,10 +156,12 @@ public static MonitoredResourceInfo MonitoredResourceInfo(ResourceIdentifier id /// Elasticsearch endpoint in Elastic cloud deployment. This is either the aliased_endpoint if available, or the service_url otherwise. /// Deployment URL of the elasticsearch in Elastic cloud deployment. /// Marketplace SaaS Info of the resource. - /// A new instance for mocking. - public static ElasticDeploymentInfoResult ElasticDeploymentInfoResult(ElasticDeploymentStatus? status = null, string version = null, string memoryCapacity = null, string diskCapacity = null, string elasticsearchEndPoint = null, Uri deploymentUri = null, MarketplaceSaaSInfo marketplaceSaasInfo = null) + /// Project Type - Applicable for Serverless only. + /// ConfigurationType Type - Applicable for Serverless only. + /// A new instance for mocking. + public static DeploymentInfoResponse DeploymentInfoResponse(ElasticDeploymentStatus? status = null, string version = null, string memoryCapacity = null, string diskCapacity = null, string elasticsearchEndPoint = null, string deploymentUri = null, MarketplaceSaaSInfo marketplaceSaasInfo = null, string projectType = null, string configurationType = null) { - return new ElasticDeploymentInfoResult( + return new DeploymentInfoResponse( status, version, memoryCapacity, @@ -147,44 +169,56 @@ public static ElasticDeploymentInfoResult ElasticDeploymentInfoResult(ElasticDep elasticsearchEndPoint, deploymentUri, marketplaceSaasInfo, + projectType, + configurationType, serializedAdditionalRawData: null); } /// Initializes a new instance of . - /// Marketplace Subscription. + /// Marketplace Subscription. /// Marketplace Subscription Details: SAAS Name. /// Marketplace Subscription Details: Resource URI. /// Marketplace Subscription Details: SaaS Subscription Status. /// The Azure Subscription ID to which the Marketplace Subscription belongs and gets billed into. - /// Flag specifying if the Marketplace status is subscribed or not. + /// Flag specifying if the Marketplace status is subscribed or not. /// A new instance for mocking. - public static MarketplaceSaaSInfo MarketplaceSaaSInfo(ResourceIdentifier marketplaceSubscriptionId = null, string marketplaceName = null, string marketplaceResourceId = null, string marketplaceStatus = null, string billedAzureSubscriptionId = null, bool? isSubscribed = null) + public static MarketplaceSaaSInfo MarketplaceSaaSInfo(MarketplaceSaaSInfoMarketplaceSubscription marketplaceSubscription = null, string marketplaceName = null, string marketplaceResourceId = null, string marketplaceStatus = null, string billedAzureSubscriptionId = null, bool? subscribed = null) { return new MarketplaceSaaSInfo( - marketplaceSubscriptionId != null ? ResourceManagerModelFactory.SubResource(marketplaceSubscriptionId) : null, + marketplaceSubscription, marketplaceName, marketplaceResourceId, marketplaceStatus, billedAzureSubscriptionId, - isSubscribed, + subscribed, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Shows if user is created or updated. - /// A new instance for mocking. - public static ElasticExternalUserCreationResult ElasticExternalUserCreationResult(bool? isCreated = null) + /// Initializes a new instance of . + /// Marketplace Subscription Id. This is a GUID-formatted string. + /// Publisher Id of the Marketplace offer. + /// Offer Id of the Marketplace offer,. + /// A new instance for mocking. + public static MarketplaceSaaSInfoMarketplaceSubscription MarketplaceSaaSInfoMarketplaceSubscription(string id = null, string publisherId = null, string offerId = null) { - return new ElasticExternalUserCreationResult(isCreated, serializedAdditionalRawData: null); + return new MarketplaceSaaSInfoMarketplaceSubscription(id, publisherId, offerId, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// Shows if user is created or updated. + /// A new instance for mocking. + public static ExternalUserCreationResponse ExternalUserCreationResponse(bool? created = null) + { + return new ExternalUserCreationResponse(created, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// Marketplace Subscription details. /// Partner Billing Entity details: Organization Info. - /// A new instance for mocking. - public static ElasticBillingInfoResult ElasticBillingInfoResult(MarketplaceSaaSInfo marketplaceSaasInfo = null, PartnerBillingEntity partnerBillingEntity = null) + /// A new instance for mocking. + public static BillingInfoResponse BillingInfoResponse(MarketplaceSaaSInfo marketplaceSaasInfo = null, PartnerBillingEntity partnerBillingEntity = null) { - return new ElasticBillingInfoResult(marketplaceSaasInfo, partnerBillingEntity, serializedAdditionalRawData: null); + return new BillingInfoResponse(marketplaceSaasInfo, partnerBillingEntity, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -192,121 +226,73 @@ public static ElasticBillingInfoResult ElasticBillingInfoResult(MarketplaceSaaSI /// The Elastic Organization Name. /// Link to the elastic organization page. /// A new instance for mocking. - public static PartnerBillingEntity PartnerBillingEntity(string id = null, string name = null, Uri partnerEntityUri = null) + public static PartnerBillingEntity PartnerBillingEntity(string id = null, string name = null, string partnerEntityUri = null) { return new PartnerBillingEntity(id, name, partnerEntityUri, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Connected Partner Resource Properties. - /// A new instance for mocking. - public static ConnectedPartnerResourceInfo ConnectedPartnerResourceInfo(ConnectedPartnerResourceProperties properties = null) + /// A new instance for mocking. + public static ConnectedPartnerResourcesListFormat ConnectedPartnerResourcesListFormat(ConnectedPartnerResourceProperties properties = null) { - return new ConnectedPartnerResourceInfo(properties, serializedAdditionalRawData: null); + return new ConnectedPartnerResourcesListFormat(properties, serializedAdditionalRawData: null); } /// Initializes a new instance of . - /// Elastic deployment name. - /// Deployment URL of the elasticsearch in Elastic cloud deployment. - /// The azure resource Id of the deployment. - /// The location of the deployment. + /// Elastic resource name. + /// URL of the resource in Elastic cloud. + /// The azure resource Id of the resource. + /// The location of the resource. + /// The hosting type of the resource. /// A new instance for mocking. - public static ConnectedPartnerResourceProperties ConnectedPartnerResourceProperties(string partnerDeploymentName = null, Uri partnerDeploymentUri = null, ResourceIdentifier azureResourceId = null, AzureLocation? location = null) - { - return new ConnectedPartnerResourceProperties(partnerDeploymentName, partnerDeploymentUri, azureResourceId, location, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Open AI Integration details. - /// A new instance for mocking. - public static ElasticOpenAIIntegrationData ElasticOpenAIIntegrationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ElasticOpenAIIntegrationProperties properties = null) - { - return new ElasticOpenAIIntegrationData( - id, - name, - resourceType, - systemData, - properties, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The resource id of Open AI resource. - /// The API endpoint for Open AI resource. - /// Value of API key for Open AI resource. - /// Last Update Timestamp for key updation. - /// A new instance for mocking. - public static ElasticOpenAIIntegrationProperties ElasticOpenAIIntegrationProperties(ResourceIdentifier openAIResourceId = null, string openAIResourceEndpoint = null, string key = null, DateTimeOffset? lastRefreshOn = null) - { - return new ElasticOpenAIIntegrationProperties(openAIResourceId, openAIResourceEndpoint, key, lastRefreshOn, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Status of the OpenAI Integration. - /// A new instance for mocking. - public static ElasticOpenAIIntegrationStatusResult ElasticOpenAIIntegrationStatusResult(string elasticOpenAIIntegrationStatus = null) + public static ConnectedPartnerResourceProperties ConnectedPartnerResourceProperties(string partnerDeploymentName = null, string partnerDeploymentUri = null, string azureResourceId = null, string location = null, string type = null) { - return new ElasticOpenAIIntegrationStatusResult(elasticOpenAIIntegrationStatus != null ? new ElasticOpenAIIntegrationStatusProperties(elasticOpenAIIntegrationStatus, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Properties of the monitoring tag rules. - /// A new instance for mocking. - public static ElasticTagRuleData ElasticTagRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ElasticTagRuleProperties properties = null) - { - return new ElasticTagRuleData( - id, - name, - resourceType, - systemData, - properties, + return new ConnectedPartnerResourceProperties( + partnerDeploymentName, + partnerDeploymentUri, + azureResourceId, + location, + type, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The ARM id of the VM resource. - /// A new instance for mocking. - public static ElasticVmResourceInfo ElasticVmResourceInfo(ResourceIdentifier vmResourceId = null) + /// A new instance for mocking. + public static VmResources VmResources(string vmResourceId = null) { - return new ElasticVmResourceInfo(vmResourceId, serializedAdditionalRawData: null); + return new VmResources(vmResourceId, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The cloudId of given Elastic monitor resource. /// Ingestion details to install agent on given VM. - /// A new instance for mocking. - public static VmIngestionDetailsResult VmIngestionDetailsResult(string cloudId = null, string ingestionKey = null) + /// A new instance for mocking. + public static VmIngestionDetailsResponse VmIngestionDetailsResponse(string cloudId = null, string ingestionKey = null) { - return new VmIngestionDetailsResult(cloudId, ingestionKey, serializedAdditionalRawData: null); + return new VmIngestionDetailsResponse(cloudId, ingestionKey, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Current version of the elastic monitor. /// Stack Versions that this version can upgrade to. - /// A new instance for mocking. - public static UpgradableVersionListResult UpgradableVersionListResult(string currentVersion = null, IEnumerable upgradableVersions = null) + /// A new instance for mocking. + public static UpgradableVersionsList UpgradableVersionsList(string currentVersion = null, IEnumerable upgradableVersions = null) { upgradableVersions ??= new List(); - return new UpgradableVersionListResult(currentVersion, upgradableVersions?.ToList(), serializedAdditionalRawData: null); + return new UpgradableVersionsList(currentVersion, upgradableVersions?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// List of elastic traffic filters in the account. - /// A new instance for mocking. - public static ElasticTrafficFilterListResult ElasticTrafficFilterListResult(IEnumerable rulesets = null) + /// A new instance for mocking. + public static ElasticTrafficFilterResponse ElasticTrafficFilterResponse(IEnumerable rulesets = null) { rulesets ??= new List(); - return new ElasticTrafficFilterListResult(rulesets?.ToList(), serializedAdditionalRawData: null); + return new ElasticTrafficFilterResponse(rulesets?.ToList(), serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -314,11 +300,11 @@ public static ElasticTrafficFilterListResult ElasticTrafficFilterListResult(IEnu /// Name of the elastic filter. /// Description of the elastic filter. /// Region of the elastic filter. - /// Type of the elastic filter. - /// IncludeByDefault for the elastic filter. + /// Type of the elastic filter. + /// IncludeByDefault for the elastic filter. /// Rules in the elastic filter. /// A new instance for mocking. - public static ElasticTrafficFilter ElasticTrafficFilter(string id = null, string name = null, string description = null, string region = null, ElasticFilterType? filterType = null, bool? doesIncludeByDefault = null, IEnumerable rules = null) + public static ElasticTrafficFilter ElasticTrafficFilter(string id = null, string name = null, string description = null, string region = null, Type? type = null, bool? includeByDefault = null, IEnumerable rules = null) { rules ??= new List(); @@ -327,8 +313,8 @@ public static ElasticTrafficFilter ElasticTrafficFilter(string id = null, string name, description, region, - filterType, - doesIncludeByDefault, + type, + includeByDefault, rules?.ToList(), serializedAdditionalRawData: null); } @@ -351,31 +337,148 @@ public static ElasticTrafficFilterRule ElasticTrafficFilterRule(string source = serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// - /// A new instance for mocking. - public static ElasticUserApiKeyResult ElasticUserApiKeyResult(string elasticUserApiKey = null) + /// Initializes a new instance of . + /// The body type of the operation request or response. + /// A new instance for mocking. + public static ArmResponseElasticMonitorResource ArmResponseElasticMonitorResource(ElasticMonitorResourceData body = null) + { + return new ArmResponseElasticMonitorResource(body, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The request to update subscriptions needed to be monitored by the Elastic monitor resource. + /// A new instance for mocking. + public static MonitoredSubscriptionPropertyData MonitoredSubscriptionPropertyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SubscriptionList properties = null) + { + return new MonitoredSubscriptionPropertyData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The operation for the patch on the resource. + /// List of subscriptions and the state of the monitoring. + /// Provisioning State of the resource. + /// A new instance for mocking. + public static SubscriptionList SubscriptionList(Operation? operation = null, IEnumerable monitoredSubscriptionList = null, ProvisioningState? provisioningState = null) + { + monitoredSubscriptionList ??= new List(); + + return new SubscriptionList(operation, monitoredSubscriptionList?.ToList(), provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Provisioning state of the monitoring tag rules. + /// Rules for sending logs. + /// A new instance for mocking. + public static MonitoringTagRulesProperties MonitoringTagRulesProperties(ProvisioningState? provisioningState = null, LogRules logRules = null) + { + return new MonitoringTagRulesProperties(provisioningState, logRules, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Open AI Integration details. + /// A new instance for mocking. + public static OpenAIIntegrationRPModelData OpenAIIntegrationRPModelData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, OpenAIIntegrationProperties properties = null) + { + return new OpenAIIntegrationRPModelData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The resource name of Open AI resource. + /// The API endpoint for Open AI resource. + /// The connector id of Open AI resource. + /// Value of API key for Open AI resource. + /// Last Update Timestamp for key updation. + /// A new instance for mocking. + public static OpenAIIntegrationProperties OpenAIIntegrationProperties(string openAIResourceId = null, string openAIResourceEndpoint = null, string openAIConnectorId = null, string key = null, DateTimeOffset? lastRefreshOn = null) + { + return new OpenAIIntegrationProperties( + openAIResourceId, + openAIResourceEndpoint, + openAIConnectorId, + key, + lastRefreshOn, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Status of the OpenAI Integration. + /// A new instance for mocking. + public static OpenAIIntegrationStatusResponse OpenAIIntegrationStatusResponse(string status = null) + { + return new OpenAIIntegrationStatusResponse(status != null ? new OpenAIIntegrationStatusResponseProperties(status, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Properties of the monitoring tag rules. + /// A new instance for mocking. + public static MonitoringTagRuleData MonitoringTagRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, MonitoringTagRulesProperties properties = null) + { + return new MonitoringTagRuleData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Elastic Version Properties. + /// A new instance for mocking. + public static ElasticVersionListFormat ElasticVersionListFormat(string version = null) + { + return new ElasticVersionListFormat(version != null ? new ElasticVersionListProperties(version, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// A new instance for mocking. + public static UserApiKeyResponse UserApiKeyResponse(string apiKey = null) { - return new ElasticUserApiKeyResult(elasticUserApiKey != null ? new ElasticUserApiKeyProperties(elasticUserApiKey, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); + return new UserApiKeyResponse(apiKey != null ? new UserApiKeyResponseProperties(apiKey, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The properties of Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into. - /// A new instance for mocking. - public static ElasticOrganizationToAzureSubscriptionMappingResult ElasticOrganizationToAzureSubscriptionMappingResult(ElasticOrganizationToAzureSubscriptionMappingProperties properties = null) + /// A new instance for mocking. + public static ElasticOrganizationToAzureSubscriptionMappingResponse ElasticOrganizationToAzureSubscriptionMappingResponse(ElasticOrganizationToAzureSubscriptionMappingResponseProperties properties = null) { - return new ElasticOrganizationToAzureSubscriptionMappingResult(properties, serializedAdditionalRawData: null); + return new ElasticOrganizationToAzureSubscriptionMappingResponse(properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The Azure Subscription ID to which the Organization belongs and gets billed into. This is empty for a new user OR a user without an Elastic Organization. /// Marketplace SaaS Info of the resource. /// The Elastic Organization Id. /// The Elastic Organization Name. - /// A new instance for mocking. - public static ElasticOrganizationToAzureSubscriptionMappingProperties ElasticOrganizationToAzureSubscriptionMappingProperties(string billedAzureSubscriptionId = null, MarketplaceSaaSInfo marketplaceSaasInfo = null, string elasticOrganizationId = null, string elasticOrganizationName = null) + /// A new instance for mocking. + public static ElasticOrganizationToAzureSubscriptionMappingResponseProperties ElasticOrganizationToAzureSubscriptionMappingResponseProperties(string billedAzureSubscriptionId = null, MarketplaceSaaSInfo marketplaceSaasInfo = null, string elasticOrganizationId = null, string elasticOrganizationName = null) { - return new ElasticOrganizationToAzureSubscriptionMappingProperties(billedAzureSubscriptionId, marketplaceSaasInfo, elasticOrganizationId, elasticOrganizationName, serializedAdditionalRawData: null); + return new ElasticOrganizationToAzureSubscriptionMappingResponseProperties(billedAzureSubscriptionId, marketplaceSaasInfo, elasticOrganizationId, elasticOrganizationName, serializedAdditionalRawData: null); } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.Serialization.cs index 89120a246f4b..56803ab48766 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.Serialization.cs @@ -11,16 +11,16 @@ namespace Azure.ResourceManager.Elastic { - public partial class ElasticMonitorResource : IJsonModel + public partial class ElasticMonitorResource : IJsonModel { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - ElasticMonitorData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + ElasticMonitorResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticContext.Default); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticContext.Default); - ElasticMonitorData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticContext.Default); + ElasticMonitorResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs index d84073e5bf42..a5bf010183af 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs @@ -19,10 +19,10 @@ namespace Azure.ResourceManager.Elastic { /// - /// A Class representing an ElasticMonitor along with the instance operations that can be performed on it. + /// A Class representing an ElasticMonitorResource 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 GetElasticMonitorResource method. - /// Otherwise you can get one from its parent resource using the GetElasticMonitor method. + /// Otherwise you can get one from its parent resource using the GetElasticMonitorResource method. /// public partial class ElasticMonitorResource : ArmResource { @@ -36,45 +36,9 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _elasticMonitorMonitorsClientDiagnostics; - private readonly MonitorsRestOperations _elasticMonitorMonitorsRestClient; - private readonly ClientDiagnostics _monitoredResourcesClientDiagnostics; - private readonly MonitoredResourcesRestOperations _monitoredResourcesRestClient; - private readonly ClientDiagnostics _deploymentInfoClientDiagnostics; - private readonly DeploymentInfoRestOperations _deploymentInfoRestClient; - private readonly ClientDiagnostics _externalUserClientDiagnostics; - private readonly ExternalUserRestOperations _externalUserRestClient; - private readonly ClientDiagnostics _billingInfoClientDiagnostics; - private readonly BillingInfoRestOperations _billingInfoRestClient; - private readonly ClientDiagnostics _connectedPartnerResourcesClientDiagnostics; - private readonly ConnectedPartnerResourcesRestOperations _connectedPartnerResourcesRestClient; - private readonly ClientDiagnostics _vmHostClientDiagnostics; - private readonly VMHostRestOperations _vmHostRestClient; - private readonly ClientDiagnostics _vmIngestionClientDiagnostics; - private readonly VMIngestionRestOperations _vmIngestionRestClient; - private readonly ClientDiagnostics _vmCollectionClientDiagnostics; - private readonly VMCollectionRestOperations _vmCollectionRestClient; - private readonly ClientDiagnostics _upgradableVersionsClientDiagnostics; - private readonly UpgradableVersionsRestOperations _upgradableVersionsRestClient; - private readonly ClientDiagnostics _monitorClientDiagnostics; - private readonly MonitorRestOperations _monitorRestClient; - private readonly ClientDiagnostics _allTrafficFiltersClientDiagnostics; - private readonly AllTrafficFiltersRestOperations _allTrafficFiltersRestClient; - private readonly ClientDiagnostics _listAssociatedTrafficFiltersClientDiagnostics; - private readonly ListAssociatedTrafficFiltersRestOperations _listAssociatedTrafficFiltersRestClient; - private readonly ClientDiagnostics _createAndAssociateIPFilterClientDiagnostics; - private readonly CreateAndAssociateIPFilterRestOperations _createAndAssociateIPFilterRestClient; - private readonly ClientDiagnostics _createAndAssociatePLFilterClientDiagnostics; - private readonly CreateAndAssociatePLFilterRestOperations _createAndAssociatePLFilterRestClient; - private readonly ClientDiagnostics _associateTrafficFilterClientDiagnostics; - private readonly AssociateTrafficFilterRestOperations _associateTrafficFilterRestClient; - private readonly ClientDiagnostics _detachAndDeleteTrafficFilterClientDiagnostics; - private readonly DetachAndDeleteTrafficFilterRestOperations _detachAndDeleteTrafficFilterRestClient; - private readonly ClientDiagnostics _detachTrafficFilterClientDiagnostics; - private readonly DetachTrafficFilterRestOperations _detachTrafficFilterRestClient; - private readonly ClientDiagnostics _trafficFiltersClientDiagnostics; - private readonly TrafficFiltersRestOperations _trafficFiltersRestClient; - private readonly ElasticMonitorData _data; + private readonly ClientDiagnostics _elasticMonitorResourceClientDiagnostics; + private readonly ElasticMonitorResourcesRestOperations _elasticMonitorResourceRestClient; + private readonly ElasticMonitorResourceData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Elastic/monitors"; @@ -87,7 +51,7 @@ protected ElasticMonitorResource() /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ElasticMonitorResource(ArmClient client, ElasticMonitorData data) : this(client, data.Id) + internal ElasticMonitorResource(ArmClient client, ElasticMonitorResourceData data) : this(client, data.Id) { HasData = true; _data = data; @@ -98,45 +62,9 @@ internal ElasticMonitorResource(ArmClient client, ElasticMonitorData data) : thi /// The identifier of the resource that is the target of operations. internal ElasticMonitorResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticMonitorMonitorsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string elasticMonitorMonitorsApiVersion); - _elasticMonitorMonitorsRestClient = new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticMonitorMonitorsApiVersion); - _monitoredResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _monitoredResourcesRestClient = new MonitoredResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _deploymentInfoClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _deploymentInfoRestClient = new DeploymentInfoRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _externalUserClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _externalUserRestClient = new ExternalUserRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _billingInfoClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _billingInfoRestClient = new BillingInfoRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _connectedPartnerResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _connectedPartnerResourcesRestClient = new ConnectedPartnerResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _vmHostClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _vmHostRestClient = new VMHostRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _vmIngestionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _vmIngestionRestClient = new VMIngestionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _vmCollectionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _vmCollectionRestClient = new VMCollectionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _upgradableVersionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _upgradableVersionsRestClient = new UpgradableVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _monitorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _monitorRestClient = new MonitorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _allTrafficFiltersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _allTrafficFiltersRestClient = new AllTrafficFiltersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _listAssociatedTrafficFiltersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _listAssociatedTrafficFiltersRestClient = new ListAssociatedTrafficFiltersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _createAndAssociateIPFilterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _createAndAssociateIPFilterRestClient = new CreateAndAssociateIPFilterRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _createAndAssociatePLFilterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _createAndAssociatePLFilterRestClient = new CreateAndAssociatePLFilterRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _associateTrafficFilterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _associateTrafficFilterRestClient = new AssociateTrafficFilterRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _detachAndDeleteTrafficFilterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _detachAndDeleteTrafficFilterRestClient = new DetachAndDeleteTrafficFilterRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _detachTrafficFilterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _detachTrafficFilterRestClient = new DetachTrafficFilterRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _trafficFiltersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _trafficFiltersRestClient = new TrafficFiltersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _elasticMonitorResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string elasticMonitorResourceApiVersion); + _elasticMonitorResourceRestClient = new ElasticMonitorResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticMonitorResourceApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -147,7 +75,7 @@ internal ElasticMonitorResource(ArmClient client, ResourceIdentifier id) : base( /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual ElasticMonitorData Data + public virtual ElasticMonitorResourceData Data { get { @@ -163,11 +91,80 @@ 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 ElasticOpenAIIntegrationResources in the ElasticMonitor. - /// An object representing collection of ElasticOpenAIIntegrationResources and their operations over a ElasticOpenAIIntegrationResource. - public virtual ElasticOpenAIIntegrationCollection GetElasticOpenAIIntegrations() + /// Gets a collection of MonitoredSubscriptionPropertyResources in the ElasticMonitorResource. + /// An object representing collection of MonitoredSubscriptionPropertyResources and their operations over a MonitoredSubscriptionPropertyResource. + public virtual MonitoredSubscriptionPropertyCollection GetMonitoredSubscriptionProperties() { - return GetCachedClient(client => new ElasticOpenAIIntegrationCollection(client, Id)); + return GetCachedClient(client => new MonitoredSubscriptionPropertyCollection(client, Id)); + } + + /// + /// List all the subscriptions currently being monitored by the Elastic monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Get + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The configuration name. Only 'default' value is supported. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMonitoredSubscriptionPropertyAsync(string configurationName, CancellationToken cancellationToken = default) + { + return await GetMonitoredSubscriptionProperties().GetAsync(configurationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// List all the subscriptions currently being monitored by the Elastic monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Get + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The configuration name. Only 'default' value is supported. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMonitoredSubscriptionProperty(string configurationName, CancellationToken cancellationToken = default) + { + return GetMonitoredSubscriptionProperties().Get(configurationName, cancellationToken); + } + + /// Gets a collection of OpenAIIntegrationRPModelResources in the ElasticMonitorResource. + /// An object representing collection of OpenAIIntegrationRPModelResources and their operations over a OpenAIIntegrationRPModelResource. + public virtual OpenAIIntegrationRPModelCollection GetOpenAIIntegrationRPModels() + { + return GetCachedClient(client => new OpenAIIntegrationRPModelCollection(client, Id)); } /// @@ -179,15 +176,15 @@ public virtual ElasticOpenAIIntegrationCollection GetElasticOpenAIIntegrations() /// /// /// Operation Id - /// OpenAI_Get + /// OpenAIIntegrationRPModel_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -196,9 +193,9 @@ public virtual ElasticOpenAIIntegrationCollection GetElasticOpenAIIntegrations() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetElasticOpenAIIntegrationAsync(string integrationName, CancellationToken cancellationToken = default) + public virtual async Task> GetOpenAIIntegrationRPModelAsync(string integrationName, CancellationToken cancellationToken = default) { - return await GetElasticOpenAIIntegrations().GetAsync(integrationName, cancellationToken).ConfigureAwait(false); + return await GetOpenAIIntegrationRPModels().GetAsync(integrationName, cancellationToken).ConfigureAwait(false); } /// @@ -210,15 +207,15 @@ public virtual async Task> GetElastic /// /// /// Operation Id - /// OpenAI_Get + /// OpenAIIntegrationRPModel_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -227,16 +224,16 @@ public virtual async Task> GetElastic /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetElasticOpenAIIntegration(string integrationName, CancellationToken cancellationToken = default) + public virtual Response GetOpenAIIntegrationRPModel(string integrationName, CancellationToken cancellationToken = default) { - return GetElasticOpenAIIntegrations().Get(integrationName, cancellationToken); + return GetOpenAIIntegrationRPModels().Get(integrationName, cancellationToken); } - /// Gets a collection of ElasticTagRuleResources in the ElasticMonitor. - /// An object representing collection of ElasticTagRuleResources and their operations over a ElasticTagRuleResource. - public virtual ElasticTagRuleCollection GetElasticTagRules() + /// Gets a collection of MonitoringTagRuleResources in the ElasticMonitorResource. + /// An object representing collection of MonitoringTagRuleResources and their operations over a MonitoringTagRuleResource. + public virtual MonitoringTagRuleCollection GetMonitoringTagRules() { - return GetCachedClient(client => new ElasticTagRuleCollection(client, Id)); + return GetCachedClient(client => new MonitoringTagRuleCollection(client, Id)); } /// @@ -248,15 +245,15 @@ public virtual ElasticTagRuleCollection GetElasticTagRules() /// /// /// Operation Id - /// TagRules_Get + /// MonitoringTagRules_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -265,9 +262,9 @@ public virtual ElasticTagRuleCollection GetElasticTagRules() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetElasticTagRuleAsync(string ruleSetName, CancellationToken cancellationToken = default) + public virtual async Task> GetMonitoringTagRuleAsync(string ruleSetName, CancellationToken cancellationToken = default) { - return await GetElasticTagRules().GetAsync(ruleSetName, cancellationToken).ConfigureAwait(false); + return await GetMonitoringTagRules().GetAsync(ruleSetName, cancellationToken).ConfigureAwait(false); } /// @@ -279,15 +276,15 @@ public virtual async Task> GetElasticTagRuleAsy /// /// /// Operation Id - /// TagRules_Get + /// MonitoringTagRules_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -296,9 +293,9 @@ public virtual async Task> GetElasticTagRuleAsy /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetElasticTagRule(string ruleSetName, CancellationToken cancellationToken = default) + public virtual Response GetMonitoringTagRule(string ruleSetName, CancellationToken cancellationToken = default) { - return GetElasticTagRules().Get(ruleSetName, cancellationToken); + return GetMonitoringTagRules().Get(ruleSetName, cancellationToken); } /// @@ -310,11 +307,11 @@ public virtual Response GetElasticTagRule(string ruleSet /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -325,11 +322,11 @@ public virtual Response GetElasticTagRule(string ruleSet /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.Get"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Get"); scope.Start(); try { - var response = await _elasticMonitorMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new ElasticMonitorResource(Client, response.Value), response.GetRawResponse()); @@ -350,11 +347,11 @@ public virtual async Task> GetAsync(Cancellatio /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -365,11 +362,11 @@ public virtual async Task> GetAsync(Cancellatio /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.Get"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Get"); scope.Start(); try { - var response = _elasticMonitorMonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _elasticMonitorResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new ElasticMonitorResource(Client, response.Value), response.GetRawResponse()); @@ -390,11 +387,11 @@ public virtual Response Get(CancellationToken cancellati /// /// /// Operation Id - /// Monitors_Delete + /// ElasticMonitorResource_Delete /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -406,12 +403,12 @@ public virtual Response Get(CancellationToken cancellati /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.Delete"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Delete"); scope.Start(); try { - var response = await _elasticMonitorMonitorsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ElasticArmOperation(_elasticMonitorMonitorsClientDiagnostics, Pipeline, _elasticMonitorMonitorsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _elasticMonitorResourceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(_elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -432,11 +429,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// Monitors_Delete + /// ElasticMonitorResource_Delete /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -448,12 +445,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 = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.Delete"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Delete"); scope.Start(); try { - var response = _elasticMonitorMonitorsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new ElasticArmOperation(_elasticMonitorMonitorsClientDiagnostics, Pipeline, _elasticMonitorMonitorsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _elasticMonitorResourceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new ElasticArmOperation(_elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -474,11 +471,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Monitors_Update + /// ElasticMonitorResource_Update /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -486,19 +483,23 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Elastic resource model update parameters. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(ElasticMonitorPatch patch, CancellationToken cancellationToken = default) + public virtual async Task UpdateAsync(WaitUntil waitUntil, ElasticMonitorResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.Update"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Update"); scope.Start(); try { - var response = await _elasticMonitorMonitorsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ElasticMonitorResource(Client, response.Value), response.GetRawResponse()); + var response = await _elasticMonitorResourceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(_elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; } catch (Exception e) { @@ -516,11 +517,11 @@ public virtual async Task> UpdateAsync(ElasticM /// /// /// Operation Id - /// Monitors_Update + /// ElasticMonitorResource_Update /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -528,19 +529,23 @@ public virtual async Task> UpdateAsync(ElasticM /// /// /// + /// 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. /// Elastic resource model update parameters. /// The cancellation token to use. /// is null. - public virtual Response Update(ElasticMonitorPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticMonitorResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.Update"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Update"); scope.Start(); try { - var response = _elasticMonitorMonitorsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - return Response.FromValue(new ElasticMonitorResource(Client, response.Value), response.GetRawResponse()); + var response = _elasticMonitorResourceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new ElasticArmOperation(_elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; } catch (Exception e) { @@ -558,21 +563,25 @@ public virtual Response Update(ElasticMonitorPatch patch /// /// /// Operation Id - /// MonitoredResources_List + /// ElasticMonitorResources_MonitoredResourcesList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMonitoredResourcesAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable MonitoredResourcesListAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _monitoredResourcesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _monitoredResourcesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => MonitoredResourceInfo.DeserializeMonitoredResourceInfo(e), _monitoredResourcesClientDiagnostics, Pipeline, "ElasticMonitorResource.GetMonitoredResources", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticMonitorResourceRestClient.CreateMonitoredResourcesListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticMonitorResourceRestClient.CreateMonitoredResourcesListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => MonitoredResource.DeserializeMonitoredResource(e), _elasticMonitorResourceClientDiagnostics, Pipeline, "ElasticMonitorResource.MonitoredResourcesList", "value", "nextLink", cancellationToken); } /// @@ -584,21 +593,25 @@ public virtual AsyncPageable GetMonitoredResourcesAsync(C /// /// /// Operation Id - /// MonitoredResources_List + /// ElasticMonitorResources_MonitoredResourcesList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMonitoredResources(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable MonitoredResourcesList(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _monitoredResourcesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _monitoredResourcesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => MonitoredResourceInfo.DeserializeMonitoredResourceInfo(e), _monitoredResourcesClientDiagnostics, Pipeline, "ElasticMonitorResource.GetMonitoredResources", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticMonitorResourceRestClient.CreateMonitoredResourcesListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticMonitorResourceRestClient.CreateMonitoredResourcesListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => MonitoredResource.DeserializeMonitoredResource(e), _elasticMonitorResourceClientDiagnostics, Pipeline, "ElasticMonitorResource.MonitoredResourcesList", "value", "nextLink", cancellationToken); } /// @@ -610,22 +623,26 @@ public virtual Pageable GetMonitoredResources(Cancellatio /// /// /// Operation Id - /// DeploymentInfo_List + /// ElasticMonitorResources_DeploymentInfoList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetDeploymentInfoAsync(CancellationToken cancellationToken = default) + public virtual async Task> DeploymentInfoListAsync(CancellationToken cancellationToken = default) { - using var scope = _deploymentInfoClientDiagnostics.CreateScope("ElasticMonitorResource.GetDeploymentInfo"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.DeploymentInfoList"); scope.Start(); try { - var response = await _deploymentInfoRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.DeploymentInfoListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -644,22 +661,26 @@ public virtual async Task> GetDeploymentIn /// /// /// Operation Id - /// DeploymentInfo_List + /// ElasticMonitorResources_DeploymentInfoList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual Response GetDeploymentInfo(CancellationToken cancellationToken = default) + public virtual Response DeploymentInfoList(CancellationToken cancellationToken = default) { - using var scope = _deploymentInfoClientDiagnostics.CreateScope("ElasticMonitorResource.GetDeploymentInfo"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.DeploymentInfoList"); scope.Start(); try { - var response = _deploymentInfoRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _elasticMonitorResourceRestClient.DeploymentInfoList(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -678,23 +699,27 @@ public virtual Response GetDeploymentInfo(Cancellat /// /// /// Operation Id - /// ExternalUser_CreateOrUpdate + /// ElasticMonitorResources_CreateOrUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// Elastic External User Creation Parameters. /// The cancellation token to use. - public virtual async Task> CreateOrUpdateExternalUserAsync(ElasticExternalUserContent content = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(ExternalUserContent content = null, CancellationToken cancellationToken = default) { - using var scope = _externalUserClientDiagnostics.CreateScope("ElasticMonitorResource.CreateOrUpdateExternalUser"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.CreateOrUpdate"); scope.Start(); try { - var response = await _externalUserRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -713,23 +738,27 @@ public virtual async Task> CreateOrU /// /// /// Operation Id - /// ExternalUser_CreateOrUpdate + /// ElasticMonitorResources_CreateOrUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// Elastic External User Creation Parameters. /// The cancellation token to use. - public virtual Response CreateOrUpdateExternalUser(ElasticExternalUserContent content = null, CancellationToken cancellationToken = default) + public virtual Response CreateOrUpdate(ExternalUserContent content = null, CancellationToken cancellationToken = default) { - using var scope = _externalUserClientDiagnostics.CreateScope("ElasticMonitorResource.CreateOrUpdateExternalUser"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.CreateOrUpdate"); scope.Start(); try { - var response = _externalUserRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var response = _elasticMonitorResourceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); return response; } catch (Exception e) @@ -748,22 +777,26 @@ public virtual Response CreateOrUpdateExterna /// /// /// Operation Id - /// BillingInfo_Get + /// ElasticMonitorResources_BillingInfoGet /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetBillingInfoAsync(CancellationToken cancellationToken = default) + public virtual async Task> BillingInfoGetAsync(CancellationToken cancellationToken = default) { - using var scope = _billingInfoClientDiagnostics.CreateScope("ElasticMonitorResource.GetBillingInfo"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.BillingInfoGet"); scope.Start(); try { - var response = await _billingInfoRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.BillingInfoGetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -782,22 +815,26 @@ public virtual async Task> GetBillingInfoAsyn /// /// /// Operation Id - /// BillingInfo_Get + /// ElasticMonitorResources_BillingInfoGet /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual Response GetBillingInfo(CancellationToken cancellationToken = default) + public virtual Response BillingInfoGet(CancellationToken cancellationToken = default) { - using var scope = _billingInfoClientDiagnostics.CreateScope("ElasticMonitorResource.GetBillingInfo"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.BillingInfoGet"); scope.Start(); try { - var response = _billingInfoRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _elasticMonitorResourceRestClient.BillingInfoGet(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -816,21 +853,25 @@ public virtual Response GetBillingInfo(CancellationTok /// /// /// Operation Id - /// ConnectedPartnerResources_List + /// ElasticMonitorResources_ConnectedPartnerResourcesList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConnectedPartnerResourcesAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ConnectedPartnerResourcesListAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _connectedPartnerResourcesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectedPartnerResourcesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ConnectedPartnerResourceInfo.DeserializeConnectedPartnerResourceInfo(e), _connectedPartnerResourcesClientDiagnostics, Pipeline, "ElasticMonitorResource.GetConnectedPartnerResources", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticMonitorResourceRestClient.CreateConnectedPartnerResourcesListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticMonitorResourceRestClient.CreateConnectedPartnerResourcesListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ConnectedPartnerResourcesListFormat.DeserializeConnectedPartnerResourcesListFormat(e), _elasticMonitorResourceClientDiagnostics, Pipeline, "ElasticMonitorResource.ConnectedPartnerResourcesList", "value", "nextLink", cancellationToken); } /// @@ -842,21 +883,25 @@ public virtual AsyncPageable GetConnectedPartnerRe /// /// /// Operation Id - /// ConnectedPartnerResources_List + /// ElasticMonitorResources_ConnectedPartnerResourcesList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConnectedPartnerResources(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ConnectedPartnerResourcesList(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _connectedPartnerResourcesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectedPartnerResourcesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ConnectedPartnerResourceInfo.DeserializeConnectedPartnerResourceInfo(e), _connectedPartnerResourcesClientDiagnostics, Pipeline, "ElasticMonitorResource.GetConnectedPartnerResources", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticMonitorResourceRestClient.CreateConnectedPartnerResourcesListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticMonitorResourceRestClient.CreateConnectedPartnerResourcesListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ConnectedPartnerResourcesListFormat.DeserializeConnectedPartnerResourcesListFormat(e), _elasticMonitorResourceClientDiagnostics, Pipeline, "ElasticMonitorResource.ConnectedPartnerResourcesList", "value", "nextLink", cancellationToken); } /// @@ -868,21 +913,25 @@ public virtual Pageable GetConnectedPartnerResourc /// /// /// Operation Id - /// VMHost_List + /// ElasticMonitorResources_VmHostList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVmHostsAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable VmHostListAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _vmHostRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _vmHostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ElasticVmResourceInfo.DeserializeElasticVmResourceInfo(e), _vmHostClientDiagnostics, Pipeline, "ElasticMonitorResource.GetVmHosts", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticMonitorResourceRestClient.CreateVmHostListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticMonitorResourceRestClient.CreateVmHostListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => VmResources.DeserializeVmResources(e), _elasticMonitorResourceClientDiagnostics, Pipeline, "ElasticMonitorResource.VmHostList", "value", "nextLink", cancellationToken); } /// @@ -894,21 +943,25 @@ public virtual AsyncPageable GetVmHostsAsync(Cancellation /// /// /// Operation Id - /// VMHost_List + /// ElasticMonitorResources_VmHostList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVmHosts(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable VmHostList(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _vmHostRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _vmHostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ElasticVmResourceInfo.DeserializeElasticVmResourceInfo(e), _vmHostClientDiagnostics, Pipeline, "ElasticMonitorResource.GetVmHosts", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticMonitorResourceRestClient.CreateVmHostListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticMonitorResourceRestClient.CreateVmHostListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => VmResources.DeserializeVmResources(e), _elasticMonitorResourceClientDiagnostics, Pipeline, "ElasticMonitorResource.VmHostList", "value", "nextLink", cancellationToken); } /// @@ -920,22 +973,26 @@ public virtual Pageable GetVmHosts(CancellationToken canc /// /// /// Operation Id - /// VMIngestion_Details + /// ElasticMonitorResources_Details /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetVmIngestionDetailsAsync(CancellationToken cancellationToken = default) + public virtual async Task> DetailsAsync(CancellationToken cancellationToken = default) { - using var scope = _vmIngestionClientDiagnostics.CreateScope("ElasticMonitorResource.GetVmIngestionDetails"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Details"); scope.Start(); try { - var response = await _vmIngestionRestClient.DetailsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.DetailsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -954,22 +1011,26 @@ public virtual async Task> GetVmIngestionDeta /// /// /// Operation Id - /// VMIngestion_Details + /// ElasticMonitorResources_Details /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual Response GetVmIngestionDetails(CancellationToken cancellationToken = default) + public virtual Response Details(CancellationToken cancellationToken = default) { - using var scope = _vmIngestionClientDiagnostics.CreateScope("ElasticMonitorResource.GetVmIngestionDetails"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Details"); scope.Start(); try { - var response = _vmIngestionRestClient.Details(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _elasticMonitorResourceRestClient.Details(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -988,23 +1049,27 @@ public virtual Response GetVmIngestionDetails(Cancella /// /// /// Operation Id - /// VMCollection_Update + /// ElasticMonitorResources_VmCollectionUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// - /// VM resource Id. + /// VM resource Id. /// The cancellation token to use. - public virtual async Task UpdateVmCollectionAsync(VmCollectionContent content = null, CancellationToken cancellationToken = default) + public virtual async Task VmCollectionUpdateAsync(VmCollectionUpdate body = null, CancellationToken cancellationToken = default) { - using var scope = _vmCollectionClientDiagnostics.CreateScope("ElasticMonitorResource.UpdateVmCollection"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.VmCollectionUpdate"); scope.Start(); try { - var response = await _vmCollectionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.VmCollectionUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1023,23 +1088,27 @@ public virtual async Task UpdateVmCollectionAsync(VmCollectionContent /// /// /// Operation Id - /// VMCollection_Update + /// ElasticMonitorResources_VmCollectionUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// - /// VM resource Id. + /// VM resource Id. /// The cancellation token to use. - public virtual Response UpdateVmCollection(VmCollectionContent content = null, CancellationToken cancellationToken = default) + public virtual Response VmCollectionUpdate(VmCollectionUpdate body = null, CancellationToken cancellationToken = default) { - using var scope = _vmCollectionClientDiagnostics.CreateScope("ElasticMonitorResource.UpdateVmCollection"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.VmCollectionUpdate"); scope.Start(); try { - var response = _vmCollectionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var response = _elasticMonitorResourceRestClient.VmCollectionUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken); return response; } catch (Exception e) @@ -1058,22 +1127,26 @@ public virtual Response UpdateVmCollection(VmCollectionContent content = null, C /// /// /// Operation Id - /// UpgradableVersions_Details + /// ElasticMonitorResources_UpgradableVersionsDetails /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetUpgradableVersionDetailsAsync(CancellationToken cancellationToken = default) + public virtual async Task> UpgradableVersionsDetailsAsync(CancellationToken cancellationToken = default) { - using var scope = _upgradableVersionsClientDiagnostics.CreateScope("ElasticMonitorResource.GetUpgradableVersionDetails"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.UpgradableVersionsDetails"); scope.Start(); try { - var response = await _upgradableVersionsRestClient.DetailsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.UpgradableVersionsDetailsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1092,22 +1165,26 @@ public virtual async Task> GetUpgradableVe /// /// /// Operation Id - /// UpgradableVersions_Details + /// ElasticMonitorResources_UpgradableVersionsDetails /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual Response GetUpgradableVersionDetails(CancellationToken cancellationToken = default) + public virtual Response UpgradableVersionsDetails(CancellationToken cancellationToken = default) { - using var scope = _upgradableVersionsClientDiagnostics.CreateScope("ElasticMonitorResource.GetUpgradableVersionDetails"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.UpgradableVersionsDetails"); scope.Start(); try { - var response = _upgradableVersionsRestClient.Details(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _elasticMonitorResourceRestClient.UpgradableVersionsDetails(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -1126,25 +1203,29 @@ public virtual Response GetUpgradableVersionDetails /// /// /// Operation Id - /// Monitor_Upgrade + /// ElasticMonitorResources_Upgrade /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-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. /// Elastic Monitor Upgrade Parameters. /// The cancellation token to use. - public virtual async Task UpgradeMonitorAsync(WaitUntil waitUntil, ElasticMonitorUpgrade body = null, CancellationToken cancellationToken = default) + public virtual async Task UpgradeAsync(WaitUntil waitUntil, ElasticMonitorUpgrade body = null, CancellationToken cancellationToken = default) { - using var scope = _monitorClientDiagnostics.CreateScope("ElasticMonitorResource.UpgradeMonitor"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Upgrade"); scope.Start(); try { - var response = await _monitorRestClient.UpgradeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken).ConfigureAwait(false); - var operation = new ElasticArmOperation(_monitorClientDiagnostics, Pipeline, _monitorRestClient.CreateUpgradeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body).Request, response, OperationFinalStateVia.Location); + var response = await _elasticMonitorResourceRestClient.UpgradeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(_elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateUpgradeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1165,25 +1246,29 @@ public virtual async Task UpgradeMonitorAsync(WaitUntil waitUntil, /// /// /// Operation Id - /// Monitor_Upgrade + /// ElasticMonitorResources_Upgrade /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-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. /// Elastic Monitor Upgrade Parameters. /// The cancellation token to use. - public virtual ArmOperation UpgradeMonitor(WaitUntil waitUntil, ElasticMonitorUpgrade body = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Upgrade(WaitUntil waitUntil, ElasticMonitorUpgrade body = null, CancellationToken cancellationToken = default) { - using var scope = _monitorClientDiagnostics.CreateScope("ElasticMonitorResource.UpgradeMonitor"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Upgrade"); scope.Start(); try { - var response = _monitorRestClient.Upgrade(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken); - var operation = new ElasticArmOperation(_monitorClientDiagnostics, Pipeline, _monitorRestClient.CreateUpgradeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body).Request, response, OperationFinalStateVia.Location); + var response = _elasticMonitorResourceRestClient.Upgrade(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken); + var operation = new ElasticArmOperation(_elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateUpgradeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -1204,22 +1289,26 @@ public virtual ArmOperation UpgradeMonitor(WaitUntil waitUntil, ElasticMonitorUp /// /// /// Operation Id - /// AllTrafficFilters_List + /// ElasticMonitorResources_AllTrafficFiltersList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAllTrafficFilterAsync(CancellationToken cancellationToken = default) + public virtual async Task> AllTrafficFiltersListAsync(CancellationToken cancellationToken = default) { - using var scope = _allTrafficFiltersClientDiagnostics.CreateScope("ElasticMonitorResource.GetAllTrafficFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.AllTrafficFiltersList"); scope.Start(); try { - var response = await _allTrafficFiltersRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.AllTrafficFiltersListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1238,22 +1327,26 @@ public virtual async Task> GetAllTraffi /// /// /// Operation Id - /// AllTrafficFilters_List + /// ElasticMonitorResources_AllTrafficFiltersList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual Response GetAllTrafficFilter(CancellationToken cancellationToken = default) + public virtual Response AllTrafficFiltersList(CancellationToken cancellationToken = default) { - using var scope = _allTrafficFiltersClientDiagnostics.CreateScope("ElasticMonitorResource.GetAllTrafficFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.AllTrafficFiltersList"); scope.Start(); try { - var response = _allTrafficFiltersRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _elasticMonitorResourceRestClient.AllTrafficFiltersList(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -1272,22 +1365,26 @@ public virtual Response GetAllTrafficFilter(Canc /// /// /// Operation Id - /// listAssociatedTrafficFilters_List + /// ElasticMonitorResources_ListAssociatedTrafficFiltersList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAssociatedTrafficFiltersAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAssociatedTrafficFiltersListAsync(CancellationToken cancellationToken = default) { - using var scope = _listAssociatedTrafficFiltersClientDiagnostics.CreateScope("ElasticMonitorResource.GetAssociatedTrafficFilters"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.GetAssociatedTrafficFiltersList"); scope.Start(); try { - var response = await _listAssociatedTrafficFiltersRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.ListAssociatedTrafficFiltersListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1306,22 +1403,26 @@ public virtual async Task> GetAssociate /// /// /// Operation Id - /// listAssociatedTrafficFilters_List + /// ElasticMonitorResources_ListAssociatedTrafficFiltersList /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// The cancellation token to use. - public virtual Response GetAssociatedTrafficFilters(CancellationToken cancellationToken = default) + public virtual Response GetAssociatedTrafficFiltersList(CancellationToken cancellationToken = default) { - using var scope = _listAssociatedTrafficFiltersClientDiagnostics.CreateScope("ElasticMonitorResource.GetAssociatedTrafficFilters"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.GetAssociatedTrafficFiltersList"); scope.Start(); try { - var response = _listAssociatedTrafficFiltersRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _elasticMonitorResourceRestClient.ListAssociatedTrafficFiltersList(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -1340,11 +1441,15 @@ public virtual Response GetAssociatedTrafficFilt /// /// /// Operation Id - /// createAndAssociateIPFilter_Create + /// ElasticMonitorResources_CreateAndAssociateIPFilterCreate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// @@ -1352,16 +1457,16 @@ public virtual Response GetAssociatedTrafficFilt /// List of ips. /// Name of the traffic filter. /// The cancellation token to use. - public virtual async Task CreateAndAssociateIPFilterAsync(WaitUntil waitUntil, string ips = null, string name = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateAndAssociateIPFilterCreateAsync(WaitUntil waitUntil, string ips = null, string name = null, CancellationToken cancellationToken = default) { - using var scope = _createAndAssociateIPFilterClientDiagnostics.CreateScope("ElasticMonitorResource.CreateAndAssociateIPFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.CreateAndAssociateIPFilterCreate"); scope.Start(); try { - var response = await _createAndAssociateIPFilterRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ips, name, cancellationToken).ConfigureAwait(false); - var operation = new ElasticArmOperation(_createAndAssociateIPFilterClientDiagnostics, Pipeline, _createAndAssociateIPFilterRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ips, name).Request, response, OperationFinalStateVia.Location); + var response = await _elasticMonitorResourceRestClient.CreateAndAssociateIPFilterCreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ips, name, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(new OkResponseOperationSource(), _elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateCreateAndAssociateIPFilterCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ips, name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -1380,11 +1485,15 @@ public virtual async Task CreateAndAssociateIPFilterAsync(WaitUnti /// /// /// Operation Id - /// createAndAssociateIPFilter_Create + /// ElasticMonitorResources_CreateAndAssociateIPFilterCreate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// @@ -1392,16 +1501,16 @@ public virtual async Task CreateAndAssociateIPFilterAsync(WaitUnti /// List of ips. /// Name of the traffic filter. /// The cancellation token to use. - public virtual ArmOperation CreateAndAssociateIPFilter(WaitUntil waitUntil, string ips = null, string name = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateAndAssociateIPFilterCreate(WaitUntil waitUntil, string ips = null, string name = null, CancellationToken cancellationToken = default) { - using var scope = _createAndAssociateIPFilterClientDiagnostics.CreateScope("ElasticMonitorResource.CreateAndAssociateIPFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.CreateAndAssociateIPFilterCreate"); scope.Start(); try { - var response = _createAndAssociateIPFilterRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ips, name, cancellationToken); - var operation = new ElasticArmOperation(_createAndAssociateIPFilterClientDiagnostics, Pipeline, _createAndAssociateIPFilterRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ips, name).Request, response, OperationFinalStateVia.Location); + var response = _elasticMonitorResourceRestClient.CreateAndAssociateIPFilterCreate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ips, name, cancellationToken); + var operation = new ElasticArmOperation(new OkResponseOperationSource(), _elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateCreateAndAssociateIPFilterCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ips, name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + operation.WaitForCompletion(cancellationToken); return operation; } catch (Exception e) @@ -1420,11 +1529,15 @@ public virtual ArmOperation CreateAndAssociateIPFilter(WaitUntil waitUntil, stri /// /// /// Operation Id - /// createAndAssociatePLFilter_Create + /// ElasticMonitorResources_CreateAndAssociatePLFilterCreate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// @@ -1433,16 +1546,16 @@ public virtual ArmOperation CreateAndAssociateIPFilter(WaitUntil waitUntil, stri /// Guid of the private endpoint. /// Name of the private endpoint. /// The cancellation token to use. - public virtual async Task CreateAndAssociatePrivateLinkFilterAsync(WaitUntil waitUntil, string name = null, string privateEndpointGuid = null, string privateEndpointName = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateAndAssociatePLFilterCreateAsync(WaitUntil waitUntil, string name = null, string privateEndpointGuid = null, string privateEndpointName = null, CancellationToken cancellationToken = default) { - using var scope = _createAndAssociatePLFilterClientDiagnostics.CreateScope("ElasticMonitorResource.CreateAndAssociatePrivateLinkFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.CreateAndAssociatePLFilterCreate"); scope.Start(); try { - var response = await _createAndAssociatePLFilterRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, privateEndpointGuid, privateEndpointName, cancellationToken).ConfigureAwait(false); - var operation = new ElasticArmOperation(_createAndAssociatePLFilterClientDiagnostics, Pipeline, _createAndAssociatePLFilterRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, privateEndpointGuid, privateEndpointName).Request, response, OperationFinalStateVia.Location); + var response = await _elasticMonitorResourceRestClient.CreateAndAssociatePLFilterCreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, privateEndpointGuid, privateEndpointName, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(new OkResponseOperationSource(), _elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateCreateAndAssociatePLFilterCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, privateEndpointGuid, privateEndpointName).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -1461,11 +1574,15 @@ public virtual async Task CreateAndAssociatePrivateLinkFilterAsync /// /// /// Operation Id - /// createAndAssociatePLFilter_Create + /// ElasticMonitorResources_CreateAndAssociatePLFilterCreate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// @@ -1474,16 +1591,16 @@ public virtual async Task CreateAndAssociatePrivateLinkFilterAsync /// Guid of the private endpoint. /// Name of the private endpoint. /// The cancellation token to use. - public virtual ArmOperation CreateAndAssociatePrivateLinkFilter(WaitUntil waitUntil, string name = null, string privateEndpointGuid = null, string privateEndpointName = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateAndAssociatePLFilterCreate(WaitUntil waitUntil, string name = null, string privateEndpointGuid = null, string privateEndpointName = null, CancellationToken cancellationToken = default) { - using var scope = _createAndAssociatePLFilterClientDiagnostics.CreateScope("ElasticMonitorResource.CreateAndAssociatePrivateLinkFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.CreateAndAssociatePLFilterCreate"); scope.Start(); try { - var response = _createAndAssociatePLFilterRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, privateEndpointGuid, privateEndpointName, cancellationToken); - var operation = new ElasticArmOperation(_createAndAssociatePLFilterClientDiagnostics, Pipeline, _createAndAssociatePLFilterRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, privateEndpointGuid, privateEndpointName).Request, response, OperationFinalStateVia.Location); + var response = _elasticMonitorResourceRestClient.CreateAndAssociatePLFilterCreate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, privateEndpointGuid, privateEndpointName, cancellationToken); + var operation = new ElasticArmOperation(new OkResponseOperationSource(), _elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateCreateAndAssociatePLFilterCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, privateEndpointGuid, privateEndpointName).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + operation.WaitForCompletion(cancellationToken); return operation; } catch (Exception e) @@ -1502,25 +1619,29 @@ public virtual ArmOperation CreateAndAssociatePrivateLinkFilter(WaitUntil waitUn /// /// /// Operation Id - /// AssociateTrafficFilter_Associate + /// ElasticMonitorResources_Associate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-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. /// Ruleset Id of the filter. /// The cancellation token to use. - public virtual async Task AssociateTrafficFilterAsync(WaitUntil waitUntil, string rulesetId = null, CancellationToken cancellationToken = default) + public virtual async Task AssociateAsync(WaitUntil waitUntil, string rulesetId = null, CancellationToken cancellationToken = default) { - using var scope = _associateTrafficFilterClientDiagnostics.CreateScope("ElasticMonitorResource.AssociateTrafficFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Associate"); scope.Start(); try { - var response = await _associateTrafficFilterRestClient.AssociateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken).ConfigureAwait(false); - var operation = new ElasticArmOperation(_associateTrafficFilterClientDiagnostics, Pipeline, _associateTrafficFilterRestClient.CreateAssociateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId).Request, response, OperationFinalStateVia.Location); + var response = await _elasticMonitorResourceRestClient.AssociateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(_elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateAssociateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1541,25 +1662,29 @@ public virtual async Task AssociateTrafficFilterAsync(WaitUntil wa /// /// /// Operation Id - /// AssociateTrafficFilter_Associate + /// ElasticMonitorResources_Associate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-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. /// Ruleset Id of the filter. /// The cancellation token to use. - public virtual ArmOperation AssociateTrafficFilter(WaitUntil waitUntil, string rulesetId = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Associate(WaitUntil waitUntil, string rulesetId = null, CancellationToken cancellationToken = default) { - using var scope = _associateTrafficFilterClientDiagnostics.CreateScope("ElasticMonitorResource.AssociateTrafficFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Associate"); scope.Start(); try { - var response = _associateTrafficFilterRestClient.Associate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken); - var operation = new ElasticArmOperation(_associateTrafficFilterClientDiagnostics, Pipeline, _associateTrafficFilterRestClient.CreateAssociateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId).Request, response, OperationFinalStateVia.Location); + var response = _elasticMonitorResourceRestClient.Associate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken); + var operation = new ElasticArmOperation(_elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateAssociateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -1580,23 +1705,27 @@ public virtual ArmOperation AssociateTrafficFilter(WaitUntil waitUntil, string r /// /// /// Operation Id - /// DetachAndDeleteTrafficFilter_Delete + /// ElasticMonitorResources_DetachAndDeleteTrafficFilterDelete /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// Ruleset Id of the filter. /// The cancellation token to use. - public virtual async Task DetachAndDeleteTrafficFilterAsync(string rulesetId = null, CancellationToken cancellationToken = default) + public virtual async Task DetachAndDeleteTrafficFilterDeleteAsync(string rulesetId = null, CancellationToken cancellationToken = default) { - using var scope = _detachAndDeleteTrafficFilterClientDiagnostics.CreateScope("ElasticMonitorResource.DetachAndDeleteTrafficFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.DetachAndDeleteTrafficFilterDelete"); scope.Start(); try { - var response = await _detachAndDeleteTrafficFilterRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.DetachAndDeleteTrafficFilterDeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1615,23 +1744,27 @@ public virtual async Task DetachAndDeleteTrafficFilterAsync(string rul /// /// /// Operation Id - /// DetachAndDeleteTrafficFilter_Delete + /// ElasticMonitorResources_DetachAndDeleteTrafficFilterDelete /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// Ruleset Id of the filter. /// The cancellation token to use. - public virtual Response DetachAndDeleteTrafficFilter(string rulesetId = null, CancellationToken cancellationToken = default) + public virtual Response DetachAndDeleteTrafficFilterDelete(string rulesetId = null, CancellationToken cancellationToken = default) { - using var scope = _detachAndDeleteTrafficFilterClientDiagnostics.CreateScope("ElasticMonitorResource.DetachAndDeleteTrafficFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.DetachAndDeleteTrafficFilterDelete"); scope.Start(); try { - var response = _detachAndDeleteTrafficFilterRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken); + var response = _elasticMonitorResourceRestClient.DetachAndDeleteTrafficFilterDelete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken); return response; } catch (Exception e) @@ -1650,25 +1783,29 @@ public virtual Response DetachAndDeleteTrafficFilter(string rulesetId = null, Ca /// /// /// Operation Id - /// DetachTrafficFilter_Update + /// ElasticMonitorResources_DetachTrafficFilterUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-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. /// Ruleset Id of the filter. /// The cancellation token to use. - public virtual async Task DetachTrafficFilterAsync(WaitUntil waitUntil, string rulesetId = null, CancellationToken cancellationToken = default) + public virtual async Task DetachTrafficFilterUpdateAsync(WaitUntil waitUntil, string rulesetId = null, CancellationToken cancellationToken = default) { - using var scope = _detachTrafficFilterClientDiagnostics.CreateScope("ElasticMonitorResource.DetachTrafficFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.DetachTrafficFilterUpdate"); scope.Start(); try { - var response = await _detachTrafficFilterRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken).ConfigureAwait(false); - var operation = new ElasticArmOperation(_detachTrafficFilterClientDiagnostics, Pipeline, _detachTrafficFilterRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId).Request, response, OperationFinalStateVia.Location); + var response = await _elasticMonitorResourceRestClient.DetachTrafficFilterUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(_elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateDetachTrafficFilterUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1689,25 +1826,29 @@ public virtual async Task DetachTrafficFilterAsync(WaitUntil waitU /// /// /// Operation Id - /// DetachTrafficFilter_Update + /// ElasticMonitorResources_DetachTrafficFilterUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-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. /// Ruleset Id of the filter. /// The cancellation token to use. - public virtual ArmOperation DetachTrafficFilter(WaitUntil waitUntil, string rulesetId = null, CancellationToken cancellationToken = default) + public virtual ArmOperation DetachTrafficFilterUpdate(WaitUntil waitUntil, string rulesetId = null, CancellationToken cancellationToken = default) { - using var scope = _detachTrafficFilterClientDiagnostics.CreateScope("ElasticMonitorResource.DetachTrafficFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.DetachTrafficFilterUpdate"); scope.Start(); try { - var response = _detachTrafficFilterRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken); - var operation = new ElasticArmOperation(_detachTrafficFilterClientDiagnostics, Pipeline, _detachTrafficFilterRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId).Request, response, OperationFinalStateVia.Location); + var response = _elasticMonitorResourceRestClient.DetachTrafficFilterUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken); + var operation = new ElasticArmOperation(_elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateDetachTrafficFilterUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -1728,23 +1869,27 @@ public virtual ArmOperation DetachTrafficFilter(WaitUntil waitUntil, string rule /// /// /// Operation Id - /// TrafficFilters_Delete + /// ElasticMonitorResources_TrafficFiltersDelete /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// Ruleset Id of the filter. /// The cancellation token to use. - public virtual async Task DeleteTrafficFilterAsync(string rulesetId = null, CancellationToken cancellationToken = default) + public virtual async Task TrafficFiltersDeleteAsync(string rulesetId = null, CancellationToken cancellationToken = default) { - using var scope = _trafficFiltersClientDiagnostics.CreateScope("ElasticMonitorResource.DeleteTrafficFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.TrafficFiltersDelete"); scope.Start(); try { - var response = await _trafficFiltersRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.TrafficFiltersDeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1763,23 +1908,27 @@ public virtual async Task DeleteTrafficFilterAsync(string rulesetId = /// /// /// Operation Id - /// TrafficFilters_Delete + /// ElasticMonitorResources_TrafficFiltersDelete /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview + /// + /// + /// Resource + /// /// /// /// /// Ruleset Id of the filter. /// The cancellation token to use. - public virtual Response DeleteTrafficFilter(string rulesetId = null, CancellationToken cancellationToken = default) + public virtual Response TrafficFiltersDelete(string rulesetId = null, CancellationToken cancellationToken = default) { - using var scope = _trafficFiltersClientDiagnostics.CreateScope("ElasticMonitorResource.DeleteTrafficFilter"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.TrafficFiltersDelete"); scope.Start(); try { - var response = _trafficFiltersRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken); + var response = _elasticMonitorResourceRestClient.TrafficFiltersDelete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, rulesetId, cancellationToken); return response; } catch (Exception e) @@ -1789,6 +1938,92 @@ public virtual Response DeleteTrafficFilter(string rulesetId = null, Cancellatio } } + /// + /// Resubscribe the Elasticsearch Organization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/resubscribe + /// + /// + /// Operation Id + /// ElasticMonitorResources_Resubscribe + /// + /// + /// Default Api Version + /// 2025-01-15-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. + /// Resubscribe Properties. + /// The cancellation token to use. + public virtual async Task> ResubscribeAsync(WaitUntil waitUntil, ResubscribeProperties body = null, CancellationToken cancellationToken = default) + { + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Resubscribe"); + scope.Start(); + try + { + var response = await _elasticMonitorResourceRestClient.ResubscribeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(new ArmResponseElasticMonitorResourceOperationSource(), _elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateResubscribeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Resubscribe the Elasticsearch Organization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/resubscribe + /// + /// + /// Operation Id + /// ElasticMonitorResources_Resubscribe + /// + /// + /// Default Api Version + /// 2025-01-15-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. + /// Resubscribe Properties. + /// The cancellation token to use. + public virtual ArmOperation Resubscribe(WaitUntil waitUntil, ResubscribeProperties body = null, CancellationToken cancellationToken = default) + { + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.Resubscribe"); + scope.Start(); + try + { + var response = _elasticMonitorResourceRestClient.Resubscribe(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken); + var operation = new ElasticArmOperation(new ArmResponseElasticMonitorResourceOperationSource(), _elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateResubscribeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Add a tag to the current resource. /// @@ -1798,11 +2033,11 @@ public virtual Response DeleteTrafficFilter(string rulesetId = null, Cancellatio /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -1819,7 +2054,7 @@ public virtual async Task> AddTagAsync(string k Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.AddTag"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.AddTag"); scope.Start(); try { @@ -1828,20 +2063,20 @@ public virtual async Task> AddTagAsync(string k var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _elasticMonitorMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _elasticMonitorResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new ElasticMonitorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new ElasticMonitorPatch(); + var patch = new ElasticMonitorResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false); } } catch (Exception e) @@ -1860,11 +2095,11 @@ public virtual async Task> AddTagAsync(string k /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -1881,7 +2116,7 @@ public virtual Response AddTag(string key, string value, Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.AddTag"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.AddTag"); scope.Start(); try { @@ -1890,20 +2125,20 @@ public virtual Response AddTag(string key, string value, var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _elasticMonitorMonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _elasticMonitorResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new ElasticMonitorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new ElasticMonitorPatch(); + var patch = new ElasticMonitorResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(patch, cancellationToken: cancellationToken); - return result; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Get(cancellationToken: cancellationToken); } } catch (Exception e) @@ -1922,11 +2157,11 @@ public virtual Response AddTag(string key, string value, /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -1941,7 +2176,7 @@ public virtual async Task> SetTagsAsync(IDictio { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.SetTags"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.SetTags"); scope.Start(); try { @@ -1951,16 +2186,16 @@ public virtual async Task> SetTagsAsync(IDictio var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _elasticMonitorMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _elasticMonitorResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new ElasticMonitorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new ElasticMonitorPatch(); + var patch = new ElasticMonitorResourcePatch(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false); } } catch (Exception e) @@ -1979,11 +2214,11 @@ public virtual async Task> SetTagsAsync(IDictio /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -1998,7 +2233,7 @@ public virtual Response SetTags(IDictionary SetTags(IDictionary SetTags(IDictionary /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -2055,7 +2290,7 @@ public virtual async Task> RemoveTagAsync(strin { Argument.AssertNotNull(key, nameof(key)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.RemoveTag"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.RemoveTag"); scope.Start(); try { @@ -2064,20 +2299,20 @@ public virtual async Task> RemoveTagAsync(strin var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _elasticMonitorMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _elasticMonitorResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new ElasticMonitorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new ElasticMonitorPatch(); + var patch = new ElasticMonitorResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false); } } catch (Exception e) @@ -2096,11 +2331,11 @@ public virtual async Task> RemoveTagAsync(strin /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -2115,7 +2350,7 @@ public virtual Response RemoveTag(string key, Cancellati { Argument.AssertNotNull(key, nameof(key)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorResource.RemoveTag"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResource.RemoveTag"); scope.Start(); try { @@ -2124,20 +2359,20 @@ public virtual Response RemoveTag(string key, Cancellati var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _elasticMonitorMonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _elasticMonitorResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new ElasticMonitorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new ElasticMonitorPatch(); + var patch = new ElasticMonitorResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Get(cancellationToken: cancellationToken); } } catch (Exception e) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceCollection.cs similarity index 79% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorCollection.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceCollection.cs index 3150cd45706c..8a7088c8cb00 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorCollection.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceCollection.cs @@ -21,26 +21,26 @@ namespace Azure.ResourceManager.Elastic /// /// 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 GetElasticMonitors method from an instance of . + /// To get an instance call the GetElasticMonitorResources method from an instance of . /// - public partial class ElasticMonitorCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ElasticMonitorResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _elasticMonitorMonitorsClientDiagnostics; - private readonly MonitorsRestOperations _elasticMonitorMonitorsRestClient; + private readonly ClientDiagnostics _elasticMonitorResourceClientDiagnostics; + private readonly ElasticMonitorResourcesRestOperations _elasticMonitorResourceRestClient; - /// Initializes a new instance of the class for mocking. - protected ElasticMonitorCollection() + /// Initializes a new instance of the class for mocking. + protected ElasticMonitorResourceCollection() { } - /// 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 ElasticMonitorCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ElasticMonitorResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticMonitorMonitorsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ElasticMonitorResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ElasticMonitorResource.ResourceType, out string elasticMonitorMonitorsApiVersion); - _elasticMonitorMonitorsRestClient = new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticMonitorMonitorsApiVersion); + _elasticMonitorResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ElasticMonitorResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ElasticMonitorResource.ResourceType, out string elasticMonitorResourceApiVersion); + _elasticMonitorResourceRestClient = new ElasticMonitorResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticMonitorResourceApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -61,11 +61,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Monitors_Create + /// ElasticMonitorResource_Create /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -79,17 +79,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string monitorName, ElasticMonitorData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string monitorName, ElasticMonitorResourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorCollection.CreateOrUpdate"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _elasticMonitorMonitorsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, data, cancellationToken).ConfigureAwait(false); - var operation = new ElasticArmOperation(new ElasticMonitorOperationSource(Client), _elasticMonitorMonitorsClientDiagnostics, Pipeline, _elasticMonitorMonitorsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, monitorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _elasticMonitorResourceRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(new ElasticMonitorResourceOperationSource(Client), _elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, monitorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -110,11 +110,11 @@ public virtual async Task> CreateOrUpdateAs /// /// /// Operation Id - /// Monitors_Create + /// ElasticMonitorResource_Create /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -128,17 +128,17 @@ public virtual async Task> CreateOrUpdateAs /// 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 monitorName, ElasticMonitorData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string monitorName, ElasticMonitorResourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorCollection.CreateOrUpdate"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = _elasticMonitorMonitorsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, monitorName, data, cancellationToken); - var operation = new ElasticArmOperation(new ElasticMonitorOperationSource(Client), _elasticMonitorMonitorsClientDiagnostics, Pipeline, _elasticMonitorMonitorsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, monitorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _elasticMonitorResourceRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, monitorName, data, cancellationToken); + var operation = new ElasticArmOperation(new ElasticMonitorResourceOperationSource(Client), _elasticMonitorResourceClientDiagnostics, Pipeline, _elasticMonitorResourceRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, monitorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -159,11 +159,11 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -179,11 +179,11 @@ public virtual async Task> GetAsync(string moni { Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorCollection.Get"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResourceCollection.Get"); scope.Start(); try { - var response = await _elasticMonitorMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new ElasticMonitorResource(Client, response.Value), response.GetRawResponse()); @@ -204,11 +204,11 @@ public virtual async Task> GetAsync(string moni /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -224,11 +224,11 @@ public virtual Response Get(string monitorName, Cancella { Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorCollection.Get"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResourceCollection.Get"); scope.Start(); try { - var response = _elasticMonitorMonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken); + var response = _elasticMonitorResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new ElasticMonitorResource(Client, response.Value), response.GetRawResponse()); @@ -249,11 +249,11 @@ public virtual Response Get(string monitorName, Cancella /// /// /// Operation Id - /// Monitors_ListByResourceGroup + /// ElasticMonitorResource_ListByResourceGroup /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -265,9 +265,9 @@ public virtual Response Get(string monitorName, Cancella /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticMonitorMonitorsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticMonitorMonitorsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorData.DeserializeElasticMonitorData(e)), _elasticMonitorMonitorsClientDiagnostics, Pipeline, "ElasticMonitorCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticMonitorResourceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticMonitorResourceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(e)), _elasticMonitorResourceClientDiagnostics, Pipeline, "ElasticMonitorResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -279,11 +279,11 @@ public virtual AsyncPageable GetAllAsync(CancellationTok /// /// /// Operation Id - /// Monitors_ListByResourceGroup + /// ElasticMonitorResource_ListByResourceGroup /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -295,9 +295,9 @@ public virtual AsyncPageable GetAllAsync(CancellationTok /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticMonitorMonitorsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticMonitorMonitorsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorData.DeserializeElasticMonitorData(e)), _elasticMonitorMonitorsClientDiagnostics, Pipeline, "ElasticMonitorCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticMonitorResourceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticMonitorResourceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(e)), _elasticMonitorResourceClientDiagnostics, Pipeline, "ElasticMonitorResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -309,11 +309,11 @@ public virtual Pageable GetAll(CancellationToken cancell /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -329,11 +329,11 @@ public virtual async Task> ExistsAsync(string monitorName, Cancel { Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorCollection.Exists"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResourceCollection.Exists"); scope.Start(); try { - var response = await _elasticMonitorMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -352,11 +352,11 @@ public virtual async Task> ExistsAsync(string monitorName, Cancel /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -372,11 +372,11 @@ public virtual Response Exists(string monitorName, CancellationToken cance { Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorCollection.Exists"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResourceCollection.Exists"); scope.Start(); try { - var response = _elasticMonitorMonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken); + var response = _elasticMonitorResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -395,11 +395,11 @@ public virtual Response Exists(string monitorName, CancellationToken cance /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -415,11 +415,11 @@ public virtual async Task> GetIfExistsA { Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorCollection.GetIfExists"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResourceCollection.GetIfExists"); scope.Start(); try { - var response = await _elasticMonitorMonitorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _elasticMonitorResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new ElasticMonitorResource(Client, response.Value), response.GetRawResponse()); @@ -440,11 +440,11 @@ public virtual async Task> GetIfExistsA /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -460,11 +460,11 @@ public virtual NullableResponse GetIfExists(string monit { Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - using var scope = _elasticMonitorMonitorsClientDiagnostics.CreateScope("ElasticMonitorCollection.GetIfExists"); + using var scope = _elasticMonitorResourceClientDiagnostics.CreateScope("ElasticMonitorResourceCollection.GetIfExists"); scope.Start(); try { - var response = _elasticMonitorMonitorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken); + var response = _elasticMonitorResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, monitorName, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new ElasticMonitorResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorData.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceData.Serialization.cs similarity index 72% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorData.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceData.Serialization.cs index 23e81244ea5a..5dc153609546 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorData.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.Elastic { - public partial class ElasticMonitorData : IUtf8JsonSerializable, IJsonModel + public partial class ElasticMonitorResourceData : 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,23 +30,28 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// 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(ElasticMonitorData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ElasticMonitorResourceData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Sku)) - { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); - } if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); @@ -54,19 +59,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - ElasticMonitorData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ElasticMonitorResourceData 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(ElasticMonitorData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ElasticMonitorResourceData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticMonitorData(document.RootElement, options); + return DeserializeElasticMonitorResourceData(document.RootElement, options); } - internal static ElasticMonitorData DeserializeElasticMonitorData(JsonElement element, ModelReaderWriterOptions options = null) + internal static ElasticMonitorResourceData DeserializeElasticMonitorResourceData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -74,8 +79,9 @@ internal static ElasticMonitorData DeserializeElasticMonitorData(JsonElement ele { return null; } - ElasticSku sku = default; - ElasticMonitorProperties properties = default; + MonitorProperties properties = default; + string kind = default; + ResourceSku sku = default; ManagedServiceIdentity identity = default; IDictionary tags = default; AzureLocation location = default; @@ -87,22 +93,27 @@ internal static ElasticMonitorData DeserializeElasticMonitorData(JsonElement ele Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sku"u8)) + if (property.NameEquals("properties"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = ElasticSku.DeserializeElasticSku(property.Value, options); + properties = MonitorProperties.DeserializeMonitorProperties(property.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = ElasticMonitorProperties.DeserializeElasticMonitorProperties(property.Value, options); + sku = ResourceSku.DeserializeResourceSku(property.Value, options); continue; } if (property.NameEquals("identity"u8)) @@ -163,48 +174,49 @@ internal static ElasticMonitorData DeserializeElasticMonitorData(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticMonitorData( + return new ElasticMonitorResourceData( id, name, type, systemData, tags ?? new ChangeTrackingDictionary(), location, - sku, properties, + kind, + sku, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticMonitorData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticMonitorResourceData)} does not support writing '{options.Format}' format."); } } - ElasticMonitorData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ElasticMonitorResourceData 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 DeserializeElasticMonitorData(document.RootElement, options); + return DeserializeElasticMonitorResourceData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticMonitorData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticMonitorResourceData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorData.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceData.cs similarity index 72% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorData.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceData.cs index b8a4a7a2091b..c04f7022b073 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorData.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResourceData.cs @@ -14,10 +14,10 @@ namespace Azure.ResourceManager.Elastic { /// - /// A class representing the ElasticMonitor data model. + /// A class representing the ElasticMonitorResource data model. /// Monitor resource. /// - public partial class ElasticMonitorData : TrackedResourceData + public partial class ElasticMonitorResourceData : TrackedResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,47 +51,51 @@ public partial class ElasticMonitorData : TrackedResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The location. - public ElasticMonitorData(AzureLocation location) : base(location) + public ElasticMonitorResourceData(AzureLocation location) : base(location) { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. - /// SKU of the monitor resource. /// Properties of the monitor resource. + /// The kind of the Elastic resource - observability, security, search etc. + /// SKU of the monitor resource. /// Identity properties of the monitor resource. Current supported identity types: SystemAssigned. /// Keeps track of any properties unknown to the library. - internal ElasticMonitorData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ElasticSku sku, ElasticMonitorProperties properties, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal ElasticMonitorResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MonitorProperties properties, string kind, ResourceSku sku, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { - Sku = sku; Properties = properties; + Kind = kind; + Sku = sku; Identity = identity; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ElasticMonitorData() + /// Initializes a new instance of for deserialization. + internal ElasticMonitorResourceData() { } + /// Properties of the monitor resource. + public MonitorProperties Properties { get; set; } + /// The kind of the Elastic resource - observability, security, search etc. + public string Kind { get; set; } /// SKU of the monitor resource. - internal ElasticSku Sku { get; set; } - /// Name of the SKU. + internal ResourceSku Sku { get; set; } + /// The name of the SKU. public string SkuName { get => Sku is null ? default : Sku.Name; - set => Sku = new ElasticSku(value); + set => Sku = new ResourceSku(value); } - /// Properties of the monitor resource. - public ElasticMonitorProperties Properties { get; set; } /// Identity properties of the monitor resource. Current supported identity types: SystemAssigned. public ManagedServiceIdentity Identity { get; set; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationResource.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationResource.Serialization.cs deleted file mode 100644 index 4340d4e2c2ea..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationResource.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.Elastic -{ - public partial class ElasticOpenAIIntegrationResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ElasticOpenAIIntegrationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticContext.Default); - - ElasticOpenAIIntegrationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleResource.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleResource.Serialization.cs deleted file mode 100644 index e54d9f2acf1a..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleResource.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.Elastic -{ - public partial class ElasticTagRuleResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ElasticTagRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticContext.Default); - - ElasticTagRuleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ElasticExtensions.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ElasticExtensions.cs index 478f0b5c90ab..5c9c95105c55 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ElasticExtensions.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ElasticExtensions.cs @@ -33,6 +33,11 @@ private static MockableElasticSubscriptionResource GetMockableElasticSubscriptio return resource.GetCachedClient(client => new MockableElasticSubscriptionResource(client, resource.Id)); } + private static MockableElasticTenantResource GetMockableElasticTenantResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableElasticTenantResource(client, resource.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. @@ -53,58 +58,77 @@ public static ElasticMonitorResource GetElasticMonitorResource(this ArmClient cl } /// - /// 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. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static MonitoredSubscriptionPropertyResource GetMonitoredSubscriptionPropertyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableElasticArmClient(client).GetMonitoredSubscriptionPropertyResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// 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 ElasticOpenAIIntegrationResource GetElasticOpenAIIntegrationResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static OpenAIIntegrationRPModelResource GetOpenAIIntegrationRPModelResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableElasticArmClient(client).GetElasticOpenAIIntegrationResource(id); + return GetMockableElasticArmClient(client).GetOpenAIIntegrationRPModelResource(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 ElasticTagRuleResource GetElasticTagRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static MonitoringTagRuleResource GetMonitoringTagRuleResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableElasticArmClient(client).GetElasticTagRuleResource(id); + return GetMockableElasticArmClient(client).GetMonitoringTagRuleResource(id); } /// /// Gets a collection of ElasticMonitorResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. /// An object representing collection of ElasticMonitorResources and their operations over a ElasticMonitorResource. - public static ElasticMonitorCollection GetElasticMonitors(this ResourceGroupResource resourceGroupResource) + public static ElasticMonitorResourceCollection GetElasticMonitorResources(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableElasticResourceGroupResource(resourceGroupResource).GetElasticMonitors(); + return GetMockableElasticResourceGroupResource(resourceGroupResource).GetElasticMonitorResources(); } /// @@ -116,11 +140,11 @@ public static ElasticMonitorCollection GetElasticMonitors(this ResourceGroupReso /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -129,7 +153,7 @@ public static ElasticMonitorCollection GetElasticMonitors(this ResourceGroupReso /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -138,11 +162,11 @@ public static ElasticMonitorCollection GetElasticMonitors(this ResourceGroupReso /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetElasticMonitorAsync(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) + public static async Task> GetElasticMonitorResourceAsync(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableElasticResourceGroupResource(resourceGroupResource).GetElasticMonitorAsync(monitorName, cancellationToken).ConfigureAwait(false); + return await GetMockableElasticResourceGroupResource(resourceGroupResource).GetElasticMonitorResourceAsync(monitorName, cancellationToken).ConfigureAwait(false); } /// @@ -154,11 +178,11 @@ public static async Task> GetElasticMonitorAsyn /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -167,7 +191,7 @@ public static async Task> GetElasticMonitorAsyn /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -176,11 +200,11 @@ public static async Task> GetElasticMonitorAsyn /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetElasticMonitor(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) + public static Response GetElasticMonitorResource(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableElasticResourceGroupResource(resourceGroupResource).GetElasticMonitor(monitorName, cancellationToken); + return GetMockableElasticResourceGroupResource(resourceGroupResource).GetElasticMonitorResource(monitorName, cancellationToken); } /// @@ -192,11 +216,11 @@ public static Response GetElasticMonitor(this ResourceGr /// /// /// Operation Id - /// Monitors_List + /// ElasticMonitorResource_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -205,18 +229,18 @@ public static Response GetElasticMonitor(this ResourceGr /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The cancellation token to use. /// is null. /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetElasticMonitorsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + public static AsyncPageable GetElasticMonitorResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticMonitorsAsync(cancellationToken); + return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticMonitorResourcesAsync(cancellationToken); } /// @@ -228,11 +252,11 @@ public static AsyncPageable GetElasticMonitorsAsync(this /// /// /// Operation Id - /// Monitors_List + /// ElasticMonitorResource_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -241,18 +265,18 @@ public static AsyncPageable GetElasticMonitorsAsync(this /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetElasticMonitors(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + public static Pageable GetElasticMonitorResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticMonitors(cancellationToken); + return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticMonitorResources(cancellationToken); } /// @@ -264,28 +288,28 @@ public static Pageable GetElasticMonitors(this Subscript /// /// /// Operation Id - /// ElasticVersions_List + /// ElasticVersionsOperationGroup_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// Region where elastic deployment will take place. /// The cancellation token to use. /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetElasticVersionsAsync(this SubscriptionResource subscriptionResource, string region, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetElasticVersionsOperationGroupsAsync(this SubscriptionResource subscriptionResource, string region, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticVersionsAsync(region, cancellationToken); + return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticVersionsOperationGroupsAsync(region, cancellationToken); } /// @@ -297,28 +321,28 @@ public static AsyncPageable GetElasticVersionsAsync(this Subscri /// /// /// Operation Id - /// ElasticVersions_List + /// ElasticVersionsOperationGroup_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// Region where elastic deployment will take place. /// The cancellation token to use. /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetElasticVersions(this SubscriptionResource subscriptionResource, string region, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetElasticVersionsOperationGroups(this SubscriptionResource subscriptionResource, string region, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticVersions(region, cancellationToken); + return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticVersionsOperationGroups(region, cancellationToken); } /// @@ -330,27 +354,27 @@ public static Pageable GetElasticVersions(this SubscriptionResou /// /// /// Operation Id - /// Organizations_GetApiKey + /// OrganizationsOperationGroup_GetApiKey /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Email Id parameter of the User Organization, of which the API Key must be returned. + /// The request body. /// The cancellation token to use. - /// is null. - public static async Task> GetApiKeyAsync(this SubscriptionResource subscriptionResource, ElasticUserEmailId body = null, CancellationToken cancellationToken = default) + /// or is null. + public static async Task> GetApiKeyOrganizationsOperationGroupAsync(this SubscriptionResource subscriptionResource, UserEmailId body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableElasticSubscriptionResource(subscriptionResource).GetApiKeyAsync(body, cancellationToken).ConfigureAwait(false); + return await GetMockableElasticSubscriptionResource(subscriptionResource).GetApiKeyOrganizationsOperationGroupAsync(body, cancellationToken).ConfigureAwait(false); } /// @@ -362,30 +386,32 @@ public static async Task> GetApiKeyAsync(this /// /// /// Operation Id - /// Organizations_GetApiKey + /// OrganizationsOperationGroup_GetApiKey /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Email Id parameter of the User Organization, of which the API Key must be returned. + /// The request body. /// The cancellation token to use. - /// is null. - public static Response GetApiKey(this SubscriptionResource subscriptionResource, ElasticUserEmailId body = null, CancellationToken cancellationToken = default) + /// or is null. + public static Response GetApiKeyOrganizationsOperationGroup(this SubscriptionResource subscriptionResource, UserEmailId body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableElasticSubscriptionResource(subscriptionResource).GetApiKey(body, cancellationToken); + return GetMockableElasticSubscriptionResource(subscriptionResource).GetApiKeyOrganizationsOperationGroup(body, cancellationToken); } /// + /// >; + /// /** /// Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. /// /// @@ -394,29 +420,31 @@ public static Response GetApiKey(this SubscriptionResou /// /// /// Operation Id - /// Organizations_GetElasticToAzureSubscriptionMapping + /// OrganizationsOperationGroup_GetElasticToAzureSubscriptionMapping /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The cancellation token to use. /// is null. - public static async Task> GetElasticToAzureSubscriptionMappingAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + public static async Task> GetElasticToAzureSubscriptionMappingOrganizationsOperationGroupAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticToAzureSubscriptionMappingAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticToAzureSubscriptionMappingOrganizationsOperationGroupAsync(cancellationToken).ConfigureAwait(false); } /// + /// >; + /// /** /// Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. /// /// @@ -425,26 +453,90 @@ public static async Task /// /// Operation Id - /// Organizations_GetElasticToAzureSubscriptionMapping + /// OrganizationsOperationGroup_GetElasticToAzureSubscriptionMapping /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The cancellation token to use. /// is null. - public static Response GetElasticToAzureSubscriptionMapping(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + public static Response GetElasticToAzureSubscriptionMappingOrganizationsOperationGroup(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticToAzureSubscriptionMapping(cancellationToken); + return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticToAzureSubscriptionMappingOrganizationsOperationGroup(cancellationToken); + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.Elastic/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetOperationsAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableElasticTenantResource(tenantResource).GetOperationsAsync(cancellationToken); + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.Elastic/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetOperations(this TenantResource tenantResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableElasticTenantResource(tenantResource).GetOperations(cancellationToken); } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticArmClient.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticArmClient.cs index c384b8228a37..50b63ca7e35d 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticArmClient.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticArmClient.cs @@ -47,27 +47,39 @@ public virtual ElasticMonitorResource GetElasticMonitorResource(ResourceIdentifi } /// - /// 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 ElasticOpenAIIntegrationResource GetElasticOpenAIIntegrationResource(ResourceIdentifier id) + /// Returns a object. + public virtual MonitoredSubscriptionPropertyResource GetMonitoredSubscriptionPropertyResource(ResourceIdentifier id) { - ElasticOpenAIIntegrationResource.ValidateResourceId(id); - return new ElasticOpenAIIntegrationResource(Client, id); + MonitoredSubscriptionPropertyResource.ValidateResourceId(id); + return new MonitoredSubscriptionPropertyResource(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 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 ElasticTagRuleResource GetElasticTagRuleResource(ResourceIdentifier id) + /// Returns a object. + public virtual OpenAIIntegrationRPModelResource GetOpenAIIntegrationRPModelResource(ResourceIdentifier id) { - ElasticTagRuleResource.ValidateResourceId(id); - return new ElasticTagRuleResource(Client, id); + OpenAIIntegrationRPModelResource.ValidateResourceId(id); + return new OpenAIIntegrationRPModelResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MonitoringTagRuleResource GetMonitoringTagRuleResource(ResourceIdentifier id) + { + MonitoringTagRuleResource.ValidateResourceId(id); + return new MonitoringTagRuleResource(Client, id); } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticResourceGroupResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticResourceGroupResource.cs index 0a93be0df97d..7919c5f5b164 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticResourceGroupResource.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticResourceGroupResource.cs @@ -35,9 +35,9 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// Gets a collection of ElasticMonitorResources in the ResourceGroupResource. /// An object representing collection of ElasticMonitorResources and their operations over a ElasticMonitorResource. - public virtual ElasticMonitorCollection GetElasticMonitors() + public virtual ElasticMonitorResourceCollection GetElasticMonitorResources() { - return GetCachedClient(client => new ElasticMonitorCollection(client, Id)); + return GetCachedClient(client => new ElasticMonitorResourceCollection(client, Id)); } /// @@ -49,11 +49,11 @@ public virtual ElasticMonitorCollection GetElasticMonitors() /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -66,9 +66,9 @@ public virtual ElasticMonitorCollection GetElasticMonitors() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetElasticMonitorAsync(string monitorName, CancellationToken cancellationToken = default) + public virtual async Task> GetElasticMonitorResourceAsync(string monitorName, CancellationToken cancellationToken = default) { - return await GetElasticMonitors().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + return await GetElasticMonitorResources().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); } /// @@ -80,11 +80,11 @@ public virtual async Task> GetElasticMonitorAsy /// /// /// Operation Id - /// Monitors_Get + /// ElasticMonitorResource_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -97,9 +97,9 @@ public virtual async Task> GetElasticMonitorAsy /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetElasticMonitor(string monitorName, CancellationToken cancellationToken = default) + public virtual Response GetElasticMonitorResource(string monitorName, CancellationToken cancellationToken = default) { - return GetElasticMonitors().Get(monitorName, cancellationToken); + return GetElasticMonitorResources().Get(monitorName, cancellationToken); } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticSubscriptionResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticSubscriptionResource.cs index 6fb86a2fbbbf..b5618957a226 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticSubscriptionResource.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticSubscriptionResource.cs @@ -18,12 +18,12 @@ namespace Azure.ResourceManager.Elastic.Mocking /// A class to add extension methods to SubscriptionResource. public partial class MockableElasticSubscriptionResource : ArmResource { - private ClientDiagnostics _elasticMonitorMonitorsClientDiagnostics; - private MonitorsRestOperations _elasticMonitorMonitorsRestClient; - private ClientDiagnostics _elasticVersionsClientDiagnostics; - private ElasticVersionsRestOperations _elasticVersionsRestClient; - private ClientDiagnostics _organizationsClientDiagnostics; - private OrganizationsRestOperations _organizationsRestClient; + private ClientDiagnostics _elasticMonitorResourceClientDiagnostics; + private ElasticMonitorResourcesRestOperations _elasticMonitorResourceRestClient; + private ClientDiagnostics _elasticVersionsOperationGroupClientDiagnostics; + private ElasticVersionsOperationGroupRestOperations _elasticVersionsOperationGroupRestClient; + private ClientDiagnostics _organizationsOperationGroupClientDiagnostics; + private OrganizationsOperationGroupRestOperations _organizationsOperationGroupRestClient; /// Initializes a new instance of the class for mocking. protected MockableElasticSubscriptionResource() @@ -37,12 +37,12 @@ internal MockableElasticSubscriptionResource(ArmClient client, ResourceIdentifie { } - private ClientDiagnostics ElasticMonitorMonitorsClientDiagnostics => _elasticMonitorMonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Elastic", ElasticMonitorResource.ResourceType.Namespace, Diagnostics); - private MonitorsRestOperations ElasticMonitorMonitorsRestClient => _elasticMonitorMonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ElasticMonitorResource.ResourceType)); - private ClientDiagnostics ElasticVersionsClientDiagnostics => _elasticVersionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ElasticVersionsRestOperations ElasticVersionsRestClient => _elasticVersionsRestClient ??= new ElasticVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics OrganizationsClientDiagnostics => _organizationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private OrganizationsRestOperations OrganizationsRestClient => _organizationsRestClient ??= new OrganizationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ElasticMonitorResourceClientDiagnostics => _elasticMonitorResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Elastic", ElasticMonitorResource.ResourceType.Namespace, Diagnostics); + private ElasticMonitorResourcesRestOperations ElasticMonitorResourceRestClient => _elasticMonitorResourceRestClient ??= new ElasticMonitorResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ElasticMonitorResource.ResourceType)); + private ClientDiagnostics ElasticVersionsOperationGroupClientDiagnostics => _elasticVersionsOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ElasticVersionsOperationGroupRestOperations ElasticVersionsOperationGroupRestClient => _elasticVersionsOperationGroupRestClient ??= new ElasticVersionsOperationGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics OrganizationsOperationGroupClientDiagnostics => _organizationsOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OrganizationsOperationGroupRestOperations OrganizationsOperationGroupRestClient => _organizationsOperationGroupRestClient ??= new OrganizationsOperationGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -59,11 +59,11 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Operation Id - /// Monitors_List + /// ElasticMonitorResource_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -73,11 +73,11 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetElasticMonitorsAsync(CancellationToken cancellationToken = default) + public virtual AsyncPageable GetElasticMonitorResourcesAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticMonitorMonitorsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticMonitorMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorData.DeserializeElasticMonitorData(e)), ElasticMonitorMonitorsClientDiagnostics, Pipeline, "MockableElasticSubscriptionResource.GetElasticMonitors", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticMonitorResourceRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticMonitorResourceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(e)), ElasticMonitorResourceClientDiagnostics, Pipeline, "MockableElasticSubscriptionResource.GetElasticMonitorResources", "value", "nextLink", cancellationToken); } /// @@ -89,11 +89,11 @@ public virtual AsyncPageable GetElasticMonitorsAsync(Can /// /// /// Operation Id - /// Monitors_List + /// ElasticMonitorResource_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource @@ -103,11 +103,11 @@ public virtual AsyncPageable GetElasticMonitorsAsync(Can /// /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetElasticMonitors(CancellationToken cancellationToken = default) + public virtual Pageable GetElasticMonitorResources(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticMonitorMonitorsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticMonitorMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorData.DeserializeElasticMonitorData(e)), ElasticMonitorMonitorsClientDiagnostics, Pipeline, "MockableElasticSubscriptionResource.GetElasticMonitors", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticMonitorResourceRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticMonitorResourceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(e)), ElasticMonitorResourceClientDiagnostics, Pipeline, "MockableElasticSubscriptionResource.GetElasticMonitorResources", "value", "nextLink", cancellationToken); } /// @@ -119,25 +119,25 @@ public virtual Pageable GetElasticMonitors(CancellationT /// /// /// Operation Id - /// ElasticVersions_List + /// ElasticVersionsOperationGroup_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// /// Region where elastic deployment will take place. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetElasticVersionsAsync(string region, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetElasticVersionsOperationGroupsAsync(string region, CancellationToken cancellationToken = default) { Argument.AssertNotNull(region, nameof(region)); - HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticVersionsRestClient.CreateListRequest(Id.SubscriptionId, region); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticVersionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, region); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ElasticVersion.DeserializeElasticVersion(e), ElasticVersionsClientDiagnostics, Pipeline, "MockableElasticSubscriptionResource.GetElasticVersions", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticVersionsOperationGroupRestClient.CreateListRequest(Id.SubscriptionId, region); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticVersionsOperationGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, region); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ElasticVersionListFormat.DeserializeElasticVersionListFormat(e), ElasticVersionsOperationGroupClientDiagnostics, Pipeline, "MockableElasticSubscriptionResource.GetElasticVersionsOperationGroups", "value", "nextLink", cancellationToken); } /// @@ -149,25 +149,25 @@ public virtual AsyncPageable GetElasticVersionsAsync(string regi /// /// /// Operation Id - /// ElasticVersions_List + /// ElasticVersionsOperationGroup_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// /// Region where elastic deployment will take place. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetElasticVersions(string region, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetElasticVersionsOperationGroups(string region, CancellationToken cancellationToken = default) { Argument.AssertNotNull(region, nameof(region)); - HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticVersionsRestClient.CreateListRequest(Id.SubscriptionId, region); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticVersionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, region); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ElasticVersion.DeserializeElasticVersion(e), ElasticVersionsClientDiagnostics, Pipeline, "MockableElasticSubscriptionResource.GetElasticVersions", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticVersionsOperationGroupRestClient.CreateListRequest(Id.SubscriptionId, region); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticVersionsOperationGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, region); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ElasticVersionListFormat.DeserializeElasticVersionListFormat(e), ElasticVersionsOperationGroupClientDiagnostics, Pipeline, "MockableElasticSubscriptionResource.GetElasticVersionsOperationGroups", "value", "nextLink", cancellationToken); } /// @@ -179,23 +179,26 @@ public virtual Pageable GetElasticVersions(string region, Cancel /// /// /// Operation Id - /// Organizations_GetApiKey + /// OrganizationsOperationGroup_GetApiKey /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// - /// Email Id parameter of the User Organization, of which the API Key must be returned. + /// The request body. /// The cancellation token to use. - public virtual async Task> GetApiKeyAsync(ElasticUserEmailId body = null, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> GetApiKeyOrganizationsOperationGroupAsync(UserEmailId body, CancellationToken cancellationToken = default) { - using var scope = OrganizationsClientDiagnostics.CreateScope("MockableElasticSubscriptionResource.GetApiKey"); + Argument.AssertNotNull(body, nameof(body)); + + using var scope = OrganizationsOperationGroupClientDiagnostics.CreateScope("MockableElasticSubscriptionResource.GetApiKeyOrganizationsOperationGroup"); scope.Start(); try { - var response = await OrganizationsRestClient.GetApiKeyAsync(Id.SubscriptionId, body, cancellationToken).ConfigureAwait(false); + var response = await OrganizationsOperationGroupRestClient.GetApiKeyAsync(Id.SubscriptionId, body, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -214,23 +217,26 @@ public virtual async Task> GetApiKeyAsync(Elas /// /// /// Operation Id - /// Organizations_GetApiKey + /// OrganizationsOperationGroup_GetApiKey /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// - /// Email Id parameter of the User Organization, of which the API Key must be returned. + /// The request body. /// The cancellation token to use. - public virtual Response GetApiKey(ElasticUserEmailId body = null, CancellationToken cancellationToken = default) + /// is null. + public virtual Response GetApiKeyOrganizationsOperationGroup(UserEmailId body, CancellationToken cancellationToken = default) { - using var scope = OrganizationsClientDiagnostics.CreateScope("MockableElasticSubscriptionResource.GetApiKey"); + Argument.AssertNotNull(body, nameof(body)); + + using var scope = OrganizationsOperationGroupClientDiagnostics.CreateScope("MockableElasticSubscriptionResource.GetApiKeyOrganizationsOperationGroup"); scope.Start(); try { - var response = OrganizationsRestClient.GetApiKey(Id.SubscriptionId, body, cancellationToken); + var response = OrganizationsOperationGroupRestClient.GetApiKey(Id.SubscriptionId, body, cancellationToken); return response; } catch (Exception e) @@ -241,6 +247,8 @@ public virtual Response GetApiKey(ElasticUserEmailId bo } /// + /// >; + /// /** /// Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. /// /// @@ -249,22 +257,22 @@ public virtual Response GetApiKey(ElasticUserEmailId bo /// /// /// Operation Id - /// Organizations_GetElasticToAzureSubscriptionMapping + /// OrganizationsOperationGroup_GetElasticToAzureSubscriptionMapping /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// /// The cancellation token to use. - public virtual async Task> GetElasticToAzureSubscriptionMappingAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetElasticToAzureSubscriptionMappingOrganizationsOperationGroupAsync(CancellationToken cancellationToken = default) { - using var scope = OrganizationsClientDiagnostics.CreateScope("MockableElasticSubscriptionResource.GetElasticToAzureSubscriptionMapping"); + using var scope = OrganizationsOperationGroupClientDiagnostics.CreateScope("MockableElasticSubscriptionResource.GetElasticToAzureSubscriptionMappingOrganizationsOperationGroup"); scope.Start(); try { - var response = await OrganizationsRestClient.GetElasticToAzureSubscriptionMappingAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + var response = await OrganizationsOperationGroupRestClient.GetElasticToAzureSubscriptionMappingAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -275,6 +283,8 @@ public virtual async Task + /// >; + /// /** /// Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. /// /// @@ -283,22 +293,22 @@ public virtual async Task /// /// Operation Id - /// Organizations_GetElasticToAzureSubscriptionMapping + /// OrganizationsOperationGroup_GetElasticToAzureSubscriptionMapping /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// /// The cancellation token to use. - public virtual Response GetElasticToAzureSubscriptionMapping(CancellationToken cancellationToken = default) + public virtual Response GetElasticToAzureSubscriptionMappingOrganizationsOperationGroup(CancellationToken cancellationToken = default) { - using var scope = OrganizationsClientDiagnostics.CreateScope("MockableElasticSubscriptionResource.GetElasticToAzureSubscriptionMapping"); + using var scope = OrganizationsOperationGroupClientDiagnostics.CreateScope("MockableElasticSubscriptionResource.GetElasticToAzureSubscriptionMappingOrganizationsOperationGroup"); scope.Start(); try { - var response = OrganizationsRestClient.GetElasticToAzureSubscriptionMapping(Id.SubscriptionId, cancellationToken); + var response = OrganizationsOperationGroupRestClient.GetElasticToAzureSubscriptionMapping(Id.SubscriptionId, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticTenantResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticTenantResource.cs new file mode 100644 index 000000000000..eae89418d7ff --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticTenantResource.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Elastic.Models; + +namespace Azure.ResourceManager.Elastic.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableElasticTenantResource : ArmResource + { + private ClientDiagnostics _operationsClientDiagnostics; + private OperationsRestOperations _operationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableElasticTenantResource() + { + } + + /// 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 MockableElasticTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OperationsClientDiagnostics => _operationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Elastic", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OperationsRestOperations OperationsRestClient => _operationsRestClient ??= new OperationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.Elastic/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationsRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => OperationResult.DeserializeOperationResult(e), OperationsClientDiagnostics, Pipeline, "MockableElasticTenantResource.GetOperations", "value", "nextLink", cancellationToken); + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.Elastic/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationsRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => OperationResult.DeserializeOperationResult(e), OperationsClientDiagnostics, Pipeline, "MockableElasticTenantResource.GetOperations", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/ArmResponseElasticMonitorResourceOperationSource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/ArmResponseElasticMonitorResourceOperationSource.cs new file mode 100644 index 000000000000..c2f8da1a04b5 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/ArmResponseElasticMonitorResourceOperationSource.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Elastic.Models; + +namespace Azure.ResourceManager.Elastic +{ + internal class ArmResponseElasticMonitorResourceOperationSource : IOperationSource + { + ArmResponseElasticMonitorResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return ArmResponseElasticMonitorResource.DeserializeArmResponseElasticMonitorResource(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return ArmResponseElasticMonitorResource.DeserializeArmResponseElasticMonitorResource(document.RootElement); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/ElasticMonitorOperationSource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/ElasticMonitorResourceOperationSource.cs similarity index 64% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/ElasticMonitorOperationSource.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/ElasticMonitorResourceOperationSource.cs index e0cea980ef8e..b3b6c69fb42d 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/ElasticMonitorOperationSource.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/ElasticMonitorResourceOperationSource.cs @@ -12,24 +12,24 @@ namespace Azure.ResourceManager.Elastic { - internal class ElasticMonitorOperationSource : IOperationSource + internal class ElasticMonitorResourceOperationSource : IOperationSource { private readonly ArmClient _client; - internal ElasticMonitorOperationSource(ArmClient client) + internal ElasticMonitorResourceOperationSource(ArmClient client) { _client = client; } ElasticMonitorResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticContext.Default); + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticContext.Default); return new ElasticMonitorResource(_client, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticContext.Default); + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticContext.Default); return await Task.FromResult(new ElasticMonitorResource(_client, data)).ConfigureAwait(false); } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/MonitoredSubscriptionPropertyOperationSource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/MonitoredSubscriptionPropertyOperationSource.cs new file mode 100644 index 000000000000..8bd4f4c62bea --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/MonitoredSubscriptionPropertyOperationSource.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.Elastic +{ + internal class MonitoredSubscriptionPropertyOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal MonitoredSubscriptionPropertyOperationSource(ArmClient client) + { + _client = client; + } + + MonitoredSubscriptionPropertyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticContext.Default); + return new MonitoredSubscriptionPropertyResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerElasticContext.Default); + return await Task.FromResult(new MonitoredSubscriptionPropertyResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/OkResponseOperationSource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/OkResponseOperationSource.cs new file mode 100644 index 000000000000..6144498ceeb6 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/LongRunningOperation/OkResponseOperationSource.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Elastic.Models; + +namespace Azure.ResourceManager.Elastic +{ + internal class OkResponseOperationSource : IOperationSource + { + OkResponse IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return OkResponse.DeserializeOkResponse(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return OkResponse.DeserializeOkResponse(document.RootElement); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/.Serialization.cs new file mode 100644 index 000000000000..deb0e398f893 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/.Serialization.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => (System.ClientModel.Primitives.IJsonModel < Models.>this).Write(writer, global::Azure.ResourceManager.Elastic.ModelSerializationExtensions.WireOptions); + +void global::System.ClientModel.Primitives.IJsonModel.Write(global::System.Text.Json.Utf8JsonWriter writer,global::System.ClientModel.Primitives.ModelReaderWriterOptions options) +{ + writer.WriteStartObject(); + this.JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + +/// The JSON writer. +/// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? (System.ClientModel.Primitives.IPersistableModel < Models.>this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Models.)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Models.global::System.ClientModel.Primitives.IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) +{ +var format = options.Format == "W" ? (System.ClientModel.Primitives.IPersistableModel < Models.>this).GetFormatFromOptions(options) : options.Format; +if ((format != "J")) +{ +throw new FormatException($"The model {nameof(global::Azure.ResourceManager.Elastic.Models.)} does not support reading '{format}' format."); +} + +using JsonDocument document = JsonDocument.ParseValue(ref reader); +return Azure.ResourceManager.Elastic.Models..Deserialize(document.RootElement, options); +} + +internal static Azure.ResourceManager.Elastic.Models.Deserialize(JsonElement element, System.ClientModel.Primitives.ModelReaderWriterOptions options = (ModelReaderWriterOptions)null) +{ + options ??= Azure.ResourceManager.Elastic.ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == global::System.Text.Json.JsonValueKind.Null) + { + return null; + } + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, global::System.BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Azure.ResourceManager.Elastic.Models.(serializedAdditionalRawData); +} + +BinaryData System.ClientModel.Primitives.IPersistableModel.Write(ModelReaderWriterOptions options) +{ + var format = options.Format == "W" ? (System.ClientModel.Primitives.IPersistableModel < Azure.ResourceManager.Elastic.Models.>this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(Azure.ResourceManager.Elastic.Models.)} does not support writing '{options.Format}' format."); + } +} + +Azure.ResourceManager.Elastic.Models.global::System.ClientModel.Primitives.IPersistableModel < Azure.ResourceManager.Elastic.Models.>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) +{ + var format = options.Format == "W" ? (System.ClientModel.Primitives.IPersistableModel < Azure.ResourceManager.Elastic.Models.>this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, Azure.ResourceManager.Elastic.ModelSerializationExtensions.JsonDocumentOptions); + return Azure.ResourceManager.Elastic.Models..Deserialize(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Azure.ResourceManager.Elastic.Models.)} does not support reading '{options.Format}' format."); + } +} + +string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; +} +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/.cs new file mode 100644 index 000000000000..e63564fbd474 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal () +{ +} + +/// Initializes a new instance of . +/// Keeps track of any properties unknown to the library. +internal (IDictionary serializedAdditionalRawData) +{ + _serializedAdditionalRawData = serializedAdditionalRawData; +} +} +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserCreationResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ArmResponseElasticMonitorResource.Serialization.cs similarity index 62% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserCreationResult.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ArmResponseElasticMonitorResource.Serialization.cs index c059c6aeee8c..2c8cbc14e6b8 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserCreationResult.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ArmResponseElasticMonitorResource.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticExternalUserCreationResult : IUtf8JsonSerializable, IJsonModel + public partial class ArmResponseElasticMonitorResource : 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,17 +28,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ElasticExternalUserCreationResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ArmResponseElasticMonitorResource)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(IsCreated)) - { - writer.WritePropertyName("created"u8); - writer.WriteBooleanValue(IsCreated.Value); - } + writer.WritePropertyName("body"u8); + writer.WriteObjectValue(Body, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -56,19 +53,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticExternalUserCreationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ArmResponseElasticMonitorResource 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(ElasticExternalUserCreationResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ArmResponseElasticMonitorResource)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticExternalUserCreationResult(document.RootElement, options); + return DeserializeArmResponseElasticMonitorResource(document.RootElement, options); } - internal static ElasticExternalUserCreationResult DeserializeElasticExternalUserCreationResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static ArmResponseElasticMonitorResource DeserializeArmResponseElasticMonitorResource(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,18 +73,14 @@ internal static ElasticExternalUserCreationResult DeserializeElasticExternalUser { return null; } - bool? created = default; + ElasticMonitorResourceData body = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("created"u8)) + if (property.NameEquals("body"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - created = property.Value.GetBoolean(); + body = ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(property.Value, options); continue; } if (options.Format != "W") @@ -96,38 +89,38 @@ internal static ElasticExternalUserCreationResult DeserializeElasticExternalUser } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticExternalUserCreationResult(created, serializedAdditionalRawData); + return new ArmResponseElasticMonitorResource(body, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticExternalUserCreationResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ArmResponseElasticMonitorResource)} does not support writing '{options.Format}' format."); } } - ElasticExternalUserCreationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ArmResponseElasticMonitorResource 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 DeserializeElasticExternalUserCreationResult(document.RootElement, options); + return DeserializeArmResponseElasticMonitorResource(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticExternalUserCreationResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ArmResponseElasticMonitorResource)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ArmResponseElasticMonitorResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ArmResponseElasticMonitorResource.cs new file mode 100644 index 000000000000..8cbb96faab39 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ArmResponseElasticMonitorResource.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// Azure operation completed successfully. + public partial class ArmResponseElasticMonitorResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The body type of the operation request or response. + /// is null. + internal ArmResponseElasticMonitorResource(ElasticMonitorResourceData body) + { + Argument.AssertNotNull(body, nameof(body)); + + Body = body; + } + + /// Initializes a new instance of . + /// The body type of the operation request or response. + /// Keeps track of any properties unknown to the library. + internal ArmResponseElasticMonitorResource(ElasticMonitorResourceData body, IDictionary serializedAdditionalRawData) + { + Body = body; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ArmResponseElasticMonitorResource() + { + } + + /// The body type of the operation request or response. + public ElasticMonitorResourceData Body { get; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticBillingInfoResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/BillingInfoResponse.Serialization.cs similarity index 69% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticBillingInfoResult.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/BillingInfoResponse.Serialization.cs index f86675e70ad4..6871d5be49c3 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticBillingInfoResult.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/BillingInfoResponse.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticBillingInfoResult : IUtf8JsonSerializable, IJsonModel + public partial class BillingInfoResponse : 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(ElasticBillingInfoResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(BillingInfoResponse)} does not support writing '{format}' format."); } if (Optional.IsDefined(MarketplaceSaasInfo)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticBillingInfoResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + BillingInfoResponse 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(ElasticBillingInfoResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(BillingInfoResponse)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticBillingInfoResult(document.RootElement, options); + return DeserializeBillingInfoResponse(document.RootElement, options); } - internal static ElasticBillingInfoResult DeserializeElasticBillingInfoResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static BillingInfoResponse DeserializeBillingInfoResponse(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -111,38 +111,38 @@ internal static ElasticBillingInfoResult DeserializeElasticBillingInfoResult(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticBillingInfoResult(marketplaceSaasInfo, partnerBillingEntity, serializedAdditionalRawData); + return new BillingInfoResponse(marketplaceSaasInfo, partnerBillingEntity, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticBillingInfoResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(BillingInfoResponse)} does not support writing '{options.Format}' format."); } } - ElasticBillingInfoResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + BillingInfoResponse 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 DeserializeElasticBillingInfoResult(document.RootElement, options); + return DeserializeBillingInfoResponse(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticBillingInfoResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(BillingInfoResponse)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticBillingInfoResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/BillingInfoResponse.cs similarity index 84% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticBillingInfoResult.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/BillingInfoResponse.cs index 8ce9d011bf91..1911e8350053 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticBillingInfoResult.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/BillingInfoResponse.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Marketplace Subscription and Organization details to which resource gets billed into. - public partial class ElasticBillingInfoResult + public partial class BillingInfoResponse { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ElasticBillingInfoResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticBillingInfoResult() + /// Initializes a new instance of . + internal BillingInfoResponse() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Marketplace Subscription details. /// Partner Billing Entity details: Organization Info. /// Keeps track of any properties unknown to the library. - internal ElasticBillingInfoResult(MarketplaceSaaSInfo marketplaceSaasInfo, PartnerBillingEntity partnerBillingEntity, IDictionary serializedAdditionalRawData) + internal BillingInfoResponse(MarketplaceSaaSInfo marketplaceSaasInfo, PartnerBillingEntity partnerBillingEntity, IDictionary serializedAdditionalRawData) { MarketplaceSaasInfo = marketplaceSaasInfo; PartnerBillingEntity = partnerBillingEntity; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCompanyInfo.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/CompanyInfo.Serialization.cs similarity index 74% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCompanyInfo.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/CompanyInfo.Serialization.cs index 85b021e0a14e..5247100b04a2 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCompanyInfo.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/CompanyInfo.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticCompanyInfo : IUtf8JsonSerializable, IJsonModel + public partial class CompanyInfo : 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, ModelReaderWrit /// 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(ElasticCompanyInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CompanyInfo)} does not support writing '{format}' format."); } if (Optional.IsDefined(Domain)) @@ -76,19 +76,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticCompanyInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + CompanyInfo 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(ElasticCompanyInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CompanyInfo)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticCompanyInfo(document.RootElement, options); + return DeserializeCompanyInfo(document.RootElement, options); } - internal static ElasticCompanyInfo DeserializeElasticCompanyInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static CompanyInfo DeserializeCompanyInfo(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -136,7 +136,7 @@ internal static ElasticCompanyInfo DeserializeElasticCompanyInfo(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticCompanyInfo( + return new CompanyInfo( domain, business, employeesNumber, @@ -145,35 +145,35 @@ internal static ElasticCompanyInfo DeserializeElasticCompanyInfo(JsonElement ele 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticCompanyInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CompanyInfo)} does not support writing '{options.Format}' format."); } } - ElasticCompanyInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + CompanyInfo 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 DeserializeElasticCompanyInfo(document.RootElement, options); + return DeserializeCompanyInfo(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticCompanyInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CompanyInfo)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCompanyInfo.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/CompanyInfo.cs similarity index 86% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCompanyInfo.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/CompanyInfo.cs index 9c57e66f19a1..4c48cda044f6 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCompanyInfo.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/CompanyInfo.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Company information of the user to be passed to partners. - public partial class ElasticCompanyInfo + public partial class CompanyInfo { /// /// Keeps track of any properties unknown to the library. @@ -45,19 +45,19 @@ public partial class ElasticCompanyInfo /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticCompanyInfo() + /// Initializes a new instance of . + public CompanyInfo() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Domain of the company. /// Business of the company. /// Number of employees in the company. /// State of the company location. /// Country of the company location. /// Keeps track of any properties unknown to the library. - internal ElasticCompanyInfo(string domain, string business, string employeesNumber, string state, string country, IDictionary serializedAdditionalRawData) + internal CompanyInfo(string domain, string business, string employeesNumber, string state, string country, IDictionary serializedAdditionalRawData) { Domain = domain; Business = business; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConfigurationType.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConfigurationType.cs new file mode 100644 index 000000000000..10e3b005cacb --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConfigurationType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// Configuration type of the Elasticsearch project. + public readonly partial struct ConfigurationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConfigurationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GeneralPurposeValue = "GeneralPurpose"; + private const string VectorValue = "Vector"; + private const string TimeSeriesValue = "TimeSeries"; + private const string NotApplicableValue = "NotApplicable"; + + /// GeneralPurpose. + public static ConfigurationType GeneralPurpose { get; } = new ConfigurationType(GeneralPurposeValue); + /// Vector. + public static ConfigurationType Vector { get; } = new ConfigurationType(VectorValue); + /// TimeSeries. + public static ConfigurationType TimeSeries { get; } = new ConfigurationType(TimeSeriesValue); + /// NotApplicable. + public static ConfigurationType NotApplicable { get; } = new ConfigurationType(NotApplicableValue); + /// Determines if two values are the same. + public static bool operator ==(ConfigurationType left, ConfigurationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConfigurationType left, ConfigurationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ConfigurationType(string value) => new ConfigurationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConfigurationType other && Equals(other); + /// + public bool Equals(ConfigurationType 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceProperties.Serialization.cs index dd6838645dd7..09abe613523f 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceProperties.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceProperties.Serialization.cs @@ -42,7 +42,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(PartnerDeploymentUri)) { writer.WritePropertyName("partnerDeploymentUri"u8); - writer.WriteStringValue(PartnerDeploymentUri.AbsoluteUri); + writer.WriteStringValue(PartnerDeploymentUri); } if (Optional.IsDefined(AzureResourceId)) { @@ -52,7 +52,12 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location.Value); + writer.WriteStringValue(Location); + } + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -92,9 +97,10 @@ internal static ConnectedPartnerResourceProperties DeserializeConnectedPartnerRe return null; } string partnerDeploymentName = default; - Uri partnerDeploymentUri = default; - ResourceIdentifier azureResourceId = default; - AzureLocation? location = default; + string partnerDeploymentUri = default; + string azureResourceId = default; + string location = default; + string type = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -106,29 +112,22 @@ internal static ConnectedPartnerResourceProperties DeserializeConnectedPartnerRe } if (property.NameEquals("partnerDeploymentUri"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - partnerDeploymentUri = new Uri(property.Value.GetString()); + partnerDeploymentUri = property.Value.GetString(); continue; } if (property.NameEquals("azureResourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - azureResourceId = new ResourceIdentifier(property.Value.GetString()); + azureResourceId = property.Value.GetString(); continue; } 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("type"u8)) + { + type = property.Value.GetString(); continue; } if (options.Format != "W") @@ -137,7 +136,13 @@ internal static ConnectedPartnerResourceProperties DeserializeConnectedPartnerRe } } serializedAdditionalRawData = rawDataDictionary; - return new ConnectedPartnerResourceProperties(partnerDeploymentName, partnerDeploymentUri, azureResourceId, location, serializedAdditionalRawData); + return new ConnectedPartnerResourceProperties( + partnerDeploymentName, + partnerDeploymentUri, + azureResourceId, + location, + type, + serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceProperties.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceProperties.cs index 9d8bbb596e41..507ba3132bb3 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceProperties.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceProperties.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.Elastic.Models { @@ -52,27 +51,31 @@ internal ConnectedPartnerResourceProperties() } /// Initializes a new instance of . - /// Elastic deployment name. - /// Deployment URL of the elasticsearch in Elastic cloud deployment. - /// The azure resource Id of the deployment. - /// The location of the deployment. + /// Elastic resource name. + /// URL of the resource in Elastic cloud. + /// The azure resource Id of the resource. + /// The location of the resource. + /// The hosting type of the resource. /// Keeps track of any properties unknown to the library. - internal ConnectedPartnerResourceProperties(string partnerDeploymentName, Uri partnerDeploymentUri, ResourceIdentifier azureResourceId, AzureLocation? location, IDictionary serializedAdditionalRawData) + internal ConnectedPartnerResourceProperties(string partnerDeploymentName, string partnerDeploymentUri, string azureResourceId, string location, string type, IDictionary serializedAdditionalRawData) { PartnerDeploymentName = partnerDeploymentName; PartnerDeploymentUri = partnerDeploymentUri; AzureResourceId = azureResourceId; Location = location; + Type = type; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Elastic deployment name. + /// Elastic resource name. public string PartnerDeploymentName { get; } - /// Deployment URL of the elasticsearch in Elastic cloud deployment. - public Uri PartnerDeploymentUri { get; } - /// The azure resource Id of the deployment. - public ResourceIdentifier AzureResourceId { get; } - /// The location of the deployment. - public AzureLocation? Location { get; } + /// URL of the resource in Elastic cloud. + public string PartnerDeploymentUri { get; } + /// The azure resource Id of the resource. + public string AzureResourceId { get; } + /// The location of the resource. + public string Location { get; } + /// The hosting type of the resource. + public string Type { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceInfo.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListFormat.Serialization.cs similarity index 66% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceInfo.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListFormat.Serialization.cs index dfe36e46a8db..13c274e7a8d3 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceInfo.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListFormat.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ConnectedPartnerResourceInfo : IUtf8JsonSerializable, IJsonModel + public partial class ConnectedPartnerResourcesListFormat : 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(ConnectedPartnerResourceInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ConnectedPartnerResourcesListFormat)} does not support writing '{format}' format."); } if (Optional.IsDefined(Properties)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ConnectedPartnerResourceInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ConnectedPartnerResourcesListFormat 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(ConnectedPartnerResourceInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ConnectedPartnerResourcesListFormat)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeConnectedPartnerResourceInfo(document.RootElement, options); + return DeserializeConnectedPartnerResourcesListFormat(document.RootElement, options); } - internal static ConnectedPartnerResourceInfo DeserializeConnectedPartnerResourceInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static ConnectedPartnerResourcesListFormat DeserializeConnectedPartnerResourcesListFormat(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -96,38 +96,38 @@ internal static ConnectedPartnerResourceInfo DeserializeConnectedPartnerResource } } serializedAdditionalRawData = rawDataDictionary; - return new ConnectedPartnerResourceInfo(properties, serializedAdditionalRawData); + return new ConnectedPartnerResourcesListFormat(properties, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ConnectedPartnerResourceInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConnectedPartnerResourcesListFormat)} does not support writing '{options.Format}' format."); } } - ConnectedPartnerResourceInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ConnectedPartnerResourcesListFormat 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 DeserializeConnectedPartnerResourceInfo(document.RootElement, options); + return DeserializeConnectedPartnerResourcesListFormat(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ConnectedPartnerResourceInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConnectedPartnerResourcesListFormat)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceInfo.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListFormat.cs similarity index 86% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceInfo.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListFormat.cs index 3dcd8548e845..11410f7becab 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourceInfo.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListFormat.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Connected Partner Resources List Format. - public partial class ConnectedPartnerResourceInfo + public partial class ConnectedPartnerResourcesListFormat { /// /// Keeps track of any properties unknown to the library. @@ -45,15 +45,15 @@ public partial class ConnectedPartnerResourceInfo /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ConnectedPartnerResourceInfo() + /// Initializes a new instance of . + internal ConnectedPartnerResourcesListFormat() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Connected Partner Resource Properties. /// Keeps track of any properties unknown to the library. - internal ConnectedPartnerResourceInfo(ConnectedPartnerResourceProperties properties, IDictionary serializedAdditionalRawData) + internal ConnectedPartnerResourcesListFormat(ConnectedPartnerResourceProperties properties, IDictionary serializedAdditionalRawData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListResponse.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListResponse.Serialization.cs index e3b9850595bc..cd6711c3baa7 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListResponse.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListResponse.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ConnectedPartnerResourcesListResponse)} 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); } + 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 ConnectedPartnerResourcesListResponse DeserializeConnectedPartne { 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(ConnectedPartnerResourceInfo.DeserializeConnectedPartnerResourceInfo(item, options)); + array.Add(ConnectedPartnerResourcesListFormat.DeserializeConnectedPartnerResourcesListFormat(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 ConnectedPartnerResourcesListResponse DeserializeConnectedPartne } } serializedAdditionalRawData = rawDataDictionary; - return new ConnectedPartnerResourcesListResponse(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ConnectedPartnerResourcesListResponse(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListResponse.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListResponse.cs index b125510590c2..fd203a8c1ab2 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListResponse.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ConnectedPartnerResourcesListResponse.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Elastic.Models { @@ -46,25 +47,34 @@ internal partial class ConnectedPartnerResourcesListResponse private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ConnectedPartnerResourcesListResponse() + /// The ConnectedPartnerResourcesListFormat items on this page. + /// is null. + internal ConnectedPartnerResourcesListResponse(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of a list operation. - /// Link to the next set of results, if any. + /// The ConnectedPartnerResourcesListFormat items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ConnectedPartnerResourcesListResponse(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ConnectedPartnerResourcesListResponse(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Results of a list operation. - public IReadOnlyList Value { get; } - /// Link to the next set of results, if any. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal ConnectedPartnerResourcesListResponse() + { + } + + /// The ConnectedPartnerResourcesListFormat items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticDeploymentInfoResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/DeploymentInfoResponse.Serialization.cs similarity index 69% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticDeploymentInfoResult.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/DeploymentInfoResponse.Serialization.cs index 83f0b0f81348..8423edf4674c 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticDeploymentInfoResult.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/DeploymentInfoResponse.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticDeploymentInfoResult : IUtf8JsonSerializable, IJsonModel + public partial class DeploymentInfoResponse : 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(ElasticDeploymentInfoResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DeploymentInfoResponse)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Status)) @@ -62,13 +62,23 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(DeploymentUri)) { writer.WritePropertyName("deploymentUrl"u8); - writer.WriteStringValue(DeploymentUri.AbsoluteUri); + writer.WriteStringValue(DeploymentUri); } if (options.Format != "W" && Optional.IsDefined(MarketplaceSaasInfo)) { writer.WritePropertyName("marketplaceSaasInfo"u8); writer.WriteObjectValue(MarketplaceSaasInfo, options); } + if (options.Format != "W" && Optional.IsDefined(ProjectType)) + { + writer.WritePropertyName("projectType"u8); + writer.WriteStringValue(ProjectType); + } + if (options.Format != "W" && Optional.IsDefined(ConfigurationType)) + { + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -86,19 +96,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticDeploymentInfoResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DeploymentInfoResponse 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(ElasticDeploymentInfoResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DeploymentInfoResponse)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticDeploymentInfoResult(document.RootElement, options); + return DeserializeDeploymentInfoResponse(document.RootElement, options); } - internal static ElasticDeploymentInfoResult DeserializeElasticDeploymentInfoResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static DeploymentInfoResponse DeserializeDeploymentInfoResponse(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -111,8 +121,10 @@ internal static ElasticDeploymentInfoResult DeserializeElasticDeploymentInfoResu string memoryCapacity = default; string diskCapacity = default; string elasticsearchEndPoint = default; - Uri deploymentUrl = default; + string deploymentUrl = default; MarketplaceSaaSInfo marketplaceSaasInfo = default; + string projectType = default; + string configurationType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -148,11 +160,7 @@ internal static ElasticDeploymentInfoResult DeserializeElasticDeploymentInfoResu } if (property.NameEquals("deploymentUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - deploymentUrl = new Uri(property.Value.GetString()); + deploymentUrl = property.Value.GetString(); continue; } if (property.NameEquals("marketplaceSaasInfo"u8)) @@ -164,13 +172,23 @@ internal static ElasticDeploymentInfoResult DeserializeElasticDeploymentInfoResu marketplaceSaasInfo = MarketplaceSaaSInfo.DeserializeMarketplaceSaaSInfo(property.Value, options); continue; } + if (property.NameEquals("projectType"u8)) + { + projectType = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticDeploymentInfoResult( + return new DeploymentInfoResponse( status, version, memoryCapacity, @@ -178,38 +196,40 @@ internal static ElasticDeploymentInfoResult DeserializeElasticDeploymentInfoResu elasticsearchEndPoint, deploymentUrl, marketplaceSaasInfo, + projectType, + configurationType, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticDeploymentInfoResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeploymentInfoResponse)} does not support writing '{options.Format}' format."); } } - ElasticDeploymentInfoResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DeploymentInfoResponse 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 DeserializeElasticDeploymentInfoResult(document.RootElement, options); + return DeserializeDeploymentInfoResponse(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticDeploymentInfoResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DeploymentInfoResponse)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticDeploymentInfoResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/DeploymentInfoResponse.cs similarity index 76% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticDeploymentInfoResult.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/DeploymentInfoResponse.cs index 14158e375f44..039986989032 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticDeploymentInfoResult.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/DeploymentInfoResponse.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// The properties of deployment in Elastic cloud corresponding to the Elastic monitor resource. - public partial class ElasticDeploymentInfoResult + public partial class DeploymentInfoResponse { /// /// Keeps track of any properties unknown to the library. @@ -45,12 +45,12 @@ public partial class ElasticDeploymentInfoResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticDeploymentInfoResult() + /// Initializes a new instance of . + internal DeploymentInfoResponse() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The Elastic deployment status. /// Version of the elasticsearch in Elastic cloud deployment. /// RAM capacity of the elasticsearch in Elastic cloud deployment. @@ -58,8 +58,10 @@ internal ElasticDeploymentInfoResult() /// Elasticsearch endpoint in Elastic cloud deployment. This is either the aliased_endpoint if available, or the service_url otherwise. /// Deployment URL of the elasticsearch in Elastic cloud deployment. /// Marketplace SaaS Info of the resource. + /// Project Type - Applicable for Serverless only. + /// ConfigurationType Type - Applicable for Serverless only. /// Keeps track of any properties unknown to the library. - internal ElasticDeploymentInfoResult(ElasticDeploymentStatus? status, string version, string memoryCapacity, string diskCapacity, string elasticsearchEndPoint, Uri deploymentUri, MarketplaceSaaSInfo marketplaceSaasInfo, IDictionary serializedAdditionalRawData) + internal DeploymentInfoResponse(ElasticDeploymentStatus? status, string version, string memoryCapacity, string diskCapacity, string elasticsearchEndPoint, string deploymentUri, MarketplaceSaaSInfo marketplaceSaasInfo, string projectType, string configurationType, IDictionary serializedAdditionalRawData) { Status = status; Version = version; @@ -68,6 +70,8 @@ internal ElasticDeploymentInfoResult(ElasticDeploymentStatus? status, string ver ElasticsearchEndPoint = elasticsearchEndPoint; DeploymentUri = deploymentUri; MarketplaceSaasInfo = marketplaceSaasInfo; + ProjectType = projectType; + ConfigurationType = configurationType; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -82,8 +86,12 @@ internal ElasticDeploymentInfoResult(ElasticDeploymentStatus? status, string ver /// Elasticsearch endpoint in Elastic cloud deployment. This is either the aliased_endpoint if available, or the service_url otherwise. public string ElasticsearchEndPoint { get; } /// Deployment URL of the elasticsearch in Elastic cloud deployment. - public Uri DeploymentUri { get; } + public string DeploymentUri { get; } /// Marketplace SaaS Info of the resource. public MarketplaceSaaSInfo MarketplaceSaasInfo { get; } + /// Project Type - Applicable for Serverless only. + public string ProjectType { get; } + /// ConfigurationType Type - Applicable for Serverless only. + public string ConfigurationType { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudDeployment.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudDeployment.Serialization.cs index 4358cc5501bb..7558b64d80fb 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudDeployment.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudDeployment.Serialization.cs @@ -57,17 +57,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(ElasticsearchServiceUri)) { writer.WritePropertyName("elasticsearchServiceUrl"u8); - writer.WriteStringValue(ElasticsearchServiceUri.AbsoluteUri); + writer.WriteStringValue(ElasticsearchServiceUri); } if (options.Format != "W" && Optional.IsDefined(KibanaServiceUri)) { writer.WritePropertyName("kibanaServiceUrl"u8); - writer.WriteStringValue(KibanaServiceUri.AbsoluteUri); + writer.WriteStringValue(KibanaServiceUri); } if (options.Format != "W" && Optional.IsDefined(KibanaSsoUri)) { writer.WritePropertyName("kibanaSsoUrl"u8); - writer.WriteStringValue(KibanaSsoUri.AbsoluteUri); + writer.WriteStringValue(KibanaSsoUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -110,9 +110,9 @@ internal static ElasticCloudDeployment DeserializeElasticCloudDeployment(JsonEle string deploymentId = default; string azureSubscriptionId = default; string elasticsearchRegion = default; - Uri elasticsearchServiceUrl = default; - Uri kibanaServiceUrl = default; - Uri kibanaSsoUrl = default; + string elasticsearchServiceUrl = default; + string kibanaServiceUrl = default; + string kibanaSsoUrl = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -139,29 +139,17 @@ internal static ElasticCloudDeployment DeserializeElasticCloudDeployment(JsonEle } if (property.NameEquals("elasticsearchServiceUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - elasticsearchServiceUrl = new Uri(property.Value.GetString()); + elasticsearchServiceUrl = property.Value.GetString(); continue; } if (property.NameEquals("kibanaServiceUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kibanaServiceUrl = new Uri(property.Value.GetString()); + kibanaServiceUrl = property.Value.GetString(); continue; } if (property.NameEquals("kibanaSsoUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kibanaSsoUrl = new Uri(property.Value.GetString()); + kibanaSsoUrl = property.Value.GetString(); continue; } if (options.Format != "W") diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudDeployment.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudDeployment.cs index 4865affbef52..0351a138d18b 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudDeployment.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudDeployment.cs @@ -59,7 +59,7 @@ public ElasticCloudDeployment() /// Kibana endpoint of the Elastic deployment. /// Kibana dashboard sso URL of the Elastic deployment. /// Keeps track of any properties unknown to the library. - internal ElasticCloudDeployment(string name, string deploymentId, string azureSubscriptionId, string elasticsearchRegion, Uri elasticsearchServiceUri, Uri kibanaServiceUri, Uri kibanaSsoUri, IDictionary serializedAdditionalRawData) + internal ElasticCloudDeployment(string name, string deploymentId, string azureSubscriptionId, string elasticsearchRegion, string elasticsearchServiceUri, string kibanaServiceUri, string kibanaSsoUri, IDictionary serializedAdditionalRawData) { Name = name; DeploymentId = deploymentId; @@ -80,10 +80,10 @@ internal ElasticCloudDeployment(string name, string deploymentId, string azureSu /// Region where Deployment at Elastic side took place. public string ElasticsearchRegion { get; } /// Elasticsearch ingestion endpoint of the Elastic deployment. - public Uri ElasticsearchServiceUri { get; } + public string ElasticsearchServiceUri { get; } /// Kibana endpoint of the Elastic deployment. - public Uri KibanaServiceUri { get; } + public string KibanaServiceUri { get; } /// Kibana dashboard sso URL of the Elastic deployment. - public Uri KibanaSsoUri { get; } + public string KibanaSsoUri { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudUser.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudUser.Serialization.cs index 5488280f2c12..79fa399d47be 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudUser.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudUser.Serialization.cs @@ -47,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(ElasticCloudSsoDefaultUri)) { writer.WritePropertyName("elasticCloudSsoDefaultUrl"u8); - writer.WriteStringValue(ElasticCloudSsoDefaultUri.AbsoluteUri); + writer.WriteStringValue(ElasticCloudSsoDefaultUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -88,7 +88,7 @@ internal static ElasticCloudUser DeserializeElasticCloudUser(JsonElement element } string emailAddress = default; string id = default; - Uri elasticCloudSsoDefaultUrl = default; + string elasticCloudSsoDefaultUrl = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -105,11 +105,7 @@ internal static ElasticCloudUser DeserializeElasticCloudUser(JsonElement element } if (property.NameEquals("elasticCloudSsoDefaultUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - elasticCloudSsoDefaultUrl = new Uri(property.Value.GetString()); + elasticCloudSsoDefaultUrl = property.Value.GetString(); continue; } if (options.Format != "W") diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudUser.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudUser.cs index 9a58d65dc6d9..044c16f9ea65 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudUser.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudUser.cs @@ -55,7 +55,7 @@ public ElasticCloudUser() /// User Id of the elastic account of the User. /// Elastic cloud default dashboard sso URL of the Elastic user account. /// Keeps track of any properties unknown to the library. - internal ElasticCloudUser(string emailAddress, string id, Uri elasticCloudSsoDefaultUri, IDictionary serializedAdditionalRawData) + internal ElasticCloudUser(string emailAddress, string id, string elasticCloudSsoDefaultUri, IDictionary serializedAdditionalRawData) { EmailAddress = emailAddress; Id = id; @@ -68,6 +68,6 @@ internal ElasticCloudUser(string emailAddress, string id, Uri elasticCloudSsoDef /// User Id of the elastic account of the User. public string Id { get; } /// Elastic cloud default dashboard sso URL of the Elastic user account. - public Uri ElasticCloudSsoDefaultUri { get; } + public string ElasticCloudSsoDefaultUri { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticFilterType.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticFilterType.cs deleted file mode 100644 index 3000bedf6402..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticFilterType.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.Elastic.Models -{ - /// Type of the elastic filter. - public readonly partial struct ElasticFilterType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticFilterType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string IPValue = "ip"; - private const string AzurePrivateEndpointValue = "azure_private_endpoint"; - - /// ip. - public static ElasticFilterType IP { get; } = new ElasticFilterType(IPValue); - /// azure_private_endpoint. - public static ElasticFilterType AzurePrivateEndpoint { get; } = new ElasticFilterType(AzurePrivateEndpointValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticFilterType left, ElasticFilterType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticFilterType left, ElasticFilterType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticFilterType(string value) => new ElasticFilterType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticFilterType other && Equals(other); - /// - public bool Equals(ElasticFilterType 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticLiftrResourceCategory.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticLiftrResourceCategory.cs deleted file mode 100644 index 5b7d8a25ecd9..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticLiftrResourceCategory.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.Elastic.Models -{ - /// The ElasticLiftrResourceCategory. - public readonly partial struct ElasticLiftrResourceCategory : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticLiftrResourceCategory(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UnknownValue = "Unknown"; - private const string MonitorLogsValue = "MonitorLogs"; - - /// Unknown. - public static ElasticLiftrResourceCategory Unknown { get; } = new ElasticLiftrResourceCategory(UnknownValue); - /// MonitorLogs. - public static ElasticLiftrResourceCategory MonitorLogs { get; } = new ElasticLiftrResourceCategory(MonitorLogsValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticLiftrResourceCategory left, ElasticLiftrResourceCategory right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticLiftrResourceCategory left, ElasticLiftrResourceCategory right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticLiftrResourceCategory(string value) => new ElasticLiftrResourceCategory(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticLiftrResourceCategory other && Equals(other); - /// - public bool Equals(ElasticLiftrResourceCategory 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourceListResponse.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourceListResponse.Serialization.cs index 7ff4c428a464..ea844293e80a 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourceListResponse.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourceListResponse.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ElasticMonitorResourceListResponse)} 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); } + 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 ElasticMonitorResourceListResponse DeserializeElasticMonitorReso { 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(ElasticMonitorData.DeserializeElasticMonitorData(item, options)); + array.Add(ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(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 ElasticMonitorResourceListResponse DeserializeElasticMonitorReso } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticMonitorResourceListResponse(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ElasticMonitorResourceListResponse(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourceListResponse.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourceListResponse.cs index 254ef967bef8..0f3c1e42730d 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourceListResponse.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourceListResponse.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Elastic.Models { @@ -46,25 +47,34 @@ internal partial class ElasticMonitorResourceListResponse private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ElasticMonitorResourceListResponse() + /// The ElasticMonitorResource items on this page. + /// is null. + internal ElasticMonitorResourceListResponse(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of a list operation. - /// Link to the next set of results, if any. + /// The ElasticMonitorResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ElasticMonitorResourceListResponse(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ElasticMonitorResourceListResponse(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Results of a list operation. - public IReadOnlyList Value { get; } - /// Link to the next set of results, if any. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal ElasticMonitorResourceListResponse() + { + } + + /// The ElasticMonitorResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorPatch.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourcePatch.Serialization.cs similarity index 69% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorPatch.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourcePatch.Serialization.cs index 5ebaa6c28313..f8dcd3e8277f 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorPatch.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourcePatch.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticMonitorPatch : IUtf8JsonSerializable, IJsonModel + public partial class ElasticMonitorResourcePatch : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ElasticMonitorPatch)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ElasticMonitorResourcePatch)} does not support writing '{format}' format."); } if (Optional.IsCollectionDefined(Tags)) @@ -62,19 +62,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticMonitorPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ElasticMonitorResourcePatch 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(ElasticMonitorPatch)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ElasticMonitorResourcePatch)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticMonitorPatch(document.RootElement, options); + return DeserializeElasticMonitorResourcePatch(document.RootElement, options); } - internal static ElasticMonitorPatch DeserializeElasticMonitorPatch(JsonElement element, ModelReaderWriterOptions options = null) + internal static ElasticMonitorResourcePatch DeserializeElasticMonitorResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -107,38 +107,38 @@ internal static ElasticMonitorPatch DeserializeElasticMonitorPatch(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticMonitorPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new ElasticMonitorResourcePatch(tags ?? new ChangeTrackingDictionary(), 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticMonitorPatch)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticMonitorResourcePatch)} does not support writing '{options.Format}' format."); } } - ElasticMonitorPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ElasticMonitorResourcePatch 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 DeserializeElasticMonitorPatch(document.RootElement, options); + return DeserializeElasticMonitorResourcePatch(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticMonitorPatch)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticMonitorResourcePatch)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorPatch.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourcePatch.cs similarity index 87% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorPatch.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourcePatch.cs index c48c054fb9a2..9186d6510153 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorPatch.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorResourcePatch.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Monitor resource update parameters. - public partial class ElasticMonitorPatch + public partial class ElasticMonitorResourcePatch { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ElasticMonitorPatch /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticMonitorPatch() + /// Initializes a new instance of . + public ElasticMonitorResourcePatch() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// elastic monitor resource tags. /// Keeps track of any properties unknown to the library. - internal ElasticMonitorPatch(IDictionary tags, IDictionary serializedAdditionalRawData) + internal ElasticMonitorResourcePatch(IDictionary tags, IDictionary serializedAdditionalRawData) { Tags = tags; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitoringStatus.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitoringStatus.cs deleted file mode 100644 index 3528b4a9596f..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitoringStatus.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.Elastic.Models -{ - /// Flag specifying if the resource monitoring is enabled or disabled. - public readonly partial struct ElasticMonitoringStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticMonitoringStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// Enabled. - public static ElasticMonitoringStatus Enabled { get; } = new ElasticMonitoringStatus(EnabledValue); - /// Disabled. - public static ElasticMonitoringStatus Disabled { get; } = new ElasticMonitoringStatus(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticMonitoringStatus left, ElasticMonitoringStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticMonitoringStatus left, ElasticMonitoringStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticMonitoringStatus(string value) => new ElasticMonitoringStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticMonitoringStatus other && Equals(other); - /// - public bool Equals(ElasticMonitoringStatus 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusResult.Serialization.cs deleted file mode 100644 index 4445a57238df..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusResult.Serialization.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.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Elastic.Models -{ - public partial class ElasticOpenAIIntegrationStatusResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationStatusResult)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Properties)) - { - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ElasticOpenAIIntegrationStatusResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationStatusResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticOpenAIIntegrationStatusResult(document.RootElement, options); - } - - internal static ElasticOpenAIIntegrationStatusResult DeserializeElasticOpenAIIntegrationStatusResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ElasticOpenAIIntegrationStatusProperties properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - properties = ElasticOpenAIIntegrationStatusProperties.DeserializeElasticOpenAIIntegrationStatusProperties(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ElasticOpenAIIntegrationStatusResult(properties, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); - default: - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationStatusResult)} does not support writing '{options.Format}' format."); - } - } - - ElasticOpenAIIntegrationStatusResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeElasticOpenAIIntegrationStatusResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationStatusResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponse.Serialization.cs similarity index 67% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResult.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponse.Serialization.cs index 11635e690a47..90f601b1b205 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResult.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponse.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticOrganizationToAzureSubscriptionMappingResult : IUtf8JsonSerializable, IJsonModel + public partial class ElasticOrganizationToAzureSubscriptionMappingResponse : 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(Utf8J /// 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(ElasticOrganizationToAzureSubscriptionMappingResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingResponse)} does not support writing '{format}' format."); } if (Optional.IsDefined(Properties)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticOrganizationToAzureSubscriptionMappingResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ElasticOrganizationToAzureSubscriptionMappingResponse 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(ElasticOrganizationToAzureSubscriptionMappingResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingResponse)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticOrganizationToAzureSubscriptionMappingResult(document.RootElement, options); + return DeserializeElasticOrganizationToAzureSubscriptionMappingResponse(document.RootElement, options); } - internal static ElasticOrganizationToAzureSubscriptionMappingResult DeserializeElasticOrganizationToAzureSubscriptionMappingResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static ElasticOrganizationToAzureSubscriptionMappingResponse DeserializeElasticOrganizationToAzureSubscriptionMappingResponse(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,7 +76,7 @@ internal static ElasticOrganizationToAzureSubscriptionMappingResult DeserializeE { return null; } - ElasticOrganizationToAzureSubscriptionMappingProperties properties = default; + ElasticOrganizationToAzureSubscriptionMappingResponseProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -87,7 +87,7 @@ internal static ElasticOrganizationToAzureSubscriptionMappingResult DeserializeE { continue; } - properties = ElasticOrganizationToAzureSubscriptionMappingProperties.DeserializeElasticOrganizationToAzureSubscriptionMappingProperties(property.Value, options); + properties = ElasticOrganizationToAzureSubscriptionMappingResponseProperties.DeserializeElasticOrganizationToAzureSubscriptionMappingResponseProperties(property.Value, options); continue; } if (options.Format != "W") @@ -96,38 +96,38 @@ internal static ElasticOrganizationToAzureSubscriptionMappingResult DeserializeE } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticOrganizationToAzureSubscriptionMappingResult(properties, serializedAdditionalRawData); + return new ElasticOrganizationToAzureSubscriptionMappingResponse(properties, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingResponse)} does not support writing '{options.Format}' format."); } } - ElasticOrganizationToAzureSubscriptionMappingResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ElasticOrganizationToAzureSubscriptionMappingResponse 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 DeserializeElasticOrganizationToAzureSubscriptionMappingResult(document.RootElement, options); + return DeserializeElasticOrganizationToAzureSubscriptionMappingResponse(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingResponse)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponse.cs similarity index 86% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResult.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponse.cs index f2b82338006a..df4786fb90d0 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResult.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponse.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// The Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into. - public partial class ElasticOrganizationToAzureSubscriptionMappingResult + public partial class ElasticOrganizationToAzureSubscriptionMappingResponse { /// /// Keeps track of any properties unknown to the library. @@ -45,21 +45,21 @@ public partial class ElasticOrganizationToAzureSubscriptionMappingResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticOrganizationToAzureSubscriptionMappingResult() + /// Initializes a new instance of . + internal ElasticOrganizationToAzureSubscriptionMappingResponse() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The properties of Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into. /// Keeps track of any properties unknown to the library. - internal ElasticOrganizationToAzureSubscriptionMappingResult(ElasticOrganizationToAzureSubscriptionMappingProperties properties, IDictionary serializedAdditionalRawData) + internal ElasticOrganizationToAzureSubscriptionMappingResponse(ElasticOrganizationToAzureSubscriptionMappingResponseProperties properties, IDictionary serializedAdditionalRawData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// The properties of Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into. - public ElasticOrganizationToAzureSubscriptionMappingProperties Properties { get; } + public ElasticOrganizationToAzureSubscriptionMappingResponseProperties Properties { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponseProperties.Serialization.cs similarity index 72% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingProperties.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponseProperties.Serialization.cs index b96def9ea151..0ef01b54b6f0 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingProperties.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponseProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticOrganizationToAzureSubscriptionMappingProperties : IUtf8JsonSerializable, IJsonModel + public partial class ElasticOrganizationToAzureSubscriptionMappingResponseProperties : 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(U /// 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(ElasticOrganizationToAzureSubscriptionMappingProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingResponseProperties)} does not support writing '{format}' format."); } if (Optional.IsDefined(BilledAzureSubscriptionId)) @@ -71,19 +71,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticOrganizationToAzureSubscriptionMappingProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ElasticOrganizationToAzureSubscriptionMappingResponseProperties 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(ElasticOrganizationToAzureSubscriptionMappingProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingResponseProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticOrganizationToAzureSubscriptionMappingProperties(document.RootElement, options); + return DeserializeElasticOrganizationToAzureSubscriptionMappingResponseProperties(document.RootElement, options); } - internal static ElasticOrganizationToAzureSubscriptionMappingProperties DeserializeElasticOrganizationToAzureSubscriptionMappingProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static ElasticOrganizationToAzureSubscriptionMappingResponseProperties DeserializeElasticOrganizationToAzureSubscriptionMappingResponseProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -129,38 +129,38 @@ internal static ElasticOrganizationToAzureSubscriptionMappingProperties Deserial } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticOrganizationToAzureSubscriptionMappingProperties(billedAzureSubscriptionId, marketplaceSaasInfo, elasticOrganizationId, elasticOrganizationName, serializedAdditionalRawData); + return new ElasticOrganizationToAzureSubscriptionMappingResponseProperties(billedAzureSubscriptionId, marketplaceSaasInfo, elasticOrganizationId, elasticOrganizationName, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingResponseProperties)} does not support writing '{options.Format}' format."); } } - ElasticOrganizationToAzureSubscriptionMappingProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ElasticOrganizationToAzureSubscriptionMappingResponseProperties 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 DeserializeElasticOrganizationToAzureSubscriptionMappingProperties(document.RootElement, options); + return DeserializeElasticOrganizationToAzureSubscriptionMappingResponseProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticOrganizationToAzureSubscriptionMappingResponseProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingProperties.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponseProperties.cs similarity index 86% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingProperties.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponseProperties.cs index 2fa6ba5ab742..e97f07019657 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingProperties.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOrganizationToAzureSubscriptionMappingResponseProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// The properties of Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into. - public partial class ElasticOrganizationToAzureSubscriptionMappingProperties + public partial class ElasticOrganizationToAzureSubscriptionMappingResponseProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,18 +45,18 @@ public partial class ElasticOrganizationToAzureSubscriptionMappingProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticOrganizationToAzureSubscriptionMappingProperties() + /// Initializes a new instance of . + internal ElasticOrganizationToAzureSubscriptionMappingResponseProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The Azure Subscription ID to which the Organization belongs and gets billed into. This is empty for a new user OR a user without an Elastic Organization. /// Marketplace SaaS Info of the resource. /// The Elastic Organization Id. /// The Elastic Organization Name. /// Keeps track of any properties unknown to the library. - internal ElasticOrganizationToAzureSubscriptionMappingProperties(string billedAzureSubscriptionId, MarketplaceSaaSInfo marketplaceSaasInfo, string elasticOrganizationId, string elasticOrganizationName, IDictionary serializedAdditionalRawData) + internal ElasticOrganizationToAzureSubscriptionMappingResponseProperties(string billedAzureSubscriptionId, MarketplaceSaaSInfo marketplaceSaasInfo, string elasticOrganizationId, string elasticOrganizationName, IDictionary serializedAdditionalRawData) { BilledAzureSubscriptionId = billedAzureSubscriptionId; MarketplaceSaasInfo = marketplaceSaasInfo; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticProperties.Serialization.cs similarity index 71% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudProperties.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticProperties.Serialization.cs index 16e8316ce750..24b5bad00a90 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudProperties.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticCloudProperties : IUtf8JsonSerializable, IJsonModel + public partial class ElasticProperties : 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, ModelReader /// 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(ElasticCloudProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ElasticProperties)} does not support writing '{format}' format."); } if (Optional.IsDefined(ElasticCloudUser)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticCloudProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ElasticProperties 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(ElasticCloudProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ElasticProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticCloudProperties(document.RootElement, options); + return DeserializeElasticProperties(document.RootElement, options); } - internal static ElasticCloudProperties DeserializeElasticCloudProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static ElasticProperties DeserializeElasticProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -111,38 +111,38 @@ internal static ElasticCloudProperties DeserializeElasticCloudProperties(JsonEle } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticCloudProperties(elasticCloudUser, elasticCloudDeployment, serializedAdditionalRawData); + return new ElasticProperties(elasticCloudUser, elasticCloudDeployment, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticCloudProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticProperties)} does not support writing '{options.Format}' format."); } } - ElasticCloudProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ElasticProperties 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 DeserializeElasticCloudProperties(document.RootElement, options); + return DeserializeElasticProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticCloudProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudProperties.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticProperties.cs similarity index 88% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudProperties.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticProperties.cs index 1f3ae628756d..d6b85a8ca303 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticCloudProperties.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Elastic Resource Properties. - public partial class ElasticCloudProperties + public partial class ElasticProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ElasticCloudProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticCloudProperties() + /// Initializes a new instance of . + public ElasticProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Details of the user's elastic account. /// Details of the elastic cloud deployment. /// Keeps track of any properties unknown to the library. - internal ElasticCloudProperties(ElasticCloudUser elasticCloudUser, ElasticCloudDeployment elasticCloudDeployment, IDictionary serializedAdditionalRawData) + internal ElasticProperties(ElasticCloudUser elasticCloudUser, ElasticCloudDeployment elasticCloudDeployment, IDictionary serializedAdditionalRawData) { ElasticCloudUser = elasticCloudUser; ElasticCloudDeployment = elasticCloudDeployment; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticProvisioningState.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticProvisioningState.cs deleted file mode 100644 index 9ee31e8f3e78..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticProvisioningState.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Elastic.Models -{ - /// Provisioning state of Elastic resource. - public readonly partial struct ElasticProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ElasticProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AcceptedValue = "Accepted"; - private const string CreatingValue = "Creating"; - private const string UpdatingValue = "Updating"; - private const string DeletingValue = "Deleting"; - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CanceledValue = "Canceled"; - private const string DeletedValue = "Deleted"; - private const string NotSpecifiedValue = "NotSpecified"; - - /// Accepted. - public static ElasticProvisioningState Accepted { get; } = new ElasticProvisioningState(AcceptedValue); - /// Creating. - public static ElasticProvisioningState Creating { get; } = new ElasticProvisioningState(CreatingValue); - /// Updating. - public static ElasticProvisioningState Updating { get; } = new ElasticProvisioningState(UpdatingValue); - /// Deleting. - public static ElasticProvisioningState Deleting { get; } = new ElasticProvisioningState(DeletingValue); - /// Succeeded. - public static ElasticProvisioningState Succeeded { get; } = new ElasticProvisioningState(SucceededValue); - /// Failed. - public static ElasticProvisioningState Failed { get; } = new ElasticProvisioningState(FailedValue); - /// Canceled. - public static ElasticProvisioningState Canceled { get; } = new ElasticProvisioningState(CanceledValue); - /// Deleted. - public static ElasticProvisioningState Deleted { get; } = new ElasticProvisioningState(DeletedValue); - /// NotSpecified. - public static ElasticProvisioningState NotSpecified { get; } = new ElasticProvisioningState(NotSpecifiedValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticProvisioningState left, ElasticProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticProvisioningState left, ElasticProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ElasticProvisioningState(string value) => new ElasticProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticProvisioningState other && Equals(other); - /// - public bool Equals(ElasticProvisioningState 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilter.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilter.Serialization.cs index f8ac3daa7661..4d327e9e86a9 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilter.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilter.Serialization.cs @@ -54,15 +54,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("region"u8); writer.WriteStringValue(Region); } - if (Optional.IsDefined(FilterType)) + if (Optional.IsDefined(Type)) { writer.WritePropertyName("type"u8); - writer.WriteStringValue(FilterType.Value.ToString()); + writer.WriteStringValue(Type.Value.ToString()); } - if (Optional.IsDefined(DoesIncludeByDefault)) + if (Optional.IsDefined(IncludeByDefault)) { writer.WritePropertyName("includeByDefault"u8); - writer.WriteBooleanValue(DoesIncludeByDefault.Value); + writer.WriteBooleanValue(IncludeByDefault.Value); } if (Optional.IsCollectionDefined(Rules)) { @@ -115,7 +115,7 @@ internal static ElasticTrafficFilter DeserializeElasticTrafficFilter(JsonElement string name = default; string description = default; string region = default; - ElasticFilterType? type = default; + Type? type = default; bool? includeByDefault = default; IReadOnlyList rules = default; IDictionary serializedAdditionalRawData = default; @@ -148,7 +148,7 @@ internal static ElasticTrafficFilter DeserializeElasticTrafficFilter(JsonElement { continue; } - type = new ElasticFilterType(property.Value.GetString()); + type = new Type(property.Value.GetString()); continue; } if (property.NameEquals("includeByDefault"u8)) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilter.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilter.cs index fe30e234fc06..37ccd9ef202e 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilter.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilter.cs @@ -56,18 +56,18 @@ internal ElasticTrafficFilter() /// Name of the elastic filter. /// Description of the elastic filter. /// Region of the elastic filter. - /// Type of the elastic filter. - /// IncludeByDefault for the elastic filter. + /// Type of the elastic filter. + /// IncludeByDefault for the elastic filter. /// Rules in the elastic filter. /// Keeps track of any properties unknown to the library. - internal ElasticTrafficFilter(string id, string name, string description, string region, ElasticFilterType? filterType, bool? doesIncludeByDefault, IReadOnlyList rules, IDictionary serializedAdditionalRawData) + internal ElasticTrafficFilter(string id, string name, string description, string region, Type? type, bool? includeByDefault, IReadOnlyList rules, IDictionary serializedAdditionalRawData) { Id = id; Name = name; Description = description; Region = region; - FilterType = filterType; - DoesIncludeByDefault = doesIncludeByDefault; + Type = type; + IncludeByDefault = includeByDefault; Rules = rules; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -81,9 +81,9 @@ internal ElasticTrafficFilter(string id, string name, string description, string /// Region of the elastic filter. public string Region { get; } /// Type of the elastic filter. - public ElasticFilterType? FilterType { get; } + public Type? Type { get; } /// IncludeByDefault for the elastic filter. - public bool? DoesIncludeByDefault { get; } + public bool? IncludeByDefault { get; } /// Rules in the elastic filter. public IReadOnlyList Rules { get; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterListResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterResponse.Serialization.cs similarity index 68% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterListResult.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterResponse.Serialization.cs index 8d8f59eb5b7d..558e5c50b292 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterListResult.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterResponse.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticTrafficFilterListResult : IUtf8JsonSerializable, IJsonModel + public partial class ElasticTrafficFilterResponse : 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(ElasticTrafficFilterListResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ElasticTrafficFilterResponse)} does not support writing '{format}' format."); } if (Optional.IsCollectionDefined(Rulesets)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticTrafficFilterListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ElasticTrafficFilterResponse 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(ElasticTrafficFilterListResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ElasticTrafficFilterResponse)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticTrafficFilterListResult(document.RootElement, options); + return DeserializeElasticTrafficFilterResponse(document.RootElement, options); } - internal static ElasticTrafficFilterListResult DeserializeElasticTrafficFilterListResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static ElasticTrafficFilterResponse DeserializeElasticTrafficFilterResponse(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -106,38 +106,38 @@ internal static ElasticTrafficFilterListResult DeserializeElasticTrafficFilterLi } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticTrafficFilterListResult(rulesets ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ElasticTrafficFilterResponse(rulesets ?? 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticTrafficFilterListResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticTrafficFilterResponse)} does not support writing '{options.Format}' format."); } } - ElasticTrafficFilterListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ElasticTrafficFilterResponse 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 DeserializeElasticTrafficFilterListResult(document.RootElement, options); + return DeserializeElasticTrafficFilterResponse(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticTrafficFilterListResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticTrafficFilterResponse)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterListResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterResponse.cs similarity index 87% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterListResult.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterResponse.cs index ed65740c0e9b..16f84ea28ab3 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterListResult.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTrafficFilterResponse.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// List of elastic traffic filters in the account. - public partial class ElasticTrafficFilterListResult + public partial class ElasticTrafficFilterResponse { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ElasticTrafficFilterListResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticTrafficFilterListResult() + /// Initializes a new instance of . + internal ElasticTrafficFilterResponse() { Rulesets = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// List of elastic traffic filters in the account. /// Keeps track of any properties unknown to the library. - internal ElasticTrafficFilterListResult(IReadOnlyList rulesets, IDictionary serializedAdditionalRawData) + internal ElasticTrafficFilterResponse(IReadOnlyList rulesets, IDictionary serializedAdditionalRawData) { Rulesets = rulesets; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListFormat.Serialization.cs similarity index 65% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionProperties.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListFormat.Serialization.cs index cc523b10bc0c..60596c647a9b 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionProperties.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListFormat.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - internal partial class ElasticVersionProperties : IUtf8JsonSerializable, IJsonModel + public partial class ElasticVersionListFormat : 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, 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(ElasticVersionProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ElasticVersionListFormat)} does not support writing '{format}' format."); } - if (Optional.IsDefined(AvailableVersion)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("version"u8); - writer.WriteStringValue(AvailableVersion); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticVersionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ElasticVersionListFormat 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(ElasticVersionProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ElasticVersionListFormat)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticVersionProperties(document.RootElement, options); + return DeserializeElasticVersionListFormat(document.RootElement, options); } - internal static ElasticVersionProperties DeserializeElasticVersionProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static ElasticVersionListFormat DeserializeElasticVersionListFormat(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,14 +76,18 @@ internal static ElasticVersionProperties DeserializeElasticVersionProperties(Jso { return null; } - string version = default; + ElasticVersionListProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("version"u8)) + if (property.NameEquals("properties"u8)) { - version = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticVersionListProperties.DeserializeElasticVersionListProperties(property.Value, options); continue; } if (options.Format != "W") @@ -92,38 +96,38 @@ internal static ElasticVersionProperties DeserializeElasticVersionProperties(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticVersionProperties(version, serializedAdditionalRawData); + return new ElasticVersionListFormat(properties, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticVersionProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticVersionListFormat)} does not support writing '{options.Format}' format."); } } - ElasticVersionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ElasticVersionListFormat 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 DeserializeElasticVersionProperties(document.RootElement, options); + return DeserializeElasticVersionListFormat(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticVersionProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ElasticVersionListFormat)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersion.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListFormat.cs similarity index 83% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersion.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListFormat.cs index 5c449faf2915..8e2586509636 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersion.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListFormat.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Elastic Version List Format. - public partial class ElasticVersion + public partial class ElasticVersionListFormat { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +45,26 @@ public partial class ElasticVersion /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticVersion() + /// Initializes a new instance of . + internal ElasticVersionListFormat() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Elastic Version Properties. /// Keeps track of any properties unknown to the library. - internal ElasticVersion(ElasticVersionProperties properties, IDictionary serializedAdditionalRawData) + internal ElasticVersionListFormat(ElasticVersionListProperties properties, IDictionary serializedAdditionalRawData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Elastic Version Properties. - internal ElasticVersionProperties Properties { get; } + internal ElasticVersionListProperties Properties { get; } /// Available elastic version of the given region. - public string AvailableVersion + public string Version { - get => Properties?.AvailableVersion; + get => Properties?.Version; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListProperties.Serialization.cs new file mode 100644 index 000000000000..da94b1a811cd --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListProperties.Serialization.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + internal partial class ElasticVersionListProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVersionListProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ElasticVersionListProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVersionListProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVersionListProperties(document.RootElement, options); + } + + internal static ElasticVersionListProperties DeserializeElasticVersionListProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string version = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ElasticVersionListProperties(version, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVersionListProperties)} does not support writing '{options.Format}' format."); + } + } + + ElasticVersionListProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeElasticVersionListProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVersionListProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionProperties.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListProperties.cs similarity index 80% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionProperties.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListProperties.cs index af3872eb52de..f9d7bbaa44e9 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionProperties.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionListProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Elastic Version Properties. - internal partial class ElasticVersionProperties + internal partial class ElasticVersionListProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,21 +45,21 @@ internal partial class ElasticVersionProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticVersionProperties() + /// Initializes a new instance of . + internal ElasticVersionListProperties() { } - /// Initializes a new instance of . - /// Available elastic version of the given region. + /// Initializes a new instance of . + /// Available elastic version of the given region. /// Keeps track of any properties unknown to the library. - internal ElasticVersionProperties(string availableVersion, IDictionary serializedAdditionalRawData) + internal ElasticVersionListProperties(string version, IDictionary serializedAdditionalRawData) { - AvailableVersion = availableVersion; + Version = version; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Available elastic version of the given region. - public string AvailableVersion { get; } + public string Version { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionsListResponse.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionsListResponse.Serialization.cs index 0740cca9b115..baa08838f242 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionsListResponse.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionsListResponse.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ElasticVersionsListResponse)} 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); } + 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 ElasticVersionsListResponse DeserializeElasticVersionsListRespon { 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(ElasticVersion.DeserializeElasticVersion(item, options)); + array.Add(ElasticVersionListFormat.DeserializeElasticVersionListFormat(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 ElasticVersionsListResponse DeserializeElasticVersionsListRespon } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticVersionsListResponse(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ElasticVersionsListResponse(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionsListResponse.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionsListResponse.cs index 6953acda2c31..c3ba4d8c0c27 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionsListResponse.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersionsListResponse.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Elastic.Models { @@ -46,25 +47,34 @@ internal partial class ElasticVersionsListResponse private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ElasticVersionsListResponse() + /// The ElasticVersionListFormat items on this page. + /// is null. + internal ElasticVersionsListResponse(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of a list operation. - /// Link to the next set of results, if any. + /// The ElasticVersionListFormat items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ElasticVersionsListResponse(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ElasticVersionsListResponse(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Results of a list operation. - public IReadOnlyList Value { get; } - /// Link to the next set of results, if any. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal ElasticVersionsListResponse() + { + } + + /// The ElasticVersionListFormat items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserContent.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserContent.Serialization.cs similarity index 74% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserContent.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserContent.Serialization.cs index 3922710f97cb..e05020e5f7fc 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserContent.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticExternalUserContent : IUtf8JsonSerializable, IJsonModel + public partial class ExternalUserContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ElasticExternalUserContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ExternalUserContent)} does not support writing '{format}' format."); } if (Optional.IsDefined(UserName)) @@ -81,19 +81,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticExternalUserContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ExternalUserContent 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(ElasticExternalUserContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ExternalUserContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticExternalUserContent(document.RootElement, options); + return DeserializeExternalUserContent(document.RootElement, options); } - internal static ElasticExternalUserContent DeserializeElasticExternalUserContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static ExternalUserContent DeserializeExternalUserContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -150,7 +150,7 @@ internal static ElasticExternalUserContent DeserializeElasticExternalUserContent } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticExternalUserContent( + return new ExternalUserContent( userName, fullName, password, @@ -159,35 +159,35 @@ internal static ElasticExternalUserContent DeserializeElasticExternalUserContent 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticExternalUserContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ExternalUserContent)} does not support writing '{options.Format}' format."); } } - ElasticExternalUserContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ExternalUserContent 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 DeserializeElasticExternalUserContent(document.RootElement, options); + return DeserializeExternalUserContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticExternalUserContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ExternalUserContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserContent.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserContent.cs similarity index 90% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserContent.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserContent.cs index eac24c9eb8fd..8a5a81c5aaf2 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserContent.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserContent.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// The properties of the request required for creating user on elastic side. - public partial class ElasticExternalUserContent + public partial class ExternalUserContent { /// /// Keeps track of any properties unknown to the library. @@ -45,20 +45,20 @@ public partial class ElasticExternalUserContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticExternalUserContent() + /// Initializes a new instance of . + public ExternalUserContent() { Roles = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Username of the user to be created or updated. /// Full name of the user to be created or updated. /// Password of the user to be created or updated. /// Email id of the user to be created or updated. /// Roles to be assigned for created or updated user. /// Keeps track of any properties unknown to the library. - internal ElasticExternalUserContent(string userName, string fullName, string password, string emailId, IList roles, IDictionary serializedAdditionalRawData) + internal ExternalUserContent(string userName, string fullName, string password, string emailId, IList roles, IDictionary serializedAdditionalRawData) { UserName = userName; FullName = fullName; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserCreationResponse.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserCreationResponse.Serialization.cs new file mode 100644 index 000000000000..058f623d8c14 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserCreationResponse.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + public partial class ExternalUserCreationResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExternalUserCreationResponse)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Created)) + { + writer.WritePropertyName("created"u8); + writer.WriteBooleanValue(Created.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExternalUserCreationResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExternalUserCreationResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExternalUserCreationResponse(document.RootElement, options); + } + + internal static ExternalUserCreationResponse DeserializeExternalUserCreationResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? created = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("created"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + created = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExternalUserCreationResponse(created, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(ExternalUserCreationResponse)} does not support writing '{options.Format}' format."); + } + } + + ExternalUserCreationResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExternalUserCreationResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExternalUserCreationResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserCreationResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserCreationResponse.cs similarity index 81% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserCreationResult.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserCreationResponse.cs index 96408b2353a5..f91622e26eff 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticExternalUserCreationResult.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ExternalUserCreationResponse.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// The properties of the response we got from elastic while creating external user. - public partial class ElasticExternalUserCreationResult + public partial class ExternalUserCreationResponse { /// /// Keeps track of any properties unknown to the library. @@ -45,21 +45,21 @@ public partial class ElasticExternalUserCreationResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticExternalUserCreationResult() + /// Initializes a new instance of . + internal ExternalUserCreationResponse() { } - /// Initializes a new instance of . - /// Shows if user is created or updated. + /// Initializes a new instance of . + /// Shows if user is created or updated. /// Keeps track of any properties unknown to the library. - internal ElasticExternalUserCreationResult(bool? isCreated, IDictionary serializedAdditionalRawData) + internal ExternalUserCreationResponse(bool? created, IDictionary serializedAdditionalRawData) { - IsCreated = isCreated; + Created = created; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Shows if user is created or updated. - public bool? IsCreated { get; } + public bool? Created { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticFilteringTag.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/FilteringTag.Serialization.cs similarity index 68% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticFilteringTag.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/FilteringTag.Serialization.cs index 3c759f2f8da5..c4aa1d012a00 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticFilteringTag.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/FilteringTag.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticFilteringTag : IUtf8JsonSerializable, IJsonModel + public partial class FilteringTag : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ElasticFilteringTag)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FilteringTag)} does not support writing '{format}' format."); } if (Optional.IsDefined(Name)) @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticFilteringTag IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FilteringTag 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(ElasticFilteringTag)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FilteringTag)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticFilteringTag(document.RootElement, options); + return DeserializeFilteringTag(document.RootElement, options); } - internal static ElasticFilteringTag DeserializeElasticFilteringTag(JsonElement element, ModelReaderWriterOptions options = null) + internal static FilteringTag DeserializeFilteringTag(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -88,7 +88,7 @@ internal static ElasticFilteringTag DeserializeElasticFilteringTag(JsonElement e } string name = default; string value = default; - FilteringTagAction? action = default; + TagAction? action = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -109,7 +109,7 @@ internal static ElasticFilteringTag DeserializeElasticFilteringTag(JsonElement e { continue; } - action = new FilteringTagAction(property.Value.GetString()); + action = new TagAction(property.Value.GetString()); continue; } if (options.Format != "W") @@ -118,38 +118,38 @@ internal static ElasticFilteringTag DeserializeElasticFilteringTag(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticFilteringTag(name, value, action, serializedAdditionalRawData); + return new FilteringTag(name, value, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticFilteringTag)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FilteringTag)} does not support writing '{options.Format}' format."); } } - ElasticFilteringTag IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FilteringTag 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 DeserializeElasticFilteringTag(document.RootElement, options); + return DeserializeFilteringTag(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticFilteringTag)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FilteringTag)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticFilteringTag.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/FilteringTag.cs similarity index 84% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticFilteringTag.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/FilteringTag.cs index 2b4931856e71..7fd058eea510 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticFilteringTag.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/FilteringTag.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from being monitored. - public partial class ElasticFilteringTag + public partial class FilteringTag { /// /// Keeps track of any properties unknown to the library. @@ -45,17 +45,17 @@ public partial class ElasticFilteringTag /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticFilteringTag() + /// Initializes a new instance of . + public FilteringTag() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name (also known as the key) of the tag. /// The value of the tag. /// Valid actions for a filtering tag. /// Keeps track of any properties unknown to the library. - internal ElasticFilteringTag(string name, string value, FilteringTagAction? action, IDictionary serializedAdditionalRawData) + internal FilteringTag(string name, string value, TagAction? action, IDictionary serializedAdditionalRawData) { Name = name; Value = value; @@ -68,6 +68,6 @@ internal ElasticFilteringTag(string name, string value, FilteringTagAction? acti /// The value of the tag. public string Value { get; set; } /// Valid actions for a filtering tag. - public FilteringTagAction? Action { get; set; } + public TagAction? Action { get; set; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/FilteringTagAction.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/FilteringTagAction.cs deleted file mode 100644 index 15fe348d29bb..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/FilteringTagAction.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.Elastic.Models -{ - /// Valid actions for a filtering tag. Exclusion takes priority over inclusion. - public readonly partial struct FilteringTagAction : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public FilteringTagAction(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string IncludeValue = "Include"; - private const string ExcludeValue = "Exclude"; - - /// Include. - public static FilteringTagAction Include { get; } = new FilteringTagAction(IncludeValue); - /// Exclude. - public static FilteringTagAction Exclude { get; } = new FilteringTagAction(ExcludeValue); - /// Determines if two values are the same. - public static bool operator ==(FilteringTagAction left, FilteringTagAction right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(FilteringTagAction left, FilteringTagAction right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator FilteringTagAction(string value) => new FilteringTagAction(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is FilteringTagAction other && Equals(other); - /// - public bool Equals(FilteringTagAction 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/HostingType.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/HostingType.cs new file mode 100644 index 000000000000..4b401d980c89 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/HostingType.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.Elastic.Models +{ + /// Hosting type of the monitor resource - either Hosted deployments or Serverless Projects. + public readonly partial struct HostingType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HostingType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HostedValue = "Hosted"; + private const string ServerlessValue = "Serverless"; + + /// Hosted. + public static HostingType Hosted { get; } = new HostingType(HostedValue); + /// Serverless. + public static HostingType Serverless { get; } = new HostingType(ServerlessValue); + /// Determines if two values are the same. + public static bool operator ==(HostingType left, HostingType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HostingType left, HostingType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HostingType(string value) => new HostingType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HostingType other && Equals(other); + /// + public bool Equals(HostingType 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/LiftrResourceCategory.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/LiftrResourceCategory.cs new file mode 100644 index 000000000000..41b535fb2c97 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/LiftrResourceCategory.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.Elastic.Models +{ + /// The LiftrResourceCategories. + public readonly partial struct LiftrResourceCategory : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LiftrResourceCategory(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string MonitorLogsValue = "MonitorLogs"; + + /// Unknown. + public static LiftrResourceCategory Unknown { get; } = new LiftrResourceCategory(UnknownValue); + /// MonitorLogs. + public static LiftrResourceCategory MonitorLogs { get; } = new LiftrResourceCategory(MonitorLogsValue); + /// Determines if two values are the same. + public static bool operator ==(LiftrResourceCategory left, LiftrResourceCategory right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LiftrResourceCategory left, LiftrResourceCategory right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LiftrResourceCategory(string value) => new LiftrResourceCategory(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LiftrResourceCategory other && Equals(other); + /// + public bool Equals(LiftrResourceCategory 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticLogRules.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/LogRules.Serialization.cs similarity index 68% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticLogRules.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/LogRules.Serialization.cs index 783f3c462647..0aba136e1b92 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticLogRules.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/LogRules.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticLogRules : IUtf8JsonSerializable, IJsonModel + public partial class LogRules : 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,26 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// 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(ElasticLogRules)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LogRules)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ShouldAadLogsBeSent)) + if (Optional.IsDefined(SendAadLogs)) { writer.WritePropertyName("sendAadLogs"u8); - writer.WriteBooleanValue(ShouldAadLogsBeSent.Value); + writer.WriteBooleanValue(SendAadLogs.Value); } - if (Optional.IsDefined(ShouldSubscriptionLogsBeSent)) + if (Optional.IsDefined(SendSubscriptionLogs)) { writer.WritePropertyName("sendSubscriptionLogs"u8); - writer.WriteBooleanValue(ShouldSubscriptionLogsBeSent.Value); + writer.WriteBooleanValue(SendSubscriptionLogs.Value); } - if (Optional.IsDefined(ShouldActivityLogsBeSent)) + if (Optional.IsDefined(SendActivityLogs)) { writer.WritePropertyName("sendActivityLogs"u8); - writer.WriteBooleanValue(ShouldActivityLogsBeSent.Value); + writer.WriteBooleanValue(SendActivityLogs.Value); } if (Optional.IsCollectionDefined(FilteringTags)) { @@ -76,19 +76,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticLogRules IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LogRules 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(ElasticLogRules)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LogRules)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticLogRules(document.RootElement, options); + return DeserializeLogRules(document.RootElement, options); } - internal static ElasticLogRules DeserializeElasticLogRules(JsonElement element, ModelReaderWriterOptions options = null) + internal static LogRules DeserializeLogRules(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -99,7 +99,7 @@ internal static ElasticLogRules DeserializeElasticLogRules(JsonElement element, bool? sendAadLogs = default; bool? sendSubscriptionLogs = default; bool? sendActivityLogs = default; - IList filteringTags = default; + IList filteringTags = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -137,10 +137,10 @@ internal static ElasticLogRules DeserializeElasticLogRules(JsonElement element, { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ElasticFilteringTag.DeserializeElasticFilteringTag(item, options)); + array.Add(FilteringTag.DeserializeFilteringTag(item, options)); } filteringTags = array; continue; @@ -151,38 +151,38 @@ internal static ElasticLogRules DeserializeElasticLogRules(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticLogRules(sendAadLogs, sendSubscriptionLogs, sendActivityLogs, filteringTags ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new LogRules(sendAadLogs, sendSubscriptionLogs, sendActivityLogs, filteringTags ?? 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticLogRules)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LogRules)} does not support writing '{options.Format}' format."); } } - ElasticLogRules IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LogRules 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 DeserializeElasticLogRules(document.RootElement, options); + return DeserializeLogRules(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticLogRules)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LogRules)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticLogRules.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/LogRules.cs similarity index 68% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticLogRules.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/LogRules.cs index ad5f1d1fb687..88cc1fdd2a9a 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticLogRules.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/LogRules.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Set of rules for sending logs for the Monitor resource. - public partial class ElasticLogRules + public partial class LogRules { /// /// Keeps track of any properties unknown to the library. @@ -45,34 +45,34 @@ public partial class ElasticLogRules /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticLogRules() + /// Initializes a new instance of . + public LogRules() { - FilteringTags = new ChangeTrackingList(); + FilteringTags = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// Flag specifying if AAD logs should be sent for the Monitor resource. - /// Flag specifying if subscription logs should be sent for the Monitor resource. - /// Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. + /// Initializes a new instance of . + /// Flag specifying if AAD logs should be sent for the Monitor resource. + /// Flag specifying if subscription logs should be sent for the Monitor resource. + /// Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. /// List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. /// Keeps track of any properties unknown to the library. - internal ElasticLogRules(bool? shouldAadLogsBeSent, bool? shouldSubscriptionLogsBeSent, bool? shouldActivityLogsBeSent, IList filteringTags, IDictionary serializedAdditionalRawData) + internal LogRules(bool? sendAadLogs, bool? sendSubscriptionLogs, bool? sendActivityLogs, IList filteringTags, IDictionary serializedAdditionalRawData) { - ShouldAadLogsBeSent = shouldAadLogsBeSent; - ShouldSubscriptionLogsBeSent = shouldSubscriptionLogsBeSent; - ShouldActivityLogsBeSent = shouldActivityLogsBeSent; + SendAadLogs = sendAadLogs; + SendSubscriptionLogs = sendSubscriptionLogs; + SendActivityLogs = sendActivityLogs; FilteringTags = filteringTags; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Flag specifying if AAD logs should be sent for the Monitor resource. - public bool? ShouldAadLogsBeSent { get; set; } + public bool? SendAadLogs { get; set; } /// Flag specifying if subscription logs should be sent for the Monitor resource. - public bool? ShouldSubscriptionLogsBeSent { get; set; } + public bool? SendSubscriptionLogs { get; set; } /// Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. - public bool? ShouldActivityLogsBeSent { get; set; } + public bool? SendActivityLogs { get; set; } /// List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. - public IList FilteringTags { get; } + public IList FilteringTags { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfo.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfo.Serialization.cs index def6489c317b..3563607417e6 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfo.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfo.Serialization.cs @@ -10,7 +10,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Elastic.Models { @@ -38,7 +37,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(MarketplaceSubscription)) { writer.WritePropertyName("marketplaceSubscription"u8); - JsonSerializer.Serialize(writer, MarketplaceSubscription); + writer.WriteObjectValue(MarketplaceSubscription, options); } if (Optional.IsDefined(MarketplaceName)) { @@ -60,10 +59,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("billedAzureSubscriptionId"u8); writer.WriteStringValue(BilledAzureSubscriptionId); } - if (Optional.IsDefined(IsSubscribed)) + if (Optional.IsDefined(Subscribed)) { writer.WritePropertyName("subscribed"u8); - writer.WriteBooleanValue(IsSubscribed.Value); + writer.WriteBooleanValue(Subscribed.Value); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -102,7 +101,7 @@ internal static MarketplaceSaaSInfo DeserializeMarketplaceSaaSInfo(JsonElement e { return null; } - SubResource marketplaceSubscription = default; + MarketplaceSaaSInfoMarketplaceSubscription marketplaceSubscription = default; string marketplaceName = default; string marketplaceResourceId = default; string marketplaceStatus = default; @@ -118,7 +117,7 @@ internal static MarketplaceSaaSInfo DeserializeMarketplaceSaaSInfo(JsonElement e { continue; } - marketplaceSubscription = JsonSerializer.Deserialize(property.Value.GetRawText()); + marketplaceSubscription = MarketplaceSaaSInfoMarketplaceSubscription.DeserializeMarketplaceSaaSInfoMarketplaceSubscription(property.Value, options); continue; } if (property.NameEquals("marketplaceName"u8)) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfo.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfo.cs index f25c58dc7a36..d78edd4d2c3b 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfo.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfo.cs @@ -7,8 +7,6 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Elastic.Models { @@ -58,27 +56,21 @@ internal MarketplaceSaaSInfo() /// Marketplace Subscription Details: Resource URI. /// Marketplace Subscription Details: SaaS Subscription Status. /// The Azure Subscription ID to which the Marketplace Subscription belongs and gets billed into. - /// Flag specifying if the Marketplace status is subscribed or not. + /// Flag specifying if the Marketplace status is subscribed or not. /// Keeps track of any properties unknown to the library. - internal MarketplaceSaaSInfo(SubResource marketplaceSubscription, string marketplaceName, string marketplaceResourceId, string marketplaceStatus, string billedAzureSubscriptionId, bool? isSubscribed, IDictionary serializedAdditionalRawData) + internal MarketplaceSaaSInfo(MarketplaceSaaSInfoMarketplaceSubscription marketplaceSubscription, string marketplaceName, string marketplaceResourceId, string marketplaceStatus, string billedAzureSubscriptionId, bool? subscribed, IDictionary serializedAdditionalRawData) { MarketplaceSubscription = marketplaceSubscription; MarketplaceName = marketplaceName; MarketplaceResourceId = marketplaceResourceId; MarketplaceStatus = marketplaceStatus; BilledAzureSubscriptionId = billedAzureSubscriptionId; - IsSubscribed = isSubscribed; + Subscribed = subscribed; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Marketplace Subscription. - internal SubResource MarketplaceSubscription { get; } - /// Gets Id. - public ResourceIdentifier MarketplaceSubscriptionId - { - get => MarketplaceSubscription?.Id; - } - + public MarketplaceSaaSInfoMarketplaceSubscription MarketplaceSubscription { get; } /// Marketplace Subscription Details: SAAS Name. public string MarketplaceName { get; } /// Marketplace Subscription Details: Resource URI. @@ -88,6 +80,6 @@ public ResourceIdentifier MarketplaceSubscriptionId /// The Azure Subscription ID to which the Marketplace Subscription belongs and gets billed into. public string BilledAzureSubscriptionId { get; } /// Flag specifying if the Marketplace status is subscribed or not. - public bool? IsSubscribed { get; } + public bool? Subscribed { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfoMarketplaceSubscription.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfoMarketplaceSubscription.Serialization.cs new file mode 100644 index 000000000000..9eaf33a4ecc6 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfoMarketplaceSubscription.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + public partial class MarketplaceSaaSInfoMarketplaceSubscription : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MarketplaceSaaSInfoMarketplaceSubscription)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(PublisherId)) + { + writer.WritePropertyName("publisherId"u8); + writer.WriteStringValue(PublisherId); + } + if (Optional.IsDefined(OfferId)) + { + writer.WritePropertyName("offerId"u8); + writer.WriteStringValue(OfferId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MarketplaceSaaSInfoMarketplaceSubscription IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MarketplaceSaaSInfoMarketplaceSubscription)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMarketplaceSaaSInfoMarketplaceSubscription(document.RootElement, options); + } + + internal static MarketplaceSaaSInfoMarketplaceSubscription DeserializeMarketplaceSaaSInfoMarketplaceSubscription(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string publisherId = default; + string offerId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherId"u8)) + { + publisherId = property.Value.GetString(); + continue; + } + if (property.NameEquals("offerId"u8)) + { + offerId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MarketplaceSaaSInfoMarketplaceSubscription(id, publisherId, offerId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(MarketplaceSaaSInfoMarketplaceSubscription)} does not support writing '{options.Format}' format."); + } + } + + MarketplaceSaaSInfoMarketplaceSubscription IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMarketplaceSaaSInfoMarketplaceSubscription(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MarketplaceSaaSInfoMarketplaceSubscription)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfoMarketplaceSubscription.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfoMarketplaceSubscription.cs new file mode 100644 index 000000000000..09772bb688d9 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MarketplaceSaaSInfoMarketplaceSubscription.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// Marketplace Subscription. + public partial class MarketplaceSaaSInfoMarketplaceSubscription + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MarketplaceSaaSInfoMarketplaceSubscription() + { + } + + /// Initializes a new instance of . + /// Marketplace Subscription Id. This is a GUID-formatted string. + /// Publisher Id of the Marketplace offer. + /// Offer Id of the Marketplace offer,. + /// Keeps track of any properties unknown to the library. + internal MarketplaceSaaSInfoMarketplaceSubscription(string id, string publisherId, string offerId, IDictionary serializedAdditionalRawData) + { + Id = id; + PublisherId = publisherId; + OfferId = offerId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Marketplace Subscription Id. This is a GUID-formatted string. + public string Id { get; } + /// Publisher Id of the Marketplace offer. + public string PublisherId { get; } + /// Offer Id of the Marketplace offer,. + public string OfferId { get; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitorProperties.Serialization.cs similarity index 70% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorProperties.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitorProperties.Serialization.cs index 18dd8e3d4c22..568413483667 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorProperties.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitorProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticMonitorProperties : IUtf8JsonSerializable, IJsonModel + public partial class MonitorProperties : 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, 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(ElasticMonitorProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MonitorProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ProvisioningState)) + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); writer.WriteStringValue(ProvisioningState.Value.ToString()); @@ -94,10 +94,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("liftrResourcePreference"u8); writer.WriteNumberValue(LiftrResourcePreference.Value); } - if (Optional.IsDefined(IsApiKeyGenerated)) + if (Optional.IsDefined(GenerateApiKey)) { writer.WritePropertyName("generateApiKey"u8); - writer.WriteBooleanValue(IsApiKeyGenerated.Value); + writer.WriteBooleanValue(GenerateApiKey.Value); + } + if (Optional.IsDefined(HostingType)) + { + writer.WritePropertyName("hostingType"u8); + writer.WriteStringValue(HostingType.Value.ToString()); + } + if (Optional.IsDefined(ProjectDetails)) + { + writer.WritePropertyName("projectDetails"u8); + writer.WriteObjectValue(ProjectDetails, options); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -116,19 +126,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticMonitorProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MonitorProperties 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(ElasticMonitorProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MonitorProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticMonitorProperties(document.RootElement, options); + return DeserializeMonitorProperties(document.RootElement, options); } - internal static ElasticMonitorProperties DeserializeElasticMonitorProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static MonitorProperties DeserializeMonitorProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -136,19 +146,21 @@ internal static ElasticMonitorProperties DeserializeElasticMonitorProperties(Jso { return null; } - ElasticProvisioningState? provisioningState = default; - ElasticMonitoringStatus? monitoringStatus = default; - ElasticCloudProperties elasticProperties = default; - ElasticUserInfo userInfo = default; - ElasticPlanDetails planDetails = default; + ProvisioningState? provisioningState = default; + MonitoringStatus? monitoringStatus = default; + ElasticProperties elasticProperties = default; + UserInfo userInfo = default; + PlanDetails planDetails = default; string version = default; string subscriptionState = default; string saaSAzureSubscriptionStatus = default; string sourceCampaignName = default; string sourceCampaignId = default; - ElasticLiftrResourceCategory? liftrResourceCategory = default; + LiftrResourceCategory? liftrResourceCategory = default; int? liftrResourcePreference = default; bool? generateApiKey = default; + HostingType? hostingType = default; + ProjectDetails projectDetails = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -159,7 +171,7 @@ internal static ElasticMonitorProperties DeserializeElasticMonitorProperties(Jso { continue; } - provisioningState = new ElasticProvisioningState(property.Value.GetString()); + provisioningState = new ProvisioningState(property.Value.GetString()); continue; } if (property.NameEquals("monitoringStatus"u8)) @@ -168,7 +180,7 @@ internal static ElasticMonitorProperties DeserializeElasticMonitorProperties(Jso { continue; } - monitoringStatus = new ElasticMonitoringStatus(property.Value.GetString()); + monitoringStatus = new MonitoringStatus(property.Value.GetString()); continue; } if (property.NameEquals("elasticProperties"u8)) @@ -177,7 +189,7 @@ internal static ElasticMonitorProperties DeserializeElasticMonitorProperties(Jso { continue; } - elasticProperties = ElasticCloudProperties.DeserializeElasticCloudProperties(property.Value, options); + elasticProperties = ElasticProperties.DeserializeElasticProperties(property.Value, options); continue; } if (property.NameEquals("userInfo"u8)) @@ -186,7 +198,7 @@ internal static ElasticMonitorProperties DeserializeElasticMonitorProperties(Jso { continue; } - userInfo = ElasticUserInfo.DeserializeElasticUserInfo(property.Value, options); + userInfo = UserInfo.DeserializeUserInfo(property.Value, options); continue; } if (property.NameEquals("planDetails"u8)) @@ -195,7 +207,7 @@ internal static ElasticMonitorProperties DeserializeElasticMonitorProperties(Jso { continue; } - planDetails = ElasticPlanDetails.DeserializeElasticPlanDetails(property.Value, options); + planDetails = PlanDetails.DeserializePlanDetails(property.Value, options); continue; } if (property.NameEquals("version"u8)) @@ -229,7 +241,7 @@ internal static ElasticMonitorProperties DeserializeElasticMonitorProperties(Jso { continue; } - liftrResourceCategory = new ElasticLiftrResourceCategory(property.Value.GetString()); + liftrResourceCategory = new LiftrResourceCategory(property.Value.GetString()); continue; } if (property.NameEquals("liftrResourcePreference"u8)) @@ -250,13 +262,31 @@ internal static ElasticMonitorProperties DeserializeElasticMonitorProperties(Jso generateApiKey = property.Value.GetBoolean(); continue; } + if (property.NameEquals("hostingType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hostingType = new HostingType(property.Value.GetString()); + continue; + } + if (property.NameEquals("projectDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + projectDetails = ProjectDetails.DeserializeProjectDetails(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticMonitorProperties( + return new MonitorProperties( provisioningState, monitoringStatus, elasticProperties, @@ -270,38 +300,40 @@ internal static ElasticMonitorProperties DeserializeElasticMonitorProperties(Jso liftrResourceCategory, liftrResourcePreference, generateApiKey, + hostingType, + projectDetails, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticMonitorProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MonitorProperties)} does not support writing '{options.Format}' format."); } } - ElasticMonitorProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MonitorProperties 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 DeserializeElasticMonitorProperties(document.RootElement, options); + return DeserializeMonitorProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticMonitorProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MonitorProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorProperties.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitorProperties.cs similarity index 70% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorProperties.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitorProperties.cs index 2cb3f2e7f6ab..942785edc909 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticMonitorProperties.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitorProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Properties specific to the monitor resource. - public partial class ElasticMonitorProperties + public partial class MonitorProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,12 +45,12 @@ public partial class ElasticMonitorProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticMonitorProperties() + /// Initializes a new instance of . + public MonitorProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Provisioning state of the monitor resource. /// Flag specifying if the resource monitoring is enabled or disabled. /// Elastic cloud properties. @@ -63,9 +63,11 @@ public ElasticMonitorProperties() /// A unique identifier associated with the campaign. /// /// The priority of the resource. - /// Flag to determine if User API Key has to be generated and shared. + /// Flag to determine if User API Key has to be generated and shared. + /// Hosting type of the monitor resource - either Hosted deployments OR Serverless Projects. + /// Project details of the monitor resource IF it belongs to Serverless offer kind. /// Keeps track of any properties unknown to the library. - internal ElasticMonitorProperties(ElasticProvisioningState? provisioningState, ElasticMonitoringStatus? monitoringStatus, ElasticCloudProperties elasticProperties, ElasticUserInfo userInfo, ElasticPlanDetails planDetails, string version, string subscriptionState, string saaSAzureSubscriptionStatus, string sourceCampaignName, string sourceCampaignId, ElasticLiftrResourceCategory? liftrResourceCategory, int? liftrResourcePreference, bool? isApiKeyGenerated, IDictionary serializedAdditionalRawData) + internal MonitorProperties(ProvisioningState? provisioningState, MonitoringStatus? monitoringStatus, ElasticProperties elasticProperties, UserInfo userInfo, PlanDetails planDetails, string version, string subscriptionState, string saaSAzureSubscriptionStatus, string sourceCampaignName, string sourceCampaignId, LiftrResourceCategory? liftrResourceCategory, int? liftrResourcePreference, bool? generateApiKey, HostingType? hostingType, ProjectDetails projectDetails, IDictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; MonitoringStatus = monitoringStatus; @@ -79,20 +81,22 @@ internal ElasticMonitorProperties(ElasticProvisioningState? provisioningState, E SourceCampaignId = sourceCampaignId; LiftrResourceCategory = liftrResourceCategory; LiftrResourcePreference = liftrResourcePreference; - IsApiKeyGenerated = isApiKeyGenerated; + GenerateApiKey = generateApiKey; + HostingType = hostingType; + ProjectDetails = projectDetails; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning state of the monitor resource. - public ElasticProvisioningState? ProvisioningState { get; set; } + public ProvisioningState? ProvisioningState { get; } /// Flag specifying if the resource monitoring is enabled or disabled. - public ElasticMonitoringStatus? MonitoringStatus { get; set; } + public MonitoringStatus? MonitoringStatus { get; set; } /// Elastic cloud properties. - public ElasticCloudProperties ElasticProperties { get; set; } + public ElasticProperties ElasticProperties { get; set; } /// User information. - public ElasticUserInfo UserInfo { get; set; } + public UserInfo UserInfo { get; set; } /// Plan details of the monitor resource. - public ElasticPlanDetails PlanDetails { get; set; } + public PlanDetails PlanDetails { get; set; } /// Version of elastic of the monitor resource. public string Version { get; set; } /// State of the Azure Subscription containing the monitor resource. @@ -104,10 +108,14 @@ internal ElasticMonitorProperties(ElasticProvisioningState? provisioningState, E /// A unique identifier associated with the campaign. public string SourceCampaignId { get; set; } /// Gets the liftr resource category. - public ElasticLiftrResourceCategory? LiftrResourceCategory { get; } + public LiftrResourceCategory? LiftrResourceCategory { get; } /// The priority of the resource. public int? LiftrResourcePreference { get; } /// Flag to determine if User API Key has to be generated and shared. - public bool? IsApiKeyGenerated { get; set; } + public bool? GenerateApiKey { get; set; } + /// Hosting type of the monitor resource - either Hosted deployments OR Serverless Projects. + public HostingType? HostingType { get; set; } + /// Project details of the monitor resource IF it belongs to Serverless offer kind. + public ProjectDetails ProjectDetails { get; set; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceInfo.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResource.Serialization.cs similarity index 67% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceInfo.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResource.Serialization.cs index 1d3ecd4b039c..be39efca1dd2 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceInfo.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResource.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class MonitoredResourceInfo : IUtf8JsonSerializable, IJsonModel + public partial class MonitoredResource : 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(MonitoredResourceInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MonitoredResource)} does not support writing '{format}' format."); } if (Optional.IsDefined(Id)) @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MonitoredResourceInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MonitoredResource 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(MonitoredResourceInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MonitoredResource)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMonitoredResourceInfo(document.RootElement, options); + return DeserializeMonitoredResource(document.RootElement, options); } - internal static MonitoredResourceInfo DeserializeMonitoredResourceInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static MonitoredResource DeserializeMonitoredResource(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -86,8 +86,8 @@ internal static MonitoredResourceInfo DeserializeMonitoredResourceInfo(JsonEleme { return null; } - ResourceIdentifier id = default; - SendingLogsStatus? sendingLogs = default; + string id = default; + SendingLog? sendingLogs = default; string reasonForLogsStatus = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -95,11 +95,7 @@ internal static MonitoredResourceInfo DeserializeMonitoredResourceInfo(JsonEleme { if (property.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - id = new ResourceIdentifier(property.Value.GetString()); + id = property.Value.GetString(); continue; } if (property.NameEquals("sendingLogs"u8)) @@ -108,7 +104,7 @@ internal static MonitoredResourceInfo DeserializeMonitoredResourceInfo(JsonEleme { continue; } - sendingLogs = new SendingLogsStatus(property.Value.GetString()); + sendingLogs = new SendingLog(property.Value.GetString()); continue; } if (property.NameEquals("reasonForLogsStatus"u8)) @@ -122,38 +118,38 @@ internal static MonitoredResourceInfo DeserializeMonitoredResourceInfo(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new MonitoredResourceInfo(id, sendingLogs, reasonForLogsStatus, serializedAdditionalRawData); + return new MonitoredResource(id, sendingLogs, reasonForLogsStatus, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(MonitoredResourceInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MonitoredResource)} does not support writing '{options.Format}' format."); } } - MonitoredResourceInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MonitoredResource 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 DeserializeMonitoredResourceInfo(document.RootElement, options); + return DeserializeMonitoredResource(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(MonitoredResourceInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MonitoredResource)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceInfo.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResource.cs similarity index 86% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceInfo.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResource.cs index 5cec0924c167..c087d87b7603 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceInfo.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResource.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.Elastic.Models { /// The properties of a resource currently being monitored by the Elastic monitor resource. - public partial class MonitoredResourceInfo + public partial class MonitoredResource { /// /// Keeps track of any properties unknown to the library. @@ -46,17 +45,17 @@ public partial class MonitoredResourceInfo /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal MonitoredResourceInfo() + /// Initializes a new instance of . + internal MonitoredResource() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The ARM id of the resource. /// Flag indicating the status of the resource for sending logs operation to Elastic. /// Reason for why the resource is sending logs (or why it is not sending). /// Keeps track of any properties unknown to the library. - internal MonitoredResourceInfo(ResourceIdentifier id, SendingLogsStatus? sendingLogs, string reasonForLogsStatus, IDictionary serializedAdditionalRawData) + internal MonitoredResource(string id, SendingLog? sendingLogs, string reasonForLogsStatus, IDictionary serializedAdditionalRawData) { Id = id; SendingLogs = sendingLogs; @@ -65,9 +64,9 @@ internal MonitoredResourceInfo(ResourceIdentifier id, SendingLogsStatus? sending } /// The ARM id of the resource. - public ResourceIdentifier Id { get; } + public string Id { get; } /// Flag indicating the status of the resource for sending logs operation to Elastic. - public SendingLogsStatus? SendingLogs { get; } + public SendingLog? SendingLogs { get; } /// Reason for why the resource is sending logs (or why it is not sending). public string ReasonForLogsStatus { get; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceListResponse.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceListResponse.Serialization.cs index ce8e87ecc496..11303bc2b174 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceListResponse.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceListResponse.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(MonitoredResourceListResponse)} 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); } + 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 MonitoredResourceListResponse DeserializeMonitoredResourceListRe { 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(MonitoredResourceInfo.DeserializeMonitoredResourceInfo(item, options)); + array.Add(MonitoredResource.DeserializeMonitoredResource(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 MonitoredResourceListResponse DeserializeMonitoredResourceListRe } } serializedAdditionalRawData = rawDataDictionary; - return new MonitoredResourceListResponse(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new MonitoredResourceListResponse(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceListResponse.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceListResponse.cs index aa49c9427e57..edb42c143845 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceListResponse.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredResourceListResponse.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Elastic.Models { @@ -46,25 +47,34 @@ internal partial class MonitoredResourceListResponse private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal MonitoredResourceListResponse() + /// The MonitoredResource items on this page. + /// is null. + internal MonitoredResourceListResponse(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of a list operation. - /// Link to the next set of results, if any. + /// The MonitoredResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal MonitoredResourceListResponse(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal MonitoredResourceListResponse(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Results of a list operation. - public IReadOnlyList Value { get; } - /// Link to the next set of results, if any. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal MonitoredResourceListResponse() + { + } + + /// The MonitoredResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscription.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscription.Serialization.cs new file mode 100644 index 000000000000..9cb1e52c5afb --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscription.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + public partial class MonitoredSubscription : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MonitoredSubscription)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteStringValue(Error); + } + if (Optional.IsDefined(TagRules)) + { + writer.WritePropertyName("tagRules"u8); + writer.WriteObjectValue(TagRules, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MonitoredSubscription IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MonitoredSubscription)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMonitoredSubscription(document.RootElement, options); + } + + internal static MonitoredSubscription DeserializeMonitoredSubscription(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subscriptionId = default; + Status? status = default; + string error = default; + MonitoringTagRulesProperties tagRules = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new Status(property.Value.GetString()); + continue; + } + if (property.NameEquals("error"u8)) + { + error = property.Value.GetString(); + continue; + } + if (property.NameEquals("tagRules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tagRules = MonitoringTagRulesProperties.DeserializeMonitoringTagRulesProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MonitoredSubscription(subscriptionId, status, error, tagRules, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(MonitoredSubscription)} does not support writing '{options.Format}' format."); + } + } + + MonitoredSubscription IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMonitoredSubscription(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MonitoredSubscription)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscription.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscription.cs new file mode 100644 index 000000000000..3dd4e4aa7b77 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscription.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// The list of subscriptions and it's monitoring status by current Elastic monitor. + public partial class MonitoredSubscription + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The subscriptionId to be monitored. + /// is null. + public MonitoredSubscription(string subscriptionId) + { + Argument.AssertNotNull(subscriptionId, nameof(subscriptionId)); + + SubscriptionId = subscriptionId; + } + + /// Initializes a new instance of . + /// The subscriptionId to be monitored. + /// The state of monitoring. + /// The reason of not monitoring the subscription. + /// Definition of the properties for a TagRules resource. + /// Keeps track of any properties unknown to the library. + internal MonitoredSubscription(string subscriptionId, Status? status, string error, MonitoringTagRulesProperties tagRules, IDictionary serializedAdditionalRawData) + { + SubscriptionId = subscriptionId; + Status = status; + Error = error; + TagRules = tagRules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MonitoredSubscription() + { + } + + /// The subscriptionId to be monitored. + public string SubscriptionId { get; set; } + /// The state of monitoring. + public Status? Status { get; set; } + /// The reason of not monitoring the subscription. + public string Error { get; set; } + /// Definition of the properties for a TagRules resource. + public MonitoringTagRulesProperties TagRules { get; set; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscriptionPropertiesList.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscriptionPropertiesList.Serialization.cs new file mode 100644 index 000000000000..ec64f24f03ee --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscriptionPropertiesList.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + internal partial class MonitoredSubscriptionPropertiesList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MonitoredSubscriptionPropertiesList)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MonitoredSubscriptionPropertiesList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MonitoredSubscriptionPropertiesList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMonitoredSubscriptionPropertiesList(document.RootElement, options); + } + + internal static MonitoredSubscriptionPropertiesList DeserializeMonitoredSubscriptionPropertiesList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MonitoredSubscriptionPropertyData.DeserializeMonitoredSubscriptionPropertyData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MonitoredSubscriptionPropertiesList(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(MonitoredSubscriptionPropertiesList)} does not support writing '{options.Format}' format."); + } + } + + MonitoredSubscriptionPropertiesList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMonitoredSubscriptionPropertiesList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MonitoredSubscriptionPropertiesList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscriptionPropertiesList.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscriptionPropertiesList.cs new file mode 100644 index 000000000000..6b48fc8af2f6 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoredSubscriptionPropertiesList.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// Paged collection of MonitoredSubscriptionProperties items. + internal partial class MonitoredSubscriptionPropertiesList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The MonitoredSubscriptionProperties items on this page. + /// is null. + internal MonitoredSubscriptionPropertiesList(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The MonitoredSubscriptionProperties items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal MonitoredSubscriptionPropertiesList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MonitoredSubscriptionPropertiesList() + { + } + + /// The MonitoredSubscriptionProperties items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringStatus.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringStatus.cs new file mode 100644 index 000000000000..9c0f14a9ed5f --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringStatus.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.Elastic.Models +{ + /// Flag specifying if the resource monitoring is enabled or disabled. + public readonly partial struct MonitoringStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MonitoringStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static MonitoringStatus Enabled { get; } = new MonitoringStatus(EnabledValue); + /// Disabled. + public static MonitoringStatus Disabled { get; } = new MonitoringStatus(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(MonitoringStatus left, MonitoringStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MonitoringStatus left, MonitoringStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MonitoringStatus(string value) => new MonitoringStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MonitoringStatus other && Equals(other); + /// + public bool Equals(MonitoringStatus 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesListResponse.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesListResponse.Serialization.cs index 68328abfc5b6..5a423fadeabc 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesListResponse.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesListResponse.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(MonitoringTagRulesListResponse)} 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); } + 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 MonitoringTagRulesListResponse DeserializeMonitoringTagRulesList { 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(ElasticTagRuleData.DeserializeElasticTagRuleData(item, options)); + array.Add(MonitoringTagRuleData.DeserializeMonitoringTagRuleData(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 MonitoringTagRulesListResponse DeserializeMonitoringTagRulesList } } serializedAdditionalRawData = rawDataDictionary; - return new MonitoringTagRulesListResponse(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new MonitoringTagRulesListResponse(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesListResponse.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesListResponse.cs index 1cb6b8a8844a..52aeb6ccb283 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesListResponse.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesListResponse.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Elastic.Models { @@ -46,25 +47,34 @@ internal partial class MonitoringTagRulesListResponse private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal MonitoringTagRulesListResponse() + /// The MonitoringTagRules items on this page. + /// is null. + internal MonitoringTagRulesListResponse(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of a list operation. - /// Link to the next set of results, if any. + /// The MonitoringTagRules items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal MonitoringTagRulesListResponse(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal MonitoringTagRulesListResponse(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Results of a list operation. - public IReadOnlyList Value { get; } - /// Link to the next set of results, if any. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal MonitoringTagRulesListResponse() + { + } + + /// The MonitoringTagRules items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTagRuleProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesProperties.Serialization.cs similarity index 62% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTagRuleProperties.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesProperties.Serialization.cs index 434726285875..f51dabdee0ef 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTagRuleProperties.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticTagRuleProperties : IUtf8JsonSerializable, IJsonModel + public partial class MonitoringTagRulesProperties : 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, 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(ElasticTagRuleProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MonitoringTagRulesProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ProvisioningState)) + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); writer.WriteStringValue(ProvisioningState.Value.ToString()); @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticTagRuleProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MonitoringTagRulesProperties 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(ElasticTagRuleProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MonitoringTagRulesProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticTagRuleProperties(document.RootElement, options); + return DeserializeMonitoringTagRulesProperties(document.RootElement, options); } - internal static ElasticTagRuleProperties DeserializeElasticTagRuleProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static MonitoringTagRulesProperties DeserializeMonitoringTagRulesProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,8 +81,8 @@ internal static ElasticTagRuleProperties DeserializeElasticTagRuleProperties(Jso { return null; } - ElasticProvisioningState? provisioningState = default; - ElasticLogRules logRules = default; + ProvisioningState? provisioningState = default; + LogRules logRules = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -93,7 +93,7 @@ internal static ElasticTagRuleProperties DeserializeElasticTagRuleProperties(Jso { continue; } - provisioningState = new ElasticProvisioningState(property.Value.GetString()); + provisioningState = new ProvisioningState(property.Value.GetString()); continue; } if (property.NameEquals("logRules"u8)) @@ -102,7 +102,7 @@ internal static ElasticTagRuleProperties DeserializeElasticTagRuleProperties(Jso { continue; } - logRules = ElasticLogRules.DeserializeElasticLogRules(property.Value, options); + logRules = LogRules.DeserializeLogRules(property.Value, options); continue; } if (options.Format != "W") @@ -111,38 +111,38 @@ internal static ElasticTagRuleProperties DeserializeElasticTagRuleProperties(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticTagRuleProperties(provisioningState, logRules, serializedAdditionalRawData); + return new MonitoringTagRulesProperties(provisioningState, logRules, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticTagRuleProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MonitoringTagRulesProperties)} does not support writing '{options.Format}' format."); } } - ElasticTagRuleProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MonitoringTagRulesProperties 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 DeserializeElasticTagRuleProperties(document.RootElement, options); + return DeserializeMonitoringTagRulesProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticTagRuleProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MonitoringTagRulesProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTagRuleProperties.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesProperties.cs similarity index 79% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTagRuleProperties.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesProperties.cs index a395ed5927f6..9ef7903d71c6 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticTagRuleProperties.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/MonitoringTagRulesProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Definition of the properties for a TagRules resource. - public partial class ElasticTagRuleProperties + public partial class MonitoringTagRulesProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ElasticTagRuleProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticTagRuleProperties() + /// Initializes a new instance of . + public MonitoringTagRulesProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Provisioning state of the monitoring tag rules. /// Rules for sending logs. /// Keeps track of any properties unknown to the library. - internal ElasticTagRuleProperties(ElasticProvisioningState? provisioningState, ElasticLogRules logRules, IDictionary serializedAdditionalRawData) + internal MonitoringTagRulesProperties(ProvisioningState? provisioningState, LogRules logRules, IDictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; LogRules = logRules; @@ -62,8 +62,8 @@ internal ElasticTagRuleProperties(ElasticProvisioningState? provisioningState, E } /// Provisioning state of the monitoring tag rules. - public ElasticProvisioningState? ProvisioningState { get; set; } + public ProvisioningState? ProvisioningState { get; } /// Rules for sending logs. - public ElasticLogRules LogRules { get; set; } + public LogRules LogRules { get; set; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticSku.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OkResponse.Serialization.cs similarity index 68% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticSku.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OkResponse.Serialization.cs index 42155bf13a0d..96bde7a378f2 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticSku.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OkResponse.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - internal partial class ElasticSku : IUtf8JsonSerializable, IJsonModel + public partial class OkResponse : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,14 +28,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption /// 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(ElasticSku)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(OkResponse)} does not support writing '{format}' format."); } - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -53,19 +51,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + OkResponse 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(ElasticSku)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(OkResponse)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticSku(document.RootElement, options); + return DeserializeOkResponse(document.RootElement, options); } - internal static ElasticSku DeserializeElasticSku(JsonElement element, ModelReaderWriterOptions options = null) + internal static OkResponse DeserializeOkResponse(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -73,54 +71,48 @@ internal static ElasticSku DeserializeElasticSku(JsonElement element, ModelReade { return null; } - string name = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticSku(name, serializedAdditionalRawData); + return new OkResponse(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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticSku)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(OkResponse)} does not support writing '{options.Format}' format."); } } - ElasticSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + OkResponse 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 DeserializeElasticSku(document.RootElement, options); + return DeserializeOkResponse(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticSku)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(OkResponse)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OkResponse.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OkResponse.cs new file mode 100644 index 000000000000..92c04c6a09f6 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OkResponse.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// The request has succeeded. + public partial class OkResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal OkResponse() + { + } + + /// Initializes a new instance of . + /// Keeps track of any properties unknown to the library. + internal OkResponse(IDictionary serializedAdditionalRawData) + { + _serializedAdditionalRawData = serializedAdditionalRawData; + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationProperties.Serialization.cs similarity index 62% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationProperties.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationProperties.Serialization.cs index b26f3312a061..c77270d4f899 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationProperties.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticOpenAIIntegrationProperties : IUtf8JsonSerializable, IJsonModel + public partial class OpenAIIntegrationProperties : 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,22 +28,27 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationProperties)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(OpenAIResourceId)) + if (Optional.IsDefined(OpenAIResourceId)) { writer.WritePropertyName("openAIResourceId"u8); writer.WriteStringValue(OpenAIResourceId); } - if (options.Format != "W" && Optional.IsDefined(OpenAIResourceEndpoint)) + if (Optional.IsDefined(OpenAIResourceEndpoint)) { writer.WritePropertyName("openAIResourceEndpoint"u8); writer.WriteStringValue(OpenAIResourceEndpoint); } + if (Optional.IsDefined(OpenAIConnectorId)) + { + writer.WritePropertyName("openAIConnectorId"u8); + writer.WriteStringValue(OpenAIConnectorId); + } if (Optional.IsDefined(Key)) { writer.WritePropertyName("key"u8); @@ -71,19 +76,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticOpenAIIntegrationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + OpenAIIntegrationProperties 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(ElasticOpenAIIntegrationProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticOpenAIIntegrationProperties(document.RootElement, options); + return DeserializeOpenAIIntegrationProperties(document.RootElement, options); } - internal static ElasticOpenAIIntegrationProperties DeserializeElasticOpenAIIntegrationProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static OpenAIIntegrationProperties DeserializeOpenAIIntegrationProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -91,8 +96,9 @@ internal static ElasticOpenAIIntegrationProperties DeserializeElasticOpenAIInteg { return null; } - ResourceIdentifier openAIResourceId = default; + string openAIResourceId = default; string openAIResourceEndpoint = default; + string openAIConnectorId = default; string key = default; DateTimeOffset? lastRefreshAt = default; IDictionary serializedAdditionalRawData = default; @@ -101,11 +107,7 @@ internal static ElasticOpenAIIntegrationProperties DeserializeElasticOpenAIInteg { if (property.NameEquals("openAIResourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - openAIResourceId = new ResourceIdentifier(property.Value.GetString()); + openAIResourceId = property.Value.GetString(); continue; } if (property.NameEquals("openAIResourceEndpoint"u8)) @@ -113,6 +115,11 @@ internal static ElasticOpenAIIntegrationProperties DeserializeElasticOpenAIInteg openAIResourceEndpoint = property.Value.GetString(); continue; } + if (property.NameEquals("openAIConnectorId"u8)) + { + openAIConnectorId = property.Value.GetString(); + continue; + } if (property.NameEquals("key"u8)) { key = property.Value.GetString(); @@ -133,38 +140,44 @@ internal static ElasticOpenAIIntegrationProperties DeserializeElasticOpenAIInteg } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticOpenAIIntegrationProperties(openAIResourceId, openAIResourceEndpoint, key, lastRefreshAt, serializedAdditionalRawData); + return new OpenAIIntegrationProperties( + openAIResourceId, + openAIResourceEndpoint, + openAIConnectorId, + key, + lastRefreshAt, + 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationProperties)} does not support writing '{options.Format}' format."); } } - ElasticOpenAIIntegrationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + OpenAIIntegrationProperties 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 DeserializeElasticOpenAIIntegrationProperties(document.RootElement, options); + return DeserializeOpenAIIntegrationProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationProperties.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationProperties.cs similarity index 71% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationProperties.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationProperties.cs index 5ff6a30d3bb8..8affb6ea88de 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationProperties.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationProperties.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.Elastic.Models { /// Open AI Integration details. - public partial class ElasticOpenAIIntegrationProperties + public partial class OpenAIIntegrationProperties { /// /// Keeps track of any properties unknown to the library. @@ -46,30 +45,34 @@ public partial class ElasticOpenAIIntegrationProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticOpenAIIntegrationProperties() + /// Initializes a new instance of . + public OpenAIIntegrationProperties() { } - /// Initializes a new instance of . - /// The resource id of Open AI resource. + /// Initializes a new instance of . + /// The resource name of Open AI resource. /// The API endpoint for Open AI resource. + /// The connector id of Open AI resource. /// Value of API key for Open AI resource. /// Last Update Timestamp for key updation. /// Keeps track of any properties unknown to the library. - internal ElasticOpenAIIntegrationProperties(ResourceIdentifier openAIResourceId, string openAIResourceEndpoint, string key, DateTimeOffset? lastRefreshOn, IDictionary serializedAdditionalRawData) + internal OpenAIIntegrationProperties(string openAIResourceId, string openAIResourceEndpoint, string openAIConnectorId, string key, DateTimeOffset? lastRefreshOn, IDictionary serializedAdditionalRawData) { OpenAIResourceId = openAIResourceId; OpenAIResourceEndpoint = openAIResourceEndpoint; + OpenAIConnectorId = openAIConnectorId; Key = key; LastRefreshOn = lastRefreshOn; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The resource id of Open AI resource. - public ResourceIdentifier OpenAIResourceId { get; } + /// The resource name of Open AI resource. + public string OpenAIResourceId { get; set; } /// The API endpoint for Open AI resource. - public string OpenAIResourceEndpoint { get; } + public string OpenAIResourceEndpoint { get; set; } + /// The connector id of Open AI resource. + public string OpenAIConnectorId { get; set; } /// Value of API key for Open AI resource. public string Key { get; set; } /// Last Update Timestamp for key updation. diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationRPModelListResponse.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationRPModelListResponse.Serialization.cs index baabd9734019..781d98a61483 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationRPModelListResponse.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationRPModelListResponse.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(OpenAIIntegrationRPModelListResponse)} 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); } + 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 OpenAIIntegrationRPModelListResponse DeserializeOpenAIIntegratio { 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(ElasticOpenAIIntegrationData.DeserializeElasticOpenAIIntegrationData(item, options)); + array.Add(OpenAIIntegrationRPModelData.DeserializeOpenAIIntegrationRPModelData(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 OpenAIIntegrationRPModelListResponse DeserializeOpenAIIntegratio } } serializedAdditionalRawData = rawDataDictionary; - return new OpenAIIntegrationRPModelListResponse(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new OpenAIIntegrationRPModelListResponse(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationRPModelListResponse.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationRPModelListResponse.cs index 7c9b3c9cc0c8..1a8ec3edce54 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationRPModelListResponse.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationRPModelListResponse.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Elastic.Models { @@ -46,25 +47,34 @@ internal partial class OpenAIIntegrationRPModelListResponse private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal OpenAIIntegrationRPModelListResponse() + /// The OpenAIIntegrationRPModel items on this page. + /// is null. + internal OpenAIIntegrationRPModelListResponse(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of a list operation. - /// Link to the next set of results, if any. + /// The OpenAIIntegrationRPModel items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal OpenAIIntegrationRPModelListResponse(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal OpenAIIntegrationRPModelListResponse(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Results of a list operation. - public IReadOnlyList Value { get; } - /// Link to the next set of results, if any. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal OpenAIIntegrationRPModelListResponse() + { + } + + /// The OpenAIIntegrationRPModel items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponse.Serialization.cs similarity index 60% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyResult.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponse.Serialization.cs index 7250cf8b4dec..a74e6f13146f 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyResult.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponse.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticUserApiKeyResult : IUtf8JsonSerializable, IJsonModel + public partial class OpenAIIntegrationStatusResponse : 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(ElasticUserApiKeyResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationStatusResponse)} does not support writing '{format}' format."); } if (Optional.IsDefined(Properties)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticUserApiKeyResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + OpenAIIntegrationStatusResponse 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(ElasticUserApiKeyResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationStatusResponse)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticUserApiKeyResult(document.RootElement, options); + return DeserializeOpenAIIntegrationStatusResponse(document.RootElement, options); } - internal static ElasticUserApiKeyResult DeserializeElasticUserApiKeyResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static OpenAIIntegrationStatusResponse DeserializeOpenAIIntegrationStatusResponse(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,7 +76,7 @@ internal static ElasticUserApiKeyResult DeserializeElasticUserApiKeyResult(JsonE { return null; } - ElasticUserApiKeyProperties properties = default; + OpenAIIntegrationStatusResponseProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -87,7 +87,7 @@ internal static ElasticUserApiKeyResult DeserializeElasticUserApiKeyResult(JsonE { continue; } - properties = ElasticUserApiKeyProperties.DeserializeElasticUserApiKeyProperties(property.Value, options); + properties = OpenAIIntegrationStatusResponseProperties.DeserializeOpenAIIntegrationStatusResponseProperties(property.Value, options); continue; } if (options.Format != "W") @@ -96,38 +96,38 @@ internal static ElasticUserApiKeyResult DeserializeElasticUserApiKeyResult(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticUserApiKeyResult(properties, serializedAdditionalRawData); + return new OpenAIIntegrationStatusResponse(properties, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticUserApiKeyResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationStatusResponse)} does not support writing '{options.Format}' format."); } } - ElasticUserApiKeyResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + OpenAIIntegrationStatusResponse 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 DeserializeElasticUserApiKeyResult(document.RootElement, options); + return DeserializeOpenAIIntegrationStatusResponse(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticUserApiKeyResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationStatusResponse)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponse.cs similarity index 77% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusResult.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponse.cs index 8ea31c7ccca1..4c30eedab5ec 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusResult.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponse.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Status of the OpenAI Integration. - public partial class ElasticOpenAIIntegrationStatusResult + public partial class OpenAIIntegrationStatusResponse { /// /// Keeps track of any properties unknown to the library. @@ -45,24 +45,24 @@ public partial class ElasticOpenAIIntegrationStatusResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticOpenAIIntegrationStatusResult() + /// Initializes a new instance of . + internal OpenAIIntegrationStatusResponse() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Status of the OpenAI Integration. /// Keeps track of any properties unknown to the library. - internal ElasticOpenAIIntegrationStatusResult(ElasticOpenAIIntegrationStatusProperties properties, IDictionary serializedAdditionalRawData) + internal OpenAIIntegrationStatusResponse(OpenAIIntegrationStatusResponseProperties properties, IDictionary serializedAdditionalRawData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Status of the OpenAI Integration. - internal ElasticOpenAIIntegrationStatusProperties Properties { get; } + internal OpenAIIntegrationStatusResponseProperties Properties { get; } /// Status of the OpenAI Integration. - public string ElasticOpenAIIntegrationStatus + public string Status { get => Properties?.Status; } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponseProperties.Serialization.cs similarity index 60% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusProperties.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponseProperties.Serialization.cs index 0ec6c64a845e..de6d0ec9ca73 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusProperties.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponseProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - internal partial class ElasticOpenAIIntegrationStatusProperties : IUtf8JsonSerializable, IJsonModel + internal partial class OpenAIIntegrationStatusResponseProperties : 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 w /// 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(ElasticOpenAIIntegrationStatusProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationStatusResponseProperties)} does not support writing '{format}' format."); } if (Optional.IsDefined(Status)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticOpenAIIntegrationStatusProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + OpenAIIntegrationStatusResponseProperties 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(ElasticOpenAIIntegrationStatusProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationStatusResponseProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticOpenAIIntegrationStatusProperties(document.RootElement, options); + return DeserializeOpenAIIntegrationStatusResponseProperties(document.RootElement, options); } - internal static ElasticOpenAIIntegrationStatusProperties DeserializeElasticOpenAIIntegrationStatusProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static OpenAIIntegrationStatusResponseProperties DeserializeOpenAIIntegrationStatusResponseProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -92,38 +92,38 @@ internal static ElasticOpenAIIntegrationStatusProperties DeserializeElasticOpenA } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticOpenAIIntegrationStatusProperties(status, serializedAdditionalRawData); + return new OpenAIIntegrationStatusResponseProperties(status, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationStatusProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationStatusResponseProperties)} does not support writing '{options.Format}' format."); } } - ElasticOpenAIIntegrationStatusProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + OpenAIIntegrationStatusResponseProperties 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 DeserializeElasticOpenAIIntegrationStatusProperties(document.RootElement, options); + return DeserializeOpenAIIntegrationStatusResponseProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationStatusProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationStatusResponseProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusProperties.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponseProperties.cs similarity index 80% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusProperties.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponseProperties.cs index f3f4e2b2fc9e..e57900a3c7f4 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticOpenAIIntegrationStatusProperties.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OpenAIIntegrationStatusResponseProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Status of the OpenAI Integration. - internal partial class ElasticOpenAIIntegrationStatusProperties + internal partial class OpenAIIntegrationStatusResponseProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,15 +45,15 @@ internal partial class ElasticOpenAIIntegrationStatusProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticOpenAIIntegrationStatusProperties() + /// Initializes a new instance of . + internal OpenAIIntegrationStatusResponseProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Status of the OpenAI Integration. /// Keeps track of any properties unknown to the library. - internal ElasticOpenAIIntegrationStatusProperties(string status, IDictionary serializedAdditionalRawData) + internal OpenAIIntegrationStatusResponseProperties(string status, IDictionary serializedAdditionalRawData) { Status = status; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/Operation.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..c860256d1eb4 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/Operation.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.Elastic.Models +{ + /// The operation for the patch on the resource. + public readonly partial struct Operation : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Operation(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AddBeginValue = "AddBegin"; + private const string AddCompleteValue = "AddComplete"; + private const string DeleteBeginValue = "DeleteBegin"; + private const string DeleteCompleteValue = "DeleteComplete"; + private const string ActiveValue = "Active"; + + /// AddBegin. + public static Operation AddBegin { get; } = new Operation(AddBeginValue); + /// AddComplete. + public static Operation AddComplete { get; } = new Operation(AddCompleteValue); + /// DeleteBegin. + public static Operation DeleteBegin { get; } = new Operation(DeleteBeginValue); + /// DeleteComplete. + public static Operation DeleteComplete { get; } = new Operation(DeleteCompleteValue); + /// Active. + public static Operation Active { get; } = new Operation(ActiveValue); + /// Determines if two values are the same. + public static bool operator ==(Operation left, Operation right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Operation left, Operation right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Operation(string value) => new Operation(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Operation other && Equals(other); + /// + public bool Equals(Operation 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationDisplay.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationDisplay.Serialization.cs new file mode 100644 index 000000000000..1ae47ce7f5b9 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationDisplay.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + public partial class OperationDisplay : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationDisplay)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Provider)) + { + writer.WritePropertyName("provider"u8); + writer.WriteStringValue(Provider); + } + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + writer.WriteStringValue(Resource); + } + if (Optional.IsDefined(Operation)) + { + writer.WritePropertyName("operation"u8); + writer.WriteStringValue(Operation); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationDisplay IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationDisplay)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationDisplay(document.RootElement, options); + } + + internal static OperationDisplay DeserializeOperationDisplay(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string provider = default; + string resource = default; + string operation = default; + string description = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provider"u8)) + { + provider = property.Value.GetString(); + continue; + } + if (property.NameEquals("resource"u8)) + { + resource = property.Value.GetString(); + continue; + } + if (property.NameEquals("operation"u8)) + { + operation = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationDisplay(provider, resource, operation, description, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(OperationDisplay)} does not support writing '{options.Format}' format."); + } + } + + OperationDisplay IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationDisplay(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationDisplay)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationDisplay.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..1ca15fd6859d --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// Represents the display information for an operation. + public partial class OperationDisplay + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal OperationDisplay() + { + } + + /// Initializes a new instance of . + /// The service provider of the operation. + /// The resource type of the operation. + /// The name of the operation. + /// A description of the operation. + /// Keeps track of any properties unknown to the library. + internal OperationDisplay(string provider, string resource, string operation, string description, IDictionary serializedAdditionalRawData) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The service provider of the operation. + public string Provider { get; } + /// The resource type of the operation. + public string Resource { get; } + /// The name of the operation. + public string Operation { get; } + /// A description of the operation. + public string Description { get; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationListResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationListResult.Serialization.cs new file mode 100644 index 000000000000..c3a3828cd01a --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationListResult.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + internal partial class OperationListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationListResult(document.RootElement, options); + } + + internal static OperationListResult DeserializeOperationListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OperationResult.DeserializeOperationResult(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(OperationListResult)} does not support writing '{options.Format}' format."); + } + } + + OperationListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationListResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationListResult.cs new file mode 100644 index 000000000000..1749f5b821a6 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// Represents a paginated list of operations. + internal partial class OperationListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The list of operations. + /// is null. + internal OperationListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The list of operations. + /// The URL to get the next set of results, if any. + /// Keeps track of any properties unknown to the library. + internal OperationListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OperationListResult() + { + } + + /// The list of operations. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results, if any. + public string NextLink { get; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationName.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationName.cs new file mode 100644 index 000000000000..988a3655e640 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationName.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.Elastic.Models +{ + /// Operation to be performed on the given vm resource id. + public readonly partial struct OperationName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperationName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AddValue = "Add"; + private const string DeleteValue = "Delete"; + + /// Add. + public static OperationName Add { get; } = new OperationName(AddValue); + /// Delete. + public static OperationName Delete { get; } = new OperationName(DeleteValue); + /// Determines if two values are the same. + public static bool operator ==(OperationName left, OperationName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationName left, OperationName right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OperationName(string value) => new OperationName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationName other && Equals(other); + /// + public bool Equals(OperationName 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationResult.Serialization.cs new file mode 100644 index 000000000000..14e72ebba207 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationResult.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + public partial class OperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(IsDataAction)) + { + writer.WritePropertyName("isDataAction"u8); + writer.WriteBooleanValue(IsDataAction.Value); + } + if (Optional.IsDefined(Display)) + { + writer.WritePropertyName("display"u8); + writer.WriteObjectValue(Display, options); + } + if (Optional.IsDefined(Origin)) + { + writer.WritePropertyName("origin"u8); + writer.WriteStringValue(Origin); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationResult(document.RootElement, options); + } + + internal static OperationResult DeserializeOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + bool? isDataAction = default; + OperationDisplay display = default; + string origin = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("isDataAction"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDataAction = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("display"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + display = OperationDisplay.DeserializeOperationDisplay(property.Value, options); + continue; + } + if (property.NameEquals("origin"u8)) + { + origin = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationResult(name, isDataAction, display, origin, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(OperationResult)} does not support writing '{options.Format}' format."); + } + } + + OperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationResult.cs new file mode 100644 index 000000000000..e799b0c173e1 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/OperationResult.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// A Microsoft.Elastic REST API operation. + public partial class OperationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal OperationResult() + { + } + + /// Initializes a new instance of . + /// Operation name, i.e., {provider}/{resource}/{operation}. + /// Indicates whether the operation is a data action. + /// The object that represents the operation. + /// Origin of the operation. + /// Keeps track of any properties unknown to the library. + internal OperationResult(string name, bool? isDataAction, OperationDisplay display, string origin, IDictionary serializedAdditionalRawData) + { + Name = name; + IsDataAction = isDataAction; + Display = display; + Origin = origin; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Operation name, i.e., {provider}/{resource}/{operation}. + public string Name { get; } + /// Indicates whether the operation is a data action. + public bool? IsDataAction { get; } + /// The object that represents the operation. + public OperationDisplay Display { get; } + /// Origin of the operation. + public string Origin { get; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PartnerBillingEntity.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PartnerBillingEntity.Serialization.cs index 4d1167b4f918..87b2c4e06c85 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PartnerBillingEntity.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PartnerBillingEntity.Serialization.cs @@ -47,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(PartnerEntityUri)) { writer.WritePropertyName("partnerEntityUri"u8); - writer.WriteStringValue(PartnerEntityUri.AbsoluteUri); + writer.WriteStringValue(PartnerEntityUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -88,7 +88,7 @@ internal static PartnerBillingEntity DeserializePartnerBillingEntity(JsonElement } string id = default; string name = default; - Uri partnerEntityUri = default; + string partnerEntityUri = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -105,11 +105,7 @@ internal static PartnerBillingEntity DeserializePartnerBillingEntity(JsonElement } if (property.NameEquals("partnerEntityUri"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - partnerEntityUri = new Uri(property.Value.GetString()); + partnerEntityUri = property.Value.GetString(); continue; } if (options.Format != "W") diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PartnerBillingEntity.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PartnerBillingEntity.cs index 65f2290287ec..4df0f2355153 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PartnerBillingEntity.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PartnerBillingEntity.cs @@ -55,7 +55,7 @@ internal PartnerBillingEntity() /// The Elastic Organization Name. /// Link to the elastic organization page. /// Keeps track of any properties unknown to the library. - internal PartnerBillingEntity(string id, string name, Uri partnerEntityUri, IDictionary serializedAdditionalRawData) + internal PartnerBillingEntity(string id, string name, string partnerEntityUri, IDictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -68,6 +68,6 @@ internal PartnerBillingEntity(string id, string name, Uri partnerEntityUri, IDic /// The Elastic Organization Name. public string Name { get; } /// Link to the elastic organization page. - public Uri PartnerEntityUri { get; } + public string PartnerEntityUri { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticPlanDetails.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PlanDetails.Serialization.cs similarity index 74% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticPlanDetails.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PlanDetails.Serialization.cs index c51d2079a89f..fc96c770b1a3 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticPlanDetails.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PlanDetails.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticPlanDetails : IUtf8JsonSerializable, IJsonModel + public partial class PlanDetails : 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, ModelReaderWrit /// 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(ElasticPlanDetails)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(PlanDetails)} does not support writing '{format}' format."); } if (Optional.IsDefined(OfferId)) @@ -76,19 +76,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticPlanDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PlanDetails 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(ElasticPlanDetails)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(PlanDetails)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticPlanDetails(document.RootElement, options); + return DeserializePlanDetails(document.RootElement, options); } - internal static ElasticPlanDetails DeserializeElasticPlanDetails(JsonElement element, ModelReaderWriterOptions options = null) + internal static PlanDetails DeserializePlanDetails(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -136,7 +136,7 @@ internal static ElasticPlanDetails DeserializeElasticPlanDetails(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticPlanDetails( + return new PlanDetails( offerId, publisherId, termId, @@ -145,35 +145,35 @@ internal static ElasticPlanDetails DeserializeElasticPlanDetails(JsonElement ele 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticPlanDetails)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(PlanDetails)} does not support writing '{options.Format}' format."); } } - ElasticPlanDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PlanDetails 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 DeserializeElasticPlanDetails(document.RootElement, options); + return DeserializePlanDetails(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticPlanDetails)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(PlanDetails)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticPlanDetails.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PlanDetails.cs similarity index 86% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticPlanDetails.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PlanDetails.cs index d501ed41438c..3ff4e9fdf072 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticPlanDetails.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/PlanDetails.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Plan details of the monitor resource. - public partial class ElasticPlanDetails + public partial class PlanDetails { /// /// Keeps track of any properties unknown to the library. @@ -45,19 +45,19 @@ public partial class ElasticPlanDetails /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticPlanDetails() + /// Initializes a new instance of . + public PlanDetails() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Offer ID of the plan. /// Publisher ID of the plan. /// Term ID of the plan. /// Plan ID. /// Plan Name. /// Keeps track of any properties unknown to the library. - internal ElasticPlanDetails(string offerId, string publisherId, string termId, string planId, string planName, IDictionary serializedAdditionalRawData) + internal PlanDetails(string offerId, string publisherId, string termId, string planId, string planName, IDictionary serializedAdditionalRawData) { OfferId = offerId; PublisherId = publisherId; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProjectDetails.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProjectDetails.Serialization.cs new file mode 100644 index 000000000000..9a46d9950a42 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProjectDetails.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + public partial class ProjectDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProjectDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ProjectType)) + { + writer.WritePropertyName("projectType"u8); + writer.WriteStringValue(ProjectType.Value.ToString()); + } + if (Optional.IsDefined(ConfigurationType)) + { + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ProjectDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProjectDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProjectDetails(document.RootElement, options); + } + + internal static ProjectDetails DeserializeProjectDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProjectType? projectType = default; + ConfigurationType? configurationType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("projectType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + projectType = new ProjectType(property.Value.GetString()); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configurationType = new ConfigurationType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProjectDetails(projectType, configurationType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(ProjectDetails)} does not support writing '{options.Format}' format."); + } + } + + ProjectDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeProjectDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProjectDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProjectDetails.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProjectDetails.cs new file mode 100644 index 000000000000..e0d177cf7413 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProjectDetails.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// Project details of the monitor resource IF it belongs to Serverless offer kind. + public partial class ProjectDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ProjectDetails() + { + } + + /// Initializes a new instance of . + /// Project type; ex: Elasticsearch / Observability / Security. + /// Configuration type of the Elasticsearch project. + /// Keeps track of any properties unknown to the library. + internal ProjectDetails(ProjectType? projectType, ConfigurationType? configurationType, IDictionary serializedAdditionalRawData) + { + ProjectType = projectType; + ConfigurationType = configurationType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Project type; ex: Elasticsearch / Observability / Security. + public ProjectType? ProjectType { get; set; } + /// Configuration type of the Elasticsearch project. + public ConfigurationType? ConfigurationType { get; set; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProjectType.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProjectType.cs new file mode 100644 index 000000000000..f79037134dc3 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProjectType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// Project type; ex: Elasticsearch / Observability / Security. + public readonly partial struct ProjectType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProjectType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ElasticsearchValue = "Elasticsearch"; + private const string ObservabilityValue = "Observability"; + private const string SecurityValue = "Security"; + private const string NotApplicableValue = "NotApplicable"; + + /// Elasticsearch. + public static ProjectType Elasticsearch { get; } = new ProjectType(ElasticsearchValue); + /// Observability. + public static ProjectType Observability { get; } = new ProjectType(ObservabilityValue); + /// Security. + public static ProjectType Security { get; } = new ProjectType(SecurityValue); + /// NotApplicable. + public static ProjectType NotApplicable { get; } = new ProjectType(NotApplicableValue); + /// Determines if two values are the same. + public static bool operator ==(ProjectType left, ProjectType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProjectType left, ProjectType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProjectType(string value) => new ProjectType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProjectType other && Equals(other); + /// + public bool Equals(ProjectType 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProvisioningState.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..74203f8ff055 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// Provisioning state of Elastic resource. + 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 AcceptedValue = "Accepted"; + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string DeletedValue = "Deleted"; + private const string NotSpecifiedValue = "NotSpecified"; + + /// Accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// 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); + /// 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); + /// Deleted. + public static ProvisioningState Deleted { get; } = new ProvisioningState(DeletedValue); + /// NotSpecified. + public static ProvisioningState NotSpecified { get; } = new ProvisioningState(NotSpecifiedValue); + /// 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResourceSku.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResourceSku.Serialization.cs new file mode 100644 index 000000000000..06298f50fd4e --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResourceSku.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + internal partial class ResourceSku : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceSku)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceSku)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceSku(document.RootElement, options); + } + + internal static ResourceSku DeserializeResourceSku(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceSku(name, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceSku)} does not support writing '{options.Format}' format."); + } + } + + ResourceSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceSku(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceSku)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticSku.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResourceSku.cs similarity index 74% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticSku.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResourceSku.cs index 40fcdf36b9d3..a9536e32d921 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticSku.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResourceSku.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.Elastic.Models { - /// Microsoft.Elastic SKU. - internal partial class ElasticSku + /// Represents the SKU of a resource. + internal partial class ResourceSku { /// /// Keeps track of any properties unknown to the library. @@ -45,31 +45,31 @@ internal partial class ElasticSku /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Name of the SKU. + /// Initializes a new instance of . + /// The name of the SKU. /// is null. - public ElasticSku(string name) + public ResourceSku(string name) { Argument.AssertNotNull(name, nameof(name)); Name = name; } - /// Initializes a new instance of . - /// Name of the SKU. + /// Initializes a new instance of . + /// The name of the SKU. /// Keeps track of any properties unknown to the library. - internal ElasticSku(string name, IDictionary serializedAdditionalRawData) + internal ResourceSku(string name, IDictionary serializedAdditionalRawData) { Name = name; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ElasticSku() + /// Initializes a new instance of for deserialization. + internal ResourceSku() { } - /// Name of the SKU. + /// The name of the SKU. public string Name { get; set; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResubscribeProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResubscribeProperties.Serialization.cs new file mode 100644 index 000000000000..fc5fb0162f88 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResubscribeProperties.Serialization.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + public partial class ResubscribeProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResubscribeProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(PlanId)) + { + writer.WritePropertyName("planId"u8); + writer.WriteStringValue(PlanId); + } + if (Optional.IsDefined(Term)) + { + writer.WritePropertyName("term"u8); + writer.WriteStringValue(Term); + } + if (Optional.IsDefined(SubscriptionId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + } + if (Optional.IsDefined(ResourceGroup)) + { + writer.WritePropertyName("resourceGroup"u8); + writer.WriteStringValue(ResourceGroup); + } + if (Optional.IsDefined(OrganizationId)) + { + writer.WritePropertyName("organizationId"u8); + writer.WriteStringValue(OrganizationId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResubscribeProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResubscribeProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResubscribeProperties(document.RootElement, options); + } + + internal static ResubscribeProperties DeserializeResubscribeProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string planId = default; + string term = default; + string subscriptionId = default; + string resourceGroup = default; + string organizationId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("planId"u8)) + { + planId = property.Value.GetString(); + continue; + } + if (property.NameEquals("term"u8)) + { + term = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroup"u8)) + { + resourceGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("organizationId"u8)) + { + organizationId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResubscribeProperties( + planId, + term, + subscriptionId, + resourceGroup, + organizationId, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(ResubscribeProperties)} does not support writing '{options.Format}' format."); + } + } + + ResubscribeProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResubscribeProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResubscribeProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResubscribeProperties.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResubscribeProperties.cs new file mode 100644 index 000000000000..41f6bfd860e0 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ResubscribeProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// Resubscribe Properties. + public partial class ResubscribeProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ResubscribeProperties() + { + } + + /// Initializes a new instance of . + /// Newly selected plan Id to create the new Marketplace subscription for Resubscribe. + /// Newly selected term to create the new Marketplace subscription for Resubscribe. + /// Newly selected Azure Subscription Id in which the new Marketplace subscription will be created for Resubscribe. + /// Newly selected Azure resource group in which the new Marketplace subscription will be created for Resubscribe. + /// Organization Id of the Elastic Organization that needs to be resubscribed. + /// Keeps track of any properties unknown to the library. + internal ResubscribeProperties(string planId, string term, string subscriptionId, string resourceGroup, string organizationId, IDictionary serializedAdditionalRawData) + { + PlanId = planId; + Term = term; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + OrganizationId = organizationId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Newly selected plan Id to create the new Marketplace subscription for Resubscribe. + public string PlanId { get; set; } + /// Newly selected term to create the new Marketplace subscription for Resubscribe. + public string Term { get; set; } + /// Newly selected Azure Subscription Id in which the new Marketplace subscription will be created for Resubscribe. + public string SubscriptionId { get; set; } + /// Newly selected Azure resource group in which the new Marketplace subscription will be created for Resubscribe. + public string ResourceGroup { get; set; } + /// Organization Id of the Elastic Organization that needs to be resubscribed. + public string OrganizationId { get; set; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SendingLogsStatus.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SendingLog.cs similarity index 55% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SendingLogsStatus.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SendingLog.cs index da51599166b8..0883535b5b6e 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SendingLogsStatus.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SendingLog.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.Elastic.Models { /// Flag indicating the status of the resource for sending logs operation to Elastic. - public readonly partial struct SendingLogsStatus : IEquatable + public readonly partial struct SendingLog : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public SendingLogsStatus(string value) + public SendingLog(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -26,21 +26,21 @@ public SendingLogsStatus(string value) private const string FalseValue = "False"; /// True. - public static SendingLogsStatus True { get; } = new SendingLogsStatus(TrueValue); + public static SendingLog True { get; } = new SendingLog(TrueValue); /// False. - public static SendingLogsStatus False { get; } = new SendingLogsStatus(FalseValue); - /// Determines if two values are the same. - public static bool operator ==(SendingLogsStatus left, SendingLogsStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(SendingLogsStatus left, SendingLogsStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator SendingLogsStatus(string value) => new SendingLogsStatus(value); + public static SendingLog False { get; } = new SendingLog(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(SendingLog left, SendingLog right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SendingLog left, SendingLog right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SendingLog(string value) => new SendingLog(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is SendingLogsStatus other && Equals(other); + public override bool Equals(object obj) => obj is SendingLog other && Equals(other); /// - public bool Equals(SendingLogsStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(SendingLog other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/Status.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/Status.cs new file mode 100644 index 000000000000..ffc642f135c8 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/Status.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// The state of monitoring. + public readonly partial struct Status : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Status(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InProgressValue = "InProgress"; + private const string ActiveValue = "Active"; + private const string FailedValue = "Failed"; + private const string DeletingValue = "Deleting"; + + /// InProgress. + public static Status InProgress { get; } = new Status(InProgressValue); + /// Active. + public static Status Active { get; } = new Status(ActiveValue); + /// Failed. + public static Status Failed { get; } = new Status(FailedValue); + /// Deleting. + public static Status Deleting { get; } = new Status(DeletingValue); + /// Determines if two values are the same. + public static bool operator ==(Status left, Status right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Status left, Status right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Status(string value) => new Status(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Status other && Equals(other); + /// + public bool Equals(Status 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SubscriptionList.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SubscriptionList.Serialization.cs new file mode 100644 index 000000000000..0b5c382e80f1 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SubscriptionList.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Elastic.Models +{ + public partial class SubscriptionList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriptionList)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Operation)) + { + writer.WritePropertyName("operation"u8); + writer.WriteStringValue(Operation.Value.ToString()); + } + if (Optional.IsCollectionDefined(MonitoredSubscriptionList)) + { + writer.WritePropertyName("monitoredSubscriptionList"u8); + writer.WriteStartArray(); + foreach (var item in MonitoredSubscriptionList) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SubscriptionList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriptionList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriptionList(document.RootElement, options); + } + + internal static SubscriptionList DeserializeSubscriptionList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Operation? operation = default; + IList monitoredSubscriptionList = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + operation = new Operation(property.Value.GetString()); + continue; + } + if (property.NameEquals("monitoredSubscriptionList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MonitoredSubscription.DeserializeMonitoredSubscription(item, options)); + } + monitoredSubscriptionList = array; + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SubscriptionList(operation, monitoredSubscriptionList ?? new ChangeTrackingList(), provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(SubscriptionList)} does not support writing '{options.Format}' format."); + } + } + + SubscriptionList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSubscriptionList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubscriptionList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SubscriptionList.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SubscriptionList.cs new file mode 100644 index 000000000000..debc15f7487d --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/SubscriptionList.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Elastic.Models +{ + /// The request to update subscriptions needed to be monitored by the Elastic monitor resource. + public partial class SubscriptionList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SubscriptionList() + { + MonitoredSubscriptionList = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The operation for the patch on the resource. + /// List of subscriptions and the state of the monitoring. + /// Provisioning State of the resource. + /// Keeps track of any properties unknown to the library. + internal SubscriptionList(Operation? operation, IList monitoredSubscriptionList, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + Operation = operation; + MonitoredSubscriptionList = monitoredSubscriptionList; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The operation for the patch on the resource. + public Operation? Operation { get; set; } + /// List of subscriptions and the state of the monitoring. + public IList MonitoredSubscriptionList { get; } + /// Provisioning State of the resource. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/TagAction.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/TagAction.cs new file mode 100644 index 000000000000..89c665b318e5 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/TagAction.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.Elastic.Models +{ + /// Valid actions for a filtering tag. Exclusion takes priority over inclusion. + public readonly partial struct TagAction : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TagAction(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IncludeValue = "Include"; + private const string ExcludeValue = "Exclude"; + + /// Include. + public static TagAction Include { get; } = new TagAction(IncludeValue); + /// Exclude. + public static TagAction Exclude { get; } = new TagAction(ExcludeValue); + /// Determines if two values are the same. + public static bool operator ==(TagAction left, TagAction right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TagAction left, TagAction right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TagAction(string value) => new TagAction(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TagAction other && Equals(other); + /// + public bool Equals(TagAction 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/Type.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/Type.cs new file mode 100644 index 000000000000..bf2b91082aa5 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/Type.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.Elastic.Models +{ + /// Type of the elastic filter. + public readonly partial struct Type : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Type(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IPValue = "ip"; + private const string AzurePrivateEndpointValue = "azure_private_endpoint"; + + /// ip. + public static Type IP { get; } = new Type(IPValue); + /// azure_private_endpoint. + public static Type AzurePrivateEndpoint { get; } = new Type(AzurePrivateEndpointValue); + /// Determines if two values are the same. + public static bool operator ==(Type left, Type right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Type left, Type right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Type(string value) => new Type(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Type other && Equals(other); + /// + public bool Equals(Type 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionListResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionsList.Serialization.cs similarity index 70% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionListResult.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionsList.Serialization.cs index 074620b964a2..c10de0173d78 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionListResult.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionsList.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class UpgradableVersionListResult : IUtf8JsonSerializable, IJsonModel + public partial class UpgradableVersionsList : 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(UpgradableVersionListResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UpgradableVersionsList)} does not support writing '{format}' format."); } if (Optional.IsDefined(CurrentVersion)) @@ -66,19 +66,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UpgradableVersionListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UpgradableVersionsList 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(UpgradableVersionListResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UpgradableVersionsList)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpgradableVersionListResult(document.RootElement, options); + return DeserializeUpgradableVersionsList(document.RootElement, options); } - internal static UpgradableVersionListResult DeserializeUpgradableVersionListResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static UpgradableVersionsList DeserializeUpgradableVersionsList(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -117,38 +117,38 @@ internal static UpgradableVersionListResult DeserializeUpgradableVersionListResu } } serializedAdditionalRawData = rawDataDictionary; - return new UpgradableVersionListResult(currentVersion, upgradableVersions ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new UpgradableVersionsList(currentVersion, upgradableVersions ?? 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(UpgradableVersionListResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpgradableVersionsList)} does not support writing '{options.Format}' format."); } } - UpgradableVersionListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UpgradableVersionsList 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 DeserializeUpgradableVersionListResult(document.RootElement, options); + return DeserializeUpgradableVersionsList(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(UpgradableVersionListResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpgradableVersionsList)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionListResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionsList.cs similarity index 88% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionListResult.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionsList.cs index 9205915e5b52..ae006574eda8 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionListResult.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UpgradableVersionsList.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Stack Versions that this version can upgrade to. - public partial class UpgradableVersionListResult + public partial class UpgradableVersionsList { /// /// Keeps track of any properties unknown to the library. @@ -45,17 +45,17 @@ public partial class UpgradableVersionListResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal UpgradableVersionListResult() + /// Initializes a new instance of . + internal UpgradableVersionsList() { UpgradableVersions = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Current version of the elastic monitor. /// Stack Versions that this version can upgrade to. /// Keeps track of any properties unknown to the library. - internal UpgradableVersionListResult(string currentVersion, IReadOnlyList upgradableVersions, IDictionary serializedAdditionalRawData) + internal UpgradableVersionsList(string currentVersion, IReadOnlyList upgradableVersions, IDictionary serializedAdditionalRawData) { CurrentVersion = currentVersion; UpgradableVersions = upgradableVersions; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersion.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponse.Serialization.cs similarity index 64% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersion.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponse.Serialization.cs index 7bb33b4b9309..7cad586120c0 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVersion.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponse.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticVersion : IUtf8JsonSerializable, IJsonModel + public partial class UserApiKeyResponse : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ElasticVersion)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UserApiKeyResponse)} does not support writing '{format}' format."); } if (Optional.IsDefined(Properties)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticVersion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UserApiKeyResponse 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(ElasticVersion)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UserApiKeyResponse)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticVersion(document.RootElement, options); + return DeserializeUserApiKeyResponse(document.RootElement, options); } - internal static ElasticVersion DeserializeElasticVersion(JsonElement element, ModelReaderWriterOptions options = null) + internal static UserApiKeyResponse DeserializeUserApiKeyResponse(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,7 +76,7 @@ internal static ElasticVersion DeserializeElasticVersion(JsonElement element, Mo { return null; } - ElasticVersionProperties properties = default; + UserApiKeyResponseProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -87,7 +87,7 @@ internal static ElasticVersion DeserializeElasticVersion(JsonElement element, Mo { continue; } - properties = ElasticVersionProperties.DeserializeElasticVersionProperties(property.Value, options); + properties = UserApiKeyResponseProperties.DeserializeUserApiKeyResponseProperties(property.Value, options); continue; } if (options.Format != "W") @@ -96,38 +96,38 @@ internal static ElasticVersion DeserializeElasticVersion(JsonElement element, Mo } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticVersion(properties, serializedAdditionalRawData); + return new UserApiKeyResponse(properties, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticVersion)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UserApiKeyResponse)} does not support writing '{options.Format}' format."); } } - ElasticVersion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UserApiKeyResponse 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 DeserializeElasticVersion(document.RootElement, options); + return DeserializeUserApiKeyResponse(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticVersion)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UserApiKeyResponse)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponse.cs similarity index 81% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyResult.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponse.cs index 4096525c868d..90c77c2261b7 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyResult.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponse.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// The User Api Key created for the Organization associated with the User Email Id that was passed in the request. - public partial class ElasticUserApiKeyResult + public partial class UserApiKeyResponse { /// /// Keeps track of any properties unknown to the library. @@ -45,24 +45,24 @@ public partial class ElasticUserApiKeyResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticUserApiKeyResult() + /// Initializes a new instance of . + internal UserApiKeyResponse() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// /// Keeps track of any properties unknown to the library. - internal ElasticUserApiKeyResult(ElasticUserApiKeyProperties properties, IDictionary serializedAdditionalRawData) + internal UserApiKeyResponse(UserApiKeyResponseProperties properties, IDictionary serializedAdditionalRawData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Gets the properties. - internal ElasticUserApiKeyProperties Properties { get; } + internal UserApiKeyResponseProperties Properties { get; } /// The User Api Key Generated based on GenerateApiKey flag. This is applicable for non-Portal clients only. - public string ElasticUserApiKey + public string ApiKey { get => Properties?.ApiKey; } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyProperties.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponseProperties.Serialization.cs similarity index 64% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyProperties.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponseProperties.Serialization.cs index e1905bce7542..118a253f2eff 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyProperties.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponseProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - internal partial class ElasticUserApiKeyProperties : IUtf8JsonSerializable, IJsonModel + internal partial class UserApiKeyResponseProperties : 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(ElasticUserApiKeyProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UserApiKeyResponseProperties)} does not support writing '{format}' format."); } if (Optional.IsDefined(ApiKey)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticUserApiKeyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UserApiKeyResponseProperties 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(ElasticUserApiKeyProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UserApiKeyResponseProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticUserApiKeyProperties(document.RootElement, options); + return DeserializeUserApiKeyResponseProperties(document.RootElement, options); } - internal static ElasticUserApiKeyProperties DeserializeElasticUserApiKeyProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static UserApiKeyResponseProperties DeserializeUserApiKeyResponseProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -92,38 +92,38 @@ internal static ElasticUserApiKeyProperties DeserializeElasticUserApiKeyProperti } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticUserApiKeyProperties(apiKey, serializedAdditionalRawData); + return new UserApiKeyResponseProperties(apiKey, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticUserApiKeyProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UserApiKeyResponseProperties)} does not support writing '{options.Format}' format."); } } - ElasticUserApiKeyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UserApiKeyResponseProperties 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 DeserializeElasticUserApiKeyProperties(document.RootElement, options); + return DeserializeUserApiKeyResponseProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticUserApiKeyProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UserApiKeyResponseProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyProperties.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponseProperties.cs similarity index 81% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyProperties.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponseProperties.cs index bdb896001a79..aec0fd833735 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserApiKeyProperties.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserApiKeyResponseProperties.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.Elastic.Models { - /// The ElasticUserApiKeyProperties. - internal partial class ElasticUserApiKeyProperties + /// The UserApiKeyResponseProperties. + internal partial class UserApiKeyResponseProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,15 +45,15 @@ internal partial class ElasticUserApiKeyProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticUserApiKeyProperties() + /// Initializes a new instance of . + internal UserApiKeyResponseProperties() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The User Api Key Generated based on GenerateApiKey flag. This is applicable for non-Portal clients only. /// Keeps track of any properties unknown to the library. - internal ElasticUserApiKeyProperties(string apiKey, IDictionary serializedAdditionalRawData) + internal UserApiKeyResponseProperties(string apiKey, IDictionary serializedAdditionalRawData) { ApiKey = apiKey; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserEmailId.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserEmailId.Serialization.cs similarity index 66% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserEmailId.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserEmailId.Serialization.cs index 2e8d9ba9171e..2ac49ac41085 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserEmailId.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserEmailId.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticUserEmailId : IUtf8JsonSerializable, IJsonModel + public partial class UserEmailId : 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, ModelReaderWrit /// 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(ElasticUserEmailId)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UserEmailId)} does not support writing '{format}' format."); } if (Optional.IsDefined(EmailId)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticUserEmailId IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UserEmailId 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(ElasticUserEmailId)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UserEmailId)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticUserEmailId(document.RootElement, options); + return DeserializeUserEmailId(document.RootElement, options); } - internal static ElasticUserEmailId DeserializeElasticUserEmailId(JsonElement element, ModelReaderWriterOptions options = null) + internal static UserEmailId DeserializeUserEmailId(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -92,38 +92,38 @@ internal static ElasticUserEmailId DeserializeElasticUserEmailId(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticUserEmailId(emailId, serializedAdditionalRawData); + return new UserEmailId(emailId, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticUserEmailId)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UserEmailId)} does not support writing '{options.Format}' format."); } } - ElasticUserEmailId IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UserEmailId 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 DeserializeElasticUserEmailId(document.RootElement, options); + return DeserializeUserEmailId(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticUserEmailId)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UserEmailId)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserEmailId.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserEmailId.cs similarity index 84% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserEmailId.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserEmailId.cs index 4eda2d063865..62a30f4e7502 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserEmailId.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserEmailId.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// Email Id of the User Organization, of which the API Key must be returned. - public partial class ElasticUserEmailId + public partial class UserEmailId { /// /// Keeps track of any properties unknown to the library. @@ -45,15 +45,15 @@ public partial class ElasticUserEmailId /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticUserEmailId() + /// Initializes a new instance of . + public UserEmailId() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The User email Id. /// Keeps track of any properties unknown to the library. - internal ElasticUserEmailId(string emailId, IDictionary serializedAdditionalRawData) + internal UserEmailId(string emailId, IDictionary serializedAdditionalRawData) { EmailId = emailId; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserInfo.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserInfo.Serialization.cs similarity index 74% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserInfo.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserInfo.Serialization.cs index b97aba876244..cd0708a40903 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserInfo.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserInfo.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticUserInfo : IUtf8JsonSerializable, IJsonModel + public partial class UserInfo : 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, ModelReaderWriterO /// 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(ElasticUserInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UserInfo)} does not support writing '{format}' format."); } if (Optional.IsDefined(FirstName)) @@ -76,19 +76,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticUserInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UserInfo 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(ElasticUserInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UserInfo)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticUserInfo(document.RootElement, options); + return DeserializeUserInfo(document.RootElement, options); } - internal static ElasticUserInfo DeserializeElasticUserInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static UserInfo DeserializeUserInfo(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -100,7 +100,7 @@ internal static ElasticUserInfo DeserializeElasticUserInfo(JsonElement element, string lastName = default; string companyName = default; string emailAddress = default; - ElasticCompanyInfo companyInfo = default; + CompanyInfo companyInfo = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -131,7 +131,7 @@ internal static ElasticUserInfo DeserializeElasticUserInfo(JsonElement element, { continue; } - companyInfo = ElasticCompanyInfo.DeserializeElasticCompanyInfo(property.Value, options); + companyInfo = CompanyInfo.DeserializeCompanyInfo(property.Value, options); continue; } if (options.Format != "W") @@ -140,7 +140,7 @@ internal static ElasticUserInfo DeserializeElasticUserInfo(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticUserInfo( + return new UserInfo( firstName, lastName, companyName, @@ -149,35 +149,35 @@ internal static ElasticUserInfo DeserializeElasticUserInfo(JsonElement element, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticUserInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UserInfo)} does not support writing '{options.Format}' format."); } } - ElasticUserInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UserInfo 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 DeserializeElasticUserInfo(document.RootElement, options); + return DeserializeUserInfo(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticUserInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UserInfo)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserInfo.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserInfo.cs similarity index 85% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserInfo.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserInfo.cs index ed4371dbcfbc..70de697348af 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticUserInfo.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/UserInfo.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// User Information to be passed to partners. - public partial class ElasticUserInfo + public partial class UserInfo { /// /// Keeps track of any properties unknown to the library. @@ -45,19 +45,19 @@ public partial class ElasticUserInfo /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticUserInfo() + /// Initializes a new instance of . + public UserInfo() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// First name of the user. /// Last name of the user. /// Company name of the user. /// Email of the user used by Elastic for contacting them if needed. /// Company information of the user to be passed to partners. /// Keeps track of any properties unknown to the library. - internal ElasticUserInfo(string firstName, string lastName, string companyName, string emailAddress, ElasticCompanyInfo companyInfo, IDictionary serializedAdditionalRawData) + internal UserInfo(string firstName, string lastName, string companyName, string emailAddress, CompanyInfo companyInfo, IDictionary serializedAdditionalRawData) { FirstName = firstName; LastName = lastName; @@ -76,6 +76,6 @@ internal ElasticUserInfo(string firstName, string lastName, string companyName, /// Email of the user used by Elastic for contacting them if needed. public string EmailAddress { get; set; } /// Company information of the user to be passed to partners. - public ElasticCompanyInfo CompanyInfo { get; set; } + public CompanyInfo CompanyInfo { get; set; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionContent.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionUpdate.Serialization.cs similarity index 65% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionContent.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionUpdate.Serialization.cs index e5f7c9ad526f..b331b1a8f3d2 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionContent.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionUpdate.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class VmCollectionContent : IUtf8JsonSerializable, IJsonModel + public partial class VmCollectionUpdate : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(VmCollectionContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VmCollectionUpdate)} does not support writing '{format}' format."); } if (Optional.IsDefined(VmResourceId)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VmCollectionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VmCollectionUpdate 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(VmCollectionContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VmCollectionUpdate)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeVmCollectionContent(document.RootElement, options); + return DeserializeVmCollectionUpdate(document.RootElement, options); } - internal static VmCollectionContent DeserializeVmCollectionContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static VmCollectionUpdate DeserializeVmCollectionUpdate(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -81,19 +81,15 @@ internal static VmCollectionContent DeserializeVmCollectionContent(JsonElement e { return null; } - ResourceIdentifier vmResourceId = default; - VmCollectionUpdateOperationName? operationName = default; + string vmResourceId = default; + OperationName? operationName = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmResourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vmResourceId = new ResourceIdentifier(property.Value.GetString()); + vmResourceId = property.Value.GetString(); continue; } if (property.NameEquals("operationName"u8)) @@ -102,7 +98,7 @@ internal static VmCollectionContent DeserializeVmCollectionContent(JsonElement e { continue; } - operationName = new VmCollectionUpdateOperationName(property.Value.GetString()); + operationName = new OperationName(property.Value.GetString()); continue; } if (options.Format != "W") @@ -111,38 +107,38 @@ internal static VmCollectionContent DeserializeVmCollectionContent(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new VmCollectionContent(vmResourceId, operationName, serializedAdditionalRawData); + return new VmCollectionUpdate(vmResourceId, operationName, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(VmCollectionContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VmCollectionUpdate)} does not support writing '{options.Format}' format."); } } - VmCollectionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VmCollectionUpdate 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 DeserializeVmCollectionContent(document.RootElement, options); + return DeserializeVmCollectionUpdate(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(VmCollectionContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VmCollectionUpdate)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionContent.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionUpdate.cs similarity index 83% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionContent.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionUpdate.cs index 3d3a815910b3..2993f81d3693 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionContent.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionUpdate.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.Elastic.Models { /// Update VM resource collection. - public partial class VmCollectionContent + public partial class VmCollectionUpdate { /// /// Keeps track of any properties unknown to the library. @@ -46,16 +45,16 @@ public partial class VmCollectionContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public VmCollectionContent() + /// Initializes a new instance of . + public VmCollectionUpdate() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// ARM id of the VM resource. /// Operation to be performed for given VM. /// Keeps track of any properties unknown to the library. - internal VmCollectionContent(ResourceIdentifier vmResourceId, VmCollectionUpdateOperationName? operationName, IDictionary serializedAdditionalRawData) + internal VmCollectionUpdate(string vmResourceId, OperationName? operationName, IDictionary serializedAdditionalRawData) { VmResourceId = vmResourceId; OperationName = operationName; @@ -63,8 +62,8 @@ internal VmCollectionContent(ResourceIdentifier vmResourceId, VmCollectionUpdate } /// ARM id of the VM resource. - public ResourceIdentifier VmResourceId { get; set; } + public string VmResourceId { get; set; } /// Operation to be performed for given VM. - public VmCollectionUpdateOperationName? OperationName { get; set; } + public OperationName? OperationName { get; set; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionUpdateOperationName.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionUpdateOperationName.cs deleted file mode 100644 index 43e704611cb6..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmCollectionUpdateOperationName.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.Elastic.Models -{ - /// Operation to be performed on the given vm resource id. - public readonly partial struct VmCollectionUpdateOperationName : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public VmCollectionUpdateOperationName(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AddValue = "Add"; - private const string DeleteValue = "Delete"; - - /// Add. - public static VmCollectionUpdateOperationName Add { get; } = new VmCollectionUpdateOperationName(AddValue); - /// Delete. - public static VmCollectionUpdateOperationName Delete { get; } = new VmCollectionUpdateOperationName(DeleteValue); - /// Determines if two values are the same. - public static bool operator ==(VmCollectionUpdateOperationName left, VmCollectionUpdateOperationName right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(VmCollectionUpdateOperationName left, VmCollectionUpdateOperationName right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator VmCollectionUpdateOperationName(string value) => new VmCollectionUpdateOperationName(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is VmCollectionUpdateOperationName other && Equals(other); - /// - public bool Equals(VmCollectionUpdateOperationName 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/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmHostListResponse.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmHostListResponse.Serialization.cs index e00265d09983..bd761f62c2a8 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmHostListResponse.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmHostListResponse.Serialization.cs @@ -34,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(VmHostListResponse)} 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); } + 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 VmHostListResponse DeserializeVmHostListResponse(JsonElement ele { 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(ElasticVmResourceInfo.DeserializeElasticVmResourceInfo(item, options)); + array.Add(VmResources.DeserializeVmResources(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 VmHostListResponse DeserializeVmHostListResponse(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new VmHostListResponse(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new VmHostListResponse(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmHostListResponse.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmHostListResponse.cs index 17fca670dc6a..619b7ee207f0 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmHostListResponse.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmHostListResponse.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Elastic.Models { @@ -46,25 +47,34 @@ internal partial class VmHostListResponse private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal VmHostListResponse() + /// The VMResources items on this page. + /// is null. + internal VmHostListResponse(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of a list operation. - /// Link to the next Vm resource Id, if any. + /// The VMResources items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal VmHostListResponse(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal VmHostListResponse(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Results of a list operation. - public IReadOnlyList Value { get; } - /// Link to the next Vm resource Id, if any. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal VmHostListResponse() + { + } + + /// The VMResources items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResult.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResponse.Serialization.cs similarity index 68% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResult.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResponse.Serialization.cs index a7b760534f49..fb077e042b57 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResult.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResponse.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class VmIngestionDetailsResult : IUtf8JsonSerializable, IJsonModel + public partial class VmIngestionDetailsResponse : 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(VmIngestionDetailsResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VmIngestionDetailsResponse)} does not support writing '{format}' format."); } if (Optional.IsDefined(CloudId)) @@ -61,19 +61,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VmIngestionDetailsResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VmIngestionDetailsResponse 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(VmIngestionDetailsResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VmIngestionDetailsResponse)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeVmIngestionDetailsResult(document.RootElement, options); + return DeserializeVmIngestionDetailsResponse(document.RootElement, options); } - internal static VmIngestionDetailsResult DeserializeVmIngestionDetailsResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static VmIngestionDetailsResponse DeserializeVmIngestionDetailsResponse(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -103,38 +103,38 @@ internal static VmIngestionDetailsResult DeserializeVmIngestionDetailsResult(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new VmIngestionDetailsResult(cloudId, ingestionKey, serializedAdditionalRawData); + return new VmIngestionDetailsResponse(cloudId, ingestionKey, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(VmIngestionDetailsResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VmIngestionDetailsResponse)} does not support writing '{options.Format}' format."); } } - VmIngestionDetailsResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VmIngestionDetailsResponse 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 DeserializeVmIngestionDetailsResult(document.RootElement, options); + return DeserializeVmIngestionDetailsResponse(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(VmIngestionDetailsResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VmIngestionDetailsResponse)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResult.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResponse.cs similarity index 88% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResult.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResponse.cs index d002c5effca5..4c22517f05a9 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResult.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmIngestionDetailsResponse.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Elastic.Models { /// The vm ingestion details to install an agent. - public partial class VmIngestionDetailsResult + public partial class VmIngestionDetailsResponse { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class VmIngestionDetailsResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal VmIngestionDetailsResult() + /// Initializes a new instance of . + internal VmIngestionDetailsResponse() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The cloudId of given Elastic monitor resource. /// Ingestion details to install agent on given VM. /// Keeps track of any properties unknown to the library. - internal VmIngestionDetailsResult(string cloudId, string ingestionKey, IDictionary serializedAdditionalRawData) + internal VmIngestionDetailsResponse(string cloudId, string ingestionKey, IDictionary serializedAdditionalRawData) { CloudId = cloudId; IngestionKey = ingestionKey; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVmResourceInfo.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmResources.Serialization.cs similarity index 61% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVmResourceInfo.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmResources.Serialization.cs index 2c5c7e54de28..6464f93bf41c 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVmResourceInfo.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmResources.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Elastic.Models { - public partial class ElasticVmResourceInfo : IUtf8JsonSerializable, IJsonModel + public partial class VmResources : 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(ElasticVmResourceInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(VmResources)} does not support writing '{format}' format."); } if (Optional.IsDefined(VmResourceId)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ElasticVmResourceInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + VmResources 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(ElasticVmResourceInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(VmResources)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticVmResourceInfo(document.RootElement, options); + return DeserializeVmResources(document.RootElement, options); } - internal static ElasticVmResourceInfo DeserializeElasticVmResourceInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static VmResources DeserializeVmResources(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,18 +76,14 @@ internal static ElasticVmResourceInfo DeserializeElasticVmResourceInfo(JsonEleme { return null; } - ResourceIdentifier vmResourceId = default; + string vmResourceId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("vmResourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vmResourceId = new ResourceIdentifier(property.Value.GetString()); + vmResourceId = property.Value.GetString(); continue; } if (options.Format != "W") @@ -96,38 +92,38 @@ internal static ElasticVmResourceInfo DeserializeElasticVmResourceInfo(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticVmResourceInfo(vmResourceId, serializedAdditionalRawData); + return new VmResources(vmResourceId, 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticVmResourceInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(VmResources)} does not support writing '{options.Format}' format."); } } - ElasticVmResourceInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + VmResources 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 DeserializeElasticVmResourceInfo(document.RootElement, options); + return DeserializeVmResources(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticVmResourceInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(VmResources)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVmResourceInfo.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmResources.cs similarity index 81% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVmResourceInfo.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmResources.cs index aed1fc495ca9..457f7a877af6 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/ElasticVmResourceInfo.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Models/VmResources.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.Elastic.Models { /// The vm resource properties that is currently being monitored by the Elastic monitor resource. - public partial class ElasticVmResourceInfo + public partial class VmResources { /// /// Keeps track of any properties unknown to the library. @@ -46,21 +45,21 @@ public partial class ElasticVmResourceInfo /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ElasticVmResourceInfo() + /// Initializes a new instance of . + internal VmResources() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The ARM id of the VM resource. /// Keeps track of any properties unknown to the library. - internal ElasticVmResourceInfo(ResourceIdentifier vmResourceId, IDictionary serializedAdditionalRawData) + internal VmResources(string vmResourceId, IDictionary serializedAdditionalRawData) { VmResourceId = vmResourceId; _serializedAdditionalRawData = serializedAdditionalRawData; } /// The ARM id of the VM resource. - public ResourceIdentifier VmResourceId { get; } + public string VmResourceId { get; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyCollection.cs new file mode 100644 index 000000000000..16857c30ae65 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Elastic +{ + /// + /// 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 GetMonitoredSubscriptionProperties method from an instance of . + /// + public partial class MonitoredSubscriptionPropertyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics; + private readonly MonitoredSubscriptionsRestOperations _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MonitoredSubscriptionPropertyCollection() + { + } + + /// 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 MonitoredSubscriptionPropertyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", MonitoredSubscriptionPropertyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MonitoredSubscriptionPropertyResource.ResourceType, out string monitoredSubscriptionPropertyMonitoredSubscriptionsApiVersion); + _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient = new MonitoredSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, monitoredSubscriptionPropertyMonitoredSubscriptionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ElasticMonitorResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ElasticMonitorResource.ResourceType), nameof(id)); + } + + /// + /// Add the subscriptions that should be monitored by the Elastic monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_CreateorUpdate + /// + /// + /// Default Api Version + /// 2025-01-15-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 configuration name. Only 'default' value is supported. + /// The to use. + /// 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 configurationName, MonitoredSubscriptionPropertyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateorUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(_monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics, Pipeline, _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateCreateorUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add the subscriptions that should be monitored by the Elastic monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_CreateorUpdate + /// + /// + /// Default Api Version + /// 2025-01-15-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 configuration name. Only 'default' value is supported. + /// The to use. + /// 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 configurationName, MonitoredSubscriptionPropertyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateorUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, data, cancellationToken); + var operation = new ElasticArmOperation(_monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics, Pipeline, _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateCreateorUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all the subscriptions currently being monitored by the Elastic monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Get + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The configuration name. Only 'default' value is supported. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyCollection.Get"); + scope.Start(); + try + { + var response = await _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MonitoredSubscriptionPropertyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all the subscriptions currently being monitored by the Elastic monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Get + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The configuration name. Only 'default' value is supported. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyCollection.Get"); + scope.Start(); + try + { + var response = _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MonitoredSubscriptionPropertyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all the subscriptions currently being monitored by the Elastic monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_List + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MonitoredSubscriptionPropertyResource(Client, MonitoredSubscriptionPropertyData.DeserializeMonitoredSubscriptionPropertyData(e)), _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics, Pipeline, "MonitoredSubscriptionPropertyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List all the subscriptions currently being monitored by the Elastic monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_List + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MonitoredSubscriptionPropertyResource(Client, MonitoredSubscriptionPropertyData.DeserializeMonitoredSubscriptionPropertyData(e)), _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics, Pipeline, "MonitoredSubscriptionPropertyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Get + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The configuration name. Only 'default' value is supported. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyCollection.Exists"); + scope.Start(); + try + { + var response = await _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Get + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The configuration name. Only 'default' value is supported. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyCollection.Exists"); + scope.Start(); + try + { + var response = _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Get + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The configuration name. Only 'default' value is supported. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitoredSubscriptionPropertyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Get + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The configuration name. Only 'default' value is supported. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitoredSubscriptionPropertyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyData.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyData.Serialization.cs new file mode 100644 index 000000000000..daf75d0acb6c --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Elastic.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Elastic +{ + public partial class MonitoredSubscriptionPropertyData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MonitoredSubscriptionPropertyData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + MonitoredSubscriptionPropertyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MonitoredSubscriptionPropertyData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMonitoredSubscriptionPropertyData(document.RootElement, options); + } + + internal static MonitoredSubscriptionPropertyData DeserializeMonitoredSubscriptionPropertyData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SubscriptionList properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SubscriptionList.DeserializeSubscriptionList(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MonitoredSubscriptionPropertyData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerElasticContext.Default); + default: + throw new FormatException($"The model {nameof(MonitoredSubscriptionPropertyData)} does not support writing '{options.Format}' format."); + } + } + + MonitoredSubscriptionPropertyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMonitoredSubscriptionPropertyData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MonitoredSubscriptionPropertyData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyData.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyData.cs new file mode 100644 index 000000000000..47c3e74ebab6 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Elastic.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Elastic +{ + /// + /// A class representing the MonitoredSubscriptionProperty data model. + /// The request to update subscriptions needed to be monitored by the Elastic monitor resource. + /// + public partial class MonitoredSubscriptionPropertyData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public MonitoredSubscriptionPropertyData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The request to update subscriptions needed to be monitored by the Elastic monitor resource. + /// Keeps track of any properties unknown to the library. + internal MonitoredSubscriptionPropertyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubscriptionList properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The request to update subscriptions needed to be monitored by the Elastic monitor resource. + public SubscriptionList Properties { get; set; } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyResource.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyResource.Serialization.cs new file mode 100644 index 000000000000..086890fcba2e --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyResource.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.Elastic +{ + public partial class MonitoredSubscriptionPropertyResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + MonitoredSubscriptionPropertyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticContext.Default); + + MonitoredSubscriptionPropertyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyResource.cs new file mode 100644 index 000000000000..734acf836ca9 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoredSubscriptionPropertyResource.cs @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Elastic +{ + /// + /// A Class representing a MonitoredSubscriptionProperty 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 GetMonitoredSubscriptionPropertyResource method. + /// Otherwise you can get one from its parent resource using the GetMonitoredSubscriptionProperty method. + /// + public partial class MonitoredSubscriptionPropertyResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. + /// The configurationName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName, string configurationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics; + private readonly MonitoredSubscriptionsRestOperations _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient; + private readonly MonitoredSubscriptionPropertyData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Elastic/monitors/monitoredSubscriptions"; + + /// Initializes a new instance of the class for mocking. + protected MonitoredSubscriptionPropertyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal MonitoredSubscriptionPropertyResource(ArmClient client, MonitoredSubscriptionPropertyData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MonitoredSubscriptionPropertyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string monitoredSubscriptionPropertyMonitoredSubscriptionsApiVersion); + _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient = new MonitoredSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, monitoredSubscriptionPropertyMonitoredSubscriptionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual MonitoredSubscriptionPropertyData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// List all the subscriptions currently being monitored by the Elastic monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Get + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyResource.Get"); + scope.Start(); + try + { + var response = await _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.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 MonitoredSubscriptionPropertyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all the subscriptions currently being monitored by the Elastic monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Get + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyResource.Get"); + scope.Start(); + try + { + var response = _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MonitoredSubscriptionPropertyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the subscriptions that are being monitored by the Elastic monitor resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Delete + /// + /// + /// Default Api Version + /// 2025-01-15-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 DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyResource.Delete"); + scope.Start(); + try + { + var response = await _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(_monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics, Pipeline, _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.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; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the subscriptions that are being monitored by the Elastic monitor resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Delete + /// + /// + /// Default Api Version + /// 2025-01-15-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 Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyResource.Delete"); + scope.Start(); + try + { + var response = _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ElasticArmOperation(_monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics, Pipeline, _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the subscriptions that are being monitored by the Elastic monitor resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Update + /// + /// + /// Default Api Version + /// 2025-01-15-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 to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, MonitoredSubscriptionPropertyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyResource.Update"); + scope.Start(); + try + { + var response = await _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(new MonitoredSubscriptionPropertyOperationSource(Client), _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics, Pipeline, _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the subscriptions that are being monitored by the Elastic monitor resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName} + /// + /// + /// Operation Id + /// MonitoredSubscriptionProperties_Update + /// + /// + /// Default Api Version + /// 2025-01-15-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 to use. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, MonitoredSubscriptionPropertyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics.CreateScope("MonitoredSubscriptionPropertyResource.Update"); + scope.Start(); + try + { + var response = _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ElasticArmOperation(new MonitoredSubscriptionPropertyOperationSource(Client), _monitoredSubscriptionPropertyMonitoredSubscriptionsClientDiagnostics, Pipeline, _monitoredSubscriptionPropertyMonitoredSubscriptionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleCollection.cs similarity index 62% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleCollection.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleCollection.cs index a2ee3eea784f..797667f98f84 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleCollection.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleCollection.cs @@ -18,28 +18,28 @@ namespace Azure.ResourceManager.Elastic { /// - /// 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 GetElasticTagRules 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 GetMonitoringTagRules method from an instance of . /// - public partial class ElasticTagRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class MonitoringTagRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _elasticTagRuleTagRulesClientDiagnostics; - private readonly TagRulesRestOperations _elasticTagRuleTagRulesRestClient; + private readonly ClientDiagnostics _monitoringTagRuleTagRulesClientDiagnostics; + private readonly TagRulesRestOperations _monitoringTagRuleTagRulesRestClient; - /// Initializes a new instance of the class for mocking. - protected ElasticTagRuleCollection() + /// Initializes a new instance of the class for mocking. + protected MonitoringTagRuleCollection() { } - /// 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 ElasticTagRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal MonitoringTagRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticTagRuleTagRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ElasticTagRuleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ElasticTagRuleResource.ResourceType, out string elasticTagRuleTagRulesApiVersion); - _elasticTagRuleTagRulesRestClient = new TagRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticTagRuleTagRulesApiVersion); + _monitoringTagRuleTagRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", MonitoringTagRuleResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MonitoringTagRuleResource.ResourceType, out string monitoringTagRuleTagRulesApiVersion); + _monitoringTagRuleTagRulesRestClient = new TagRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, monitoringTagRuleTagRulesApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -60,15 +60,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// TagRules_CreateOrUpdate + /// MonitoringTagRules_CreateOrUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// 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 ruleSetName, ElasticTagRuleData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string ruleSetName, MonitoringTagRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleCollection.CreateOrUpdate"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _elasticTagRuleTagRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, data, cancellationToken).ConfigureAwait(false); - var uri = _elasticTagRuleTagRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, data); + var response = await _monitoringTagRuleTagRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, data, cancellationToken).ConfigureAwait(false); + var uri = _monitoringTagRuleTagRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ElasticArmOperation(Response.FromValue(new ElasticTagRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); + var operation = new ElasticArmOperation(Response.FromValue(new MonitoringTagRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -111,15 +111,15 @@ public virtual async Task> CreateOrUpdateAs /// /// /// Operation Id - /// TagRules_CreateOrUpdate + /// MonitoringTagRules_CreateOrUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -129,19 +129,19 @@ public virtual async Task> CreateOrUpdateAs /// 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 ruleSetName, ElasticTagRuleData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string ruleSetName, MonitoringTagRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleCollection.CreateOrUpdate"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.CreateOrUpdate"); scope.Start(); try { - var response = _elasticTagRuleTagRulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, data, cancellationToken); - var uri = _elasticTagRuleTagRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, data); + var response = _monitoringTagRuleTagRulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, data, cancellationToken); + var uri = _monitoringTagRuleTagRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ElasticArmOperation(Response.FromValue(new ElasticTagRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); + var operation = new ElasticArmOperation(Response.FromValue(new MonitoringTagRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -162,15 +162,15 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// /// /// Operation Id - /// TagRules_Get + /// MonitoringTagRules_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -178,18 +178,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string ruleSetName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string ruleSetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleCollection.Get"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.Get"); scope.Start(); try { - var response = await _elasticTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken).ConfigureAwait(false); + var response = await _monitoringTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticTagRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new MonitoringTagRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,15 +207,15 @@ public virtual async Task> GetAsync(string rule /// /// /// Operation Id - /// TagRules_Get + /// MonitoringTagRules_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -223,18 +223,18 @@ public virtual async Task> GetAsync(string rule /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string ruleSetName, CancellationToken cancellationToken = default) + public virtual Response Get(string ruleSetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleCollection.Get"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.Get"); scope.Start(); try { - var response = _elasticTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken); + var response = _monitoringTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticTagRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new MonitoringTagRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -252,25 +252,25 @@ public virtual Response Get(string ruleSetName, Cancella /// /// /// Operation Id - /// TagRules_List + /// MonitoringTagRules_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticTagRuleTagRulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticTagRuleTagRulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticTagRuleResource(Client, ElasticTagRuleData.DeserializeElasticTagRuleData(e)), _elasticTagRuleTagRulesClientDiagnostics, Pipeline, "ElasticTagRuleCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _monitoringTagRuleTagRulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _monitoringTagRuleTagRulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MonitoringTagRuleResource(Client, MonitoringTagRuleData.DeserializeMonitoringTagRuleData(e)), _monitoringTagRuleTagRulesClientDiagnostics, Pipeline, "MonitoringTagRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -282,25 +282,25 @@ public virtual AsyncPageable GetAllAsync(CancellationTok /// /// /// Operation Id - /// TagRules_List + /// MonitoringTagRules_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticTagRuleTagRulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticTagRuleTagRulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticTagRuleResource(Client, ElasticTagRuleData.DeserializeElasticTagRuleData(e)), _elasticTagRuleTagRulesClientDiagnostics, Pipeline, "ElasticTagRuleCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _monitoringTagRuleTagRulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _monitoringTagRuleTagRulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MonitoringTagRuleResource(Client, MonitoringTagRuleData.DeserializeMonitoringTagRuleData(e)), _monitoringTagRuleTagRulesClientDiagnostics, Pipeline, "MonitoringTagRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -312,15 +312,15 @@ public virtual Pageable GetAll(CancellationToken cancell /// /// /// Operation Id - /// TagRules_Get + /// MonitoringTagRules_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -332,11 +332,11 @@ public virtual async Task> ExistsAsync(string ruleSetName, Cancel { Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleCollection.Exists"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.Exists"); scope.Start(); try { - var response = await _elasticTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _monitoringTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -355,15 +355,15 @@ public virtual async Task> ExistsAsync(string ruleSetName, Cancel /// /// /// Operation Id - /// TagRules_Get + /// MonitoringTagRules_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -375,11 +375,11 @@ public virtual Response Exists(string ruleSetName, CancellationToken cance { Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleCollection.Exists"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.Exists"); scope.Start(); try { - var response = _elasticTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken); + var response = _monitoringTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -398,15 +398,15 @@ public virtual Response Exists(string ruleSetName, CancellationToken cance /// /// /// Operation Id - /// TagRules_Get + /// MonitoringTagRules_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -414,18 +414,18 @@ public virtual Response Exists(string ruleSetName, CancellationToken cance /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string ruleSetName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string ruleSetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleCollection.GetIfExists"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.GetIfExists"); scope.Start(); try { - var response = await _elasticTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _monitoringTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ElasticTagRuleResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitoringTagRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -443,15 +443,15 @@ public virtual async Task> GetIfExistsA /// /// /// Operation Id - /// TagRules_Get + /// MonitoringTagRules_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -459,18 +459,18 @@ public virtual async Task> GetIfExistsA /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string ruleSetName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string ruleSetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleCollection.GetIfExists"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleCollection.GetIfExists"); scope.Start(); try { - var response = _elasticTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken); + var response = _monitoringTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleSetName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ElasticTagRuleResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MonitoringTagRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -479,7 +479,7 @@ public virtual NullableResponse GetIfExists(string ruleS } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -489,7 +489,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/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleData.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleData.Serialization.cs similarity index 68% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleData.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleData.Serialization.cs index ee18dba76898..e3b2e14cdbb8 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleData.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.Elastic { - public partial class ElasticTagRuleData : IUtf8JsonSerializable, IJsonModel + public partial class MonitoringTagRuleData : 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, ModelReaderWrit /// 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(ElasticTagRuleData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MonitoringTagRuleData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -44,19 +44,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - ElasticTagRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MonitoringTagRuleData 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(ElasticTagRuleData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MonitoringTagRuleData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticTagRuleData(document.RootElement, options); + return DeserializeMonitoringTagRuleData(document.RootElement, options); } - internal static ElasticTagRuleData DeserializeElasticTagRuleData(JsonElement element, ModelReaderWriterOptions options = null) + internal static MonitoringTagRuleData DeserializeMonitoringTagRuleData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -64,7 +64,7 @@ internal static ElasticTagRuleData DeserializeElasticTagRuleData(JsonElement ele { return null; } - ElasticTagRuleProperties properties = default; + MonitoringTagRulesProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; @@ -79,7 +79,7 @@ internal static ElasticTagRuleData DeserializeElasticTagRuleData(JsonElement ele { continue; } - properties = ElasticTagRuleProperties.DeserializeElasticTagRuleProperties(property.Value, options); + properties = MonitoringTagRulesProperties.DeserializeMonitoringTagRulesProperties(property.Value, options); continue; } if (property.NameEquals("id"u8)) @@ -112,7 +112,7 @@ internal static ElasticTagRuleData DeserializeElasticTagRuleData(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticTagRuleData( + return new MonitoringTagRuleData( id, name, type, @@ -121,35 +121,35 @@ internal static ElasticTagRuleData DeserializeElasticTagRuleData(JsonElement ele 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticTagRuleData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MonitoringTagRuleData)} does not support writing '{options.Format}' format."); } } - ElasticTagRuleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MonitoringTagRuleData 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 DeserializeElasticTagRuleData(document.RootElement, options); + return DeserializeMonitoringTagRuleData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticTagRuleData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MonitoringTagRuleData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleData.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleData.cs similarity index 77% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleData.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleData.cs index dcd26af63a58..76db29118b32 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleData.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleData.cs @@ -14,10 +14,10 @@ namespace Azure.ResourceManager.Elastic { /// - /// A class representing the ElasticTagRule data model. + /// A class representing the MonitoringTagRule data model. /// Capture logs and metrics of Azure resources based on ARM tags. /// - public partial class ElasticTagRuleData : ResourceData + public partial class MonitoringTagRuleData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,25 +51,25 @@ public partial class ElasticTagRuleData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticTagRuleData() + /// Initializes a new instance of . + public MonitoringTagRuleData() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the monitoring tag rules. /// Keeps track of any properties unknown to the library. - internal ElasticTagRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ElasticTagRuleProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal MonitoringTagRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MonitoringTagRulesProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Properties of the monitoring tag rules. - public ElasticTagRuleProperties Properties { get; set; } + public MonitoringTagRulesProperties Properties { get; set; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleResource.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleResource.Serialization.cs new file mode 100644 index 000000000000..62158b8557e4 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleResource.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.Elastic +{ + public partial class MonitoringTagRuleResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + MonitoringTagRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticContext.Default); + + MonitoringTagRuleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleResource.cs similarity index 66% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleResource.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleResource.cs index 5d7fd479e613..4a2411aadfac 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticTagRuleResource.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleResource.cs @@ -15,14 +15,14 @@ namespace Azure.ResourceManager.Elastic { /// - /// A Class representing an ElasticTagRule 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 GetElasticTagRuleResource method. - /// Otherwise you can get one from its parent resource using the GetElasticTagRule method. + /// A Class representing a MonitoringTagRule 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 GetMonitoringTagRuleResource method. + /// Otherwise you can get one from its parent resource using the GetMonitoringTagRule method. /// - public partial class ElasticTagRuleResource : ArmResource + public partial class MonitoringTagRuleResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The monitorName. @@ -33,35 +33,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _elasticTagRuleTagRulesClientDiagnostics; - private readonly TagRulesRestOperations _elasticTagRuleTagRulesRestClient; - private readonly ElasticTagRuleData _data; + private readonly ClientDiagnostics _monitoringTagRuleTagRulesClientDiagnostics; + private readonly TagRulesRestOperations _monitoringTagRuleTagRulesRestClient; + private readonly MonitoringTagRuleData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Elastic/monitors/tagRules"; - /// Initializes a new instance of the class for mocking. - protected ElasticTagRuleResource() + /// Initializes a new instance of the class for mocking. + protected MonitoringTagRuleResource() { } - /// 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 ElasticTagRuleResource(ArmClient client, ElasticTagRuleData data) : this(client, data.Id) + internal MonitoringTagRuleResource(ArmClient client, MonitoringTagRuleData 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 ElasticTagRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal MonitoringTagRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticTagRuleTagRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string elasticTagRuleTagRulesApiVersion); - _elasticTagRuleTagRulesRestClient = new TagRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticTagRuleTagRulesApiVersion); + _monitoringTagRuleTagRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string monitoringTagRuleTagRulesApiVersion); + _monitoringTagRuleTagRulesRestClient = new TagRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, monitoringTagRuleTagRulesApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -72,7 +72,7 @@ internal ElasticTagRuleResource(ArmClient client, ResourceIdentifier id) : base( /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual ElasticTagRuleData Data + public virtual MonitoringTagRuleData Data { get { @@ -97,29 +97,29 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// TagRules_Get + /// MonitoringTagRules_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// 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 = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleResource.Get"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleResource.Get"); scope.Start(); try { - var response = await _elasticTagRuleTagRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _monitoringTagRuleTagRulesRestClient.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 ElasticTagRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new MonitoringTagRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -137,29 +137,29 @@ public virtual async Task> GetAsync(Cancellatio /// /// /// Operation Id - /// TagRules_Get + /// MonitoringTagRules_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleResource.Get"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleResource.Get"); scope.Start(); try { - var response = _elasticTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _monitoringTagRuleTagRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticTagRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new MonitoringTagRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -177,15 +177,15 @@ public virtual Response Get(CancellationToken cancellati /// /// /// Operation Id - /// TagRules_Delete + /// MonitoringTagRules_Delete /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -193,12 +193,12 @@ public virtual Response Get(CancellationToken cancellati /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleResource.Delete"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleResource.Delete"); scope.Start(); try { - var response = await _elasticTagRuleTagRulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ElasticArmOperation(_elasticTagRuleTagRulesClientDiagnostics, Pipeline, _elasticTagRuleTagRulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _monitoringTagRuleTagRulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ElasticArmOperation(_monitoringTagRuleTagRulesClientDiagnostics, Pipeline, _monitoringTagRuleTagRulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -219,15 +219,15 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// TagRules_Delete + /// MonitoringTagRules_Delete /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -235,12 +235,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleResource.Delete"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleResource.Delete"); scope.Start(); try { - var response = _elasticTagRuleTagRulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ElasticArmOperation(_elasticTagRuleTagRulesClientDiagnostics, Pipeline, _elasticTagRuleTagRulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _monitoringTagRuleTagRulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ElasticArmOperation(_monitoringTagRuleTagRulesClientDiagnostics, Pipeline, _monitoringTagRuleTagRulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -261,15 +261,15 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// TagRules_CreateOrUpdate + /// MonitoringTagRules_CreateOrUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -277,18 +277,18 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// request body of MonitoringTagRules. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticTagRuleData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, MonitoringTagRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleResource.Update"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleResource.Update"); scope.Start(); try { - var response = await _elasticTagRuleTagRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var uri = _elasticTagRuleTagRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var response = await _monitoringTagRuleTagRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _monitoringTagRuleTagRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ElasticArmOperation(Response.FromValue(new ElasticTagRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); + var operation = new ElasticArmOperation(Response.FromValue(new MonitoringTagRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -309,15 +309,15 @@ public virtual async Task> UpdateAsync(Wait /// /// /// Operation Id - /// TagRules_CreateOrUpdate + /// MonitoringTagRules_CreateOrUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -325,18 +325,18 @@ public virtual async Task> UpdateAsync(Wait /// request body of MonitoringTagRules. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ElasticTagRuleData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, MonitoringTagRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticTagRuleTagRulesClientDiagnostics.CreateScope("ElasticTagRuleResource.Update"); + using var scope = _monitoringTagRuleTagRulesClientDiagnostics.CreateScope("MonitoringTagRuleResource.Update"); scope.Start(); try { - var response = _elasticTagRuleTagRulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _elasticTagRuleTagRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var response = _monitoringTagRuleTagRulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _monitoringTagRuleTagRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ElasticArmOperation(Response.FromValue(new ElasticTagRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); + var operation = new ElasticArmOperation(Response.FromValue(new MonitoringTagRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationCollection.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelCollection.cs similarity index 64% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationCollection.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelCollection.cs index 031dc53945e0..ea110be86975 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationCollection.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelCollection.cs @@ -18,28 +18,28 @@ namespace Azure.ResourceManager.Elastic { /// - /// 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 GetElasticOpenAIIntegrations method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetOpenAIIntegrationRPModels method from an instance of . /// - public partial class ElasticOpenAIIntegrationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class OpenAIIntegrationRPModelCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _elasticOpenAIIntegrationOpenAIClientDiagnostics; - private readonly OpenAIRestOperations _elasticOpenAIIntegrationOpenAIRestClient; + private readonly ClientDiagnostics _openAIIntegrationRPModelClientDiagnostics; + private readonly OpenAIIntegrationRPModelsRestOperations _openAIIntegrationRPModelRestClient; - /// Initializes a new instance of the class for mocking. - protected ElasticOpenAIIntegrationCollection() + /// Initializes a new instance of the class for mocking. + protected OpenAIIntegrationRPModelCollection() { } - /// 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 ElasticOpenAIIntegrationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal OpenAIIntegrationRPModelCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticOpenAIIntegrationOpenAIClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ElasticOpenAIIntegrationResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ElasticOpenAIIntegrationResource.ResourceType, out string elasticOpenAIIntegrationOpenAIApiVersion); - _elasticOpenAIIntegrationOpenAIRestClient = new OpenAIRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticOpenAIIntegrationOpenAIApiVersion); + _openAIIntegrationRPModelClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", OpenAIIntegrationRPModelResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(OpenAIIntegrationRPModelResource.ResourceType, out string openAIIntegrationRPModelApiVersion); + _openAIIntegrationRPModelRestClient = new OpenAIIntegrationRPModelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, openAIIntegrationRPModelApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -60,37 +60,37 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// OpenAI_CreateOrUpdate + /// OpenAIIntegrationRPModel_CreateOrUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-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. /// OpenAI Integration name. - /// The to use. + /// The to use. /// 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 integrationName, ElasticOpenAIIntegrationData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string integrationName, OpenAIIntegrationRPModelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationCollection.CreateOrUpdate"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _elasticOpenAIIntegrationOpenAIRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, data, cancellationToken).ConfigureAwait(false); - var uri = _elasticOpenAIIntegrationOpenAIRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, data); + var response = await _openAIIntegrationRPModelRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, data, cancellationToken).ConfigureAwait(false); + var uri = _openAIIntegrationRPModelRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ElasticArmOperation(Response.FromValue(new ElasticOpenAIIntegrationResource(Client, response), response.GetRawResponse()), rehydrationToken); + var operation = new ElasticArmOperation(Response.FromValue(new OpenAIIntegrationRPModelResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -111,37 +111,37 @@ public virtual async Task> Create /// /// /// Operation Id - /// OpenAI_CreateOrUpdate + /// OpenAIIntegrationRPModel_CreateOrUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-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. /// OpenAI Integration name. - /// The to use. + /// The to use. /// 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 integrationName, ElasticOpenAIIntegrationData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string integrationName, OpenAIIntegrationRPModelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationCollection.CreateOrUpdate"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelCollection.CreateOrUpdate"); scope.Start(); try { - var response = _elasticOpenAIIntegrationOpenAIRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, data, cancellationToken); - var uri = _elasticOpenAIIntegrationOpenAIRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, data); + var response = _openAIIntegrationRPModelRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, data, cancellationToken); + var uri = _openAIIntegrationRPModelRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ElasticArmOperation(Response.FromValue(new ElasticOpenAIIntegrationResource(Client, response), response.GetRawResponse()), rehydrationToken); + var operation = new ElasticArmOperation(Response.FromValue(new OpenAIIntegrationRPModelResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -162,15 +162,15 @@ public virtual ArmOperation CreateOrUpdate(Wai /// /// /// Operation Id - /// OpenAI_Get + /// OpenAIIntegrationRPModel_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -178,18 +178,18 @@ public virtual ArmOperation CreateOrUpdate(Wai /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string integrationName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string integrationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationCollection.Get"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelCollection.Get"); scope.Start(); try { - var response = await _elasticOpenAIIntegrationOpenAIRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken).ConfigureAwait(false); + var response = await _openAIIntegrationRPModelRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticOpenAIIntegrationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OpenAIIntegrationRPModelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,15 +207,15 @@ public virtual async Task> GetAsync(s /// /// /// Operation Id - /// OpenAI_Get + /// OpenAIIntegrationRPModel_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -223,18 +223,18 @@ public virtual async Task> GetAsync(s /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string integrationName, CancellationToken cancellationToken = default) + public virtual Response Get(string integrationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationCollection.Get"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelCollection.Get"); scope.Start(); try { - var response = _elasticOpenAIIntegrationOpenAIRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken); + var response = _openAIIntegrationRPModelRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticOpenAIIntegrationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OpenAIIntegrationRPModelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -252,25 +252,25 @@ public virtual Response Get(string integration /// /// /// Operation Id - /// OpenAI_List + /// OpenAIIntegrationRPModel_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticOpenAIIntegrationOpenAIRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticOpenAIIntegrationOpenAIRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticOpenAIIntegrationResource(Client, ElasticOpenAIIntegrationData.DeserializeElasticOpenAIIntegrationData(e)), _elasticOpenAIIntegrationOpenAIClientDiagnostics, Pipeline, "ElasticOpenAIIntegrationCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _openAIIntegrationRPModelRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _openAIIntegrationRPModelRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OpenAIIntegrationRPModelResource(Client, OpenAIIntegrationRPModelData.DeserializeOpenAIIntegrationRPModelData(e)), _openAIIntegrationRPModelClientDiagnostics, Pipeline, "OpenAIIntegrationRPModelCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -282,25 +282,25 @@ public virtual AsyncPageable GetAllAsync(Cance /// /// /// Operation Id - /// OpenAI_List + /// OpenAIIntegrationRPModel_List /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticOpenAIIntegrationOpenAIRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticOpenAIIntegrationOpenAIRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticOpenAIIntegrationResource(Client, ElasticOpenAIIntegrationData.DeserializeElasticOpenAIIntegrationData(e)), _elasticOpenAIIntegrationOpenAIClientDiagnostics, Pipeline, "ElasticOpenAIIntegrationCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _openAIIntegrationRPModelRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _openAIIntegrationRPModelRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OpenAIIntegrationRPModelResource(Client, OpenAIIntegrationRPModelData.DeserializeOpenAIIntegrationRPModelData(e)), _openAIIntegrationRPModelClientDiagnostics, Pipeline, "OpenAIIntegrationRPModelCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -312,15 +312,15 @@ public virtual Pageable GetAll(CancellationTok /// /// /// Operation Id - /// OpenAI_Get + /// OpenAIIntegrationRPModel_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -332,11 +332,11 @@ public virtual async Task> ExistsAsync(string integrationName, Ca { Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationCollection.Exists"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelCollection.Exists"); scope.Start(); try { - var response = await _elasticOpenAIIntegrationOpenAIRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _openAIIntegrationRPModelRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -355,15 +355,15 @@ public virtual async Task> ExistsAsync(string integrationName, Ca /// /// /// Operation Id - /// OpenAI_Get + /// OpenAIIntegrationRPModel_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -375,11 +375,11 @@ public virtual Response Exists(string integrationName, CancellationToken c { Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationCollection.Exists"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelCollection.Exists"); scope.Start(); try { - var response = _elasticOpenAIIntegrationOpenAIRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken: cancellationToken); + var response = _openAIIntegrationRPModelRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -398,15 +398,15 @@ public virtual Response Exists(string integrationName, CancellationToken c /// /// /// Operation Id - /// OpenAI_Get + /// OpenAIIntegrationRPModel_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -414,18 +414,18 @@ public virtual Response Exists(string integrationName, 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 integrationName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string integrationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationCollection.GetIfExists"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelCollection.GetIfExists"); scope.Start(); try { - var response = await _elasticOpenAIIntegrationOpenAIRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _openAIIntegrationRPModelRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ElasticOpenAIIntegrationResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OpenAIIntegrationRPModelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -443,15 +443,15 @@ public virtual async Task> Ge /// /// /// Operation Id - /// OpenAI_Get + /// OpenAIIntegrationRPModel_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -459,18 +459,18 @@ public virtual async Task> Ge /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string integrationName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string integrationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationCollection.GetIfExists"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelCollection.GetIfExists"); scope.Start(); try { - var response = _elasticOpenAIIntegrationOpenAIRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken: cancellationToken); + var response = _openAIIntegrationRPModelRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, integrationName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ElasticOpenAIIntegrationResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OpenAIIntegrationRPModelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -479,7 +479,7 @@ public virtual NullableResponse GetIfExists(st } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -489,7 +489,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/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationData.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelData.Serialization.cs similarity index 73% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationData.Serialization.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelData.Serialization.cs index 8cd07c09c25f..5462473796c8 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationData.Serialization.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelData.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.Elastic { - public partial class ElasticOpenAIIntegrationData : IUtf8JsonSerializable, IJsonModel + public partial class OpenAIIntegrationRPModelData : 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, Model /// 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(ElasticOpenAIIntegrationData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationRPModelData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -44,19 +44,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - ElasticOpenAIIntegrationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + OpenAIIntegrationRPModelData 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(ElasticOpenAIIntegrationData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationRPModelData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeElasticOpenAIIntegrationData(document.RootElement, options); + return DeserializeOpenAIIntegrationRPModelData(document.RootElement, options); } - internal static ElasticOpenAIIntegrationData DeserializeElasticOpenAIIntegrationData(JsonElement element, ModelReaderWriterOptions options = null) + internal static OpenAIIntegrationRPModelData DeserializeOpenAIIntegrationRPModelData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -64,7 +64,7 @@ internal static ElasticOpenAIIntegrationData DeserializeElasticOpenAIIntegration { return null; } - ElasticOpenAIIntegrationProperties properties = default; + OpenAIIntegrationProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; @@ -79,7 +79,7 @@ internal static ElasticOpenAIIntegrationData DeserializeElasticOpenAIIntegration { continue; } - properties = ElasticOpenAIIntegrationProperties.DeserializeElasticOpenAIIntegrationProperties(property.Value, options); + properties = OpenAIIntegrationProperties.DeserializeOpenAIIntegrationProperties(property.Value, options); continue; } if (property.NameEquals("id"u8)) @@ -112,7 +112,7 @@ internal static ElasticOpenAIIntegrationData DeserializeElasticOpenAIIntegration } } serializedAdditionalRawData = rawDataDictionary; - return new ElasticOpenAIIntegrationData( + return new OpenAIIntegrationRPModelData( id, name, type, @@ -121,35 +121,35 @@ internal static ElasticOpenAIIntegrationData DeserializeElasticOpenAIIntegration 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, AzureResourceManagerElasticContext.Default); default: - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationRPModelData)} does not support writing '{options.Format}' format."); } } - ElasticOpenAIIntegrationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + OpenAIIntegrationRPModelData 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 DeserializeElasticOpenAIIntegrationData(document.RootElement, options); + return DeserializeOpenAIIntegrationRPModelData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ElasticOpenAIIntegrationData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(OpenAIIntegrationRPModelData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationData.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelData.cs similarity index 78% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationData.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelData.cs index cd8d0f643d27..ac19f4c34fb4 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationData.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelData.cs @@ -14,10 +14,10 @@ namespace Azure.ResourceManager.Elastic { /// - /// A class representing the ElasticOpenAIIntegration data model. + /// A class representing the OpenAIIntegrationRPModel data model. /// Capture properties of Open AI resource Integration. /// - public partial class ElasticOpenAIIntegrationData : ResourceData + public partial class OpenAIIntegrationRPModelData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,25 +51,25 @@ public partial class ElasticOpenAIIntegrationData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ElasticOpenAIIntegrationData() + /// Initializes a new instance of . + public OpenAIIntegrationRPModelData() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Open AI Integration details. /// Keeps track of any properties unknown to the library. - internal ElasticOpenAIIntegrationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ElasticOpenAIIntegrationProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal OpenAIIntegrationRPModelData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, OpenAIIntegrationProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Open AI Integration details. - public ElasticOpenAIIntegrationProperties Properties { get; set; } + public OpenAIIntegrationProperties Properties { get; set; } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelResource.Serialization.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelResource.Serialization.cs new file mode 100644 index 000000000000..09b6234dc7ac --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelResource.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.Elastic +{ + public partial class OpenAIIntegrationRPModelResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + OpenAIIntegrationRPModelData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerElasticContext.Default); + + OpenAIIntegrationRPModelData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerElasticContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelResource.cs similarity index 67% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationResource.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelResource.cs index 88209c6a38b2..70f9e7e4b8ba 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticOpenAIIntegrationResource.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/OpenAIIntegrationRPModelResource.cs @@ -16,14 +16,14 @@ namespace Azure.ResourceManager.Elastic { /// - /// A Class representing an ElasticOpenAIIntegration 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 GetElasticOpenAIIntegrationResource method. - /// Otherwise you can get one from its parent resource using the GetElasticOpenAIIntegration method. + /// A Class representing an OpenAIIntegrationRPModel 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 GetOpenAIIntegrationRPModelResource method. + /// Otherwise you can get one from its parent resource using the GetOpenAIIntegrationRPModel method. /// - public partial class ElasticOpenAIIntegrationResource : ArmResource + public partial class OpenAIIntegrationRPModelResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The monitorName. @@ -34,35 +34,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _elasticOpenAIIntegrationOpenAIClientDiagnostics; - private readonly OpenAIRestOperations _elasticOpenAIIntegrationOpenAIRestClient; - private readonly ElasticOpenAIIntegrationData _data; + private readonly ClientDiagnostics _openAIIntegrationRPModelClientDiagnostics; + private readonly OpenAIIntegrationRPModelsRestOperations _openAIIntegrationRPModelRestClient; + private readonly OpenAIIntegrationRPModelData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Elastic/monitors/openAIIntegrations"; - /// Initializes a new instance of the class for mocking. - protected ElasticOpenAIIntegrationResource() + /// Initializes a new instance of the class for mocking. + protected OpenAIIntegrationRPModelResource() { } - /// 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 ElasticOpenAIIntegrationResource(ArmClient client, ElasticOpenAIIntegrationData data) : this(client, data.Id) + internal OpenAIIntegrationRPModelResource(ArmClient client, OpenAIIntegrationRPModelData 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 ElasticOpenAIIntegrationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal OpenAIIntegrationRPModelResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _elasticOpenAIIntegrationOpenAIClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string elasticOpenAIIntegrationOpenAIApiVersion); - _elasticOpenAIIntegrationOpenAIRestClient = new OpenAIRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticOpenAIIntegrationOpenAIApiVersion); + _openAIIntegrationRPModelClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Elastic", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string openAIIntegrationRPModelApiVersion); + _openAIIntegrationRPModelRestClient = new OpenAIIntegrationRPModelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, openAIIntegrationRPModelApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -73,7 +73,7 @@ internal ElasticOpenAIIntegrationResource(ArmClient client, ResourceIdentifier i /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual ElasticOpenAIIntegrationData Data + public virtual OpenAIIntegrationRPModelData Data { get { @@ -98,29 +98,29 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// OpenAI_Get + /// OpenAIIntegrationRPModel_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// 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 = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationResource.Get"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelResource.Get"); scope.Start(); try { - var response = await _elasticOpenAIIntegrationOpenAIRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _openAIIntegrationRPModelRestClient.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 ElasticOpenAIIntegrationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OpenAIIntegrationRPModelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -138,29 +138,29 @@ public virtual async Task> GetAsync(C /// /// /// Operation Id - /// OpenAI_Get + /// OpenAIIntegrationRPModel_Get /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationResource.Get"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelResource.Get"); scope.Start(); try { - var response = _elasticOpenAIIntegrationOpenAIRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _openAIIntegrationRPModelRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ElasticOpenAIIntegrationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new OpenAIIntegrationRPModelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -178,15 +178,15 @@ public virtual Response Get(CancellationToken /// /// /// Operation Id - /// OpenAI_Delete + /// OpenAIIntegrationRPModel_Delete /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -194,12 +194,12 @@ public virtual Response Get(CancellationToken /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationResource.Delete"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelResource.Delete"); scope.Start(); try { - var response = await _elasticOpenAIIntegrationOpenAIRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _elasticOpenAIIntegrationOpenAIRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var response = await _openAIIntegrationRPModelRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _openAIIntegrationRPModelRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new ElasticArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -222,15 +222,15 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// OpenAI_Delete + /// OpenAIIntegrationRPModel_Delete /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// @@ -238,12 +238,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 = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationResource.Delete"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelResource.Delete"); scope.Start(); try { - var response = _elasticOpenAIIntegrationOpenAIRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _elasticOpenAIIntegrationOpenAIRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var response = _openAIIntegrationRPModelRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _openAIIntegrationRPModelRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new ElasticArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -266,34 +266,34 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// OpenAI_CreateOrUpdate + /// OpenAIIntegrationRPModel_CreateOrUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-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 to use. + /// The to use. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticOpenAIIntegrationData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, OpenAIIntegrationRPModelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationResource.Update"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelResource.Update"); scope.Start(); try { - var response = await _elasticOpenAIIntegrationOpenAIRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var uri = _elasticOpenAIIntegrationOpenAIRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var response = await _openAIIntegrationRPModelRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _openAIIntegrationRPModelRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ElasticArmOperation(Response.FromValue(new ElasticOpenAIIntegrationResource(Client, response), response.GetRawResponse()), rehydrationToken); + var operation = new ElasticArmOperation(Response.FromValue(new OpenAIIntegrationRPModelResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -314,34 +314,34 @@ public virtual async Task> Update /// /// /// Operation Id - /// OpenAI_CreateOrUpdate + /// OpenAIIntegrationRPModel_CreateOrUpdate /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-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 to use. + /// The to use. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ElasticOpenAIIntegrationData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, OpenAIIntegrationRPModelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationResource.Update"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelResource.Update"); scope.Start(); try { - var response = _elasticOpenAIIntegrationOpenAIRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _elasticOpenAIIntegrationOpenAIRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var response = _openAIIntegrationRPModelRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _openAIIntegrationRPModelRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ElasticArmOperation(Response.FromValue(new ElasticOpenAIIntegrationResource(Client, response), response.GetRawResponse()), rehydrationToken); + var operation = new ElasticArmOperation(Response.FromValue(new OpenAIIntegrationRPModelResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -362,26 +362,26 @@ public virtual ArmOperation Update(WaitUntil w /// /// /// Operation Id - /// OpenAI_GetStatus + /// OpenAIIntegrationRPModels_GetStatus /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetStatusAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetStatusAsync(CancellationToken cancellationToken = default) { - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationResource.GetStatus"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelResource.GetStatus"); scope.Start(); try { - var response = await _elasticOpenAIIntegrationOpenAIRestClient.GetStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _openAIIntegrationRPModelRestClient.GetStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -400,26 +400,26 @@ public virtual async Task> GetSta /// /// /// Operation Id - /// OpenAI_GetStatus + /// OpenAIIntegrationRPModels_GetStatus /// /// /// Default Api Version - /// 2024-03-01 + /// 2025-01-15-preview /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response GetStatus(CancellationToken cancellationToken = default) + public virtual Response GetStatus(CancellationToken cancellationToken = default) { - using var scope = _elasticOpenAIIntegrationOpenAIClientDiagnostics.CreateScope("ElasticOpenAIIntegrationResource.GetStatus"); + using var scope = _openAIIntegrationRPModelClientDiagnostics.CreateScope("OpenAIIntegrationRPModelResource.GetStatus"); scope.Start(); try { - var response = _elasticOpenAIIntegrationOpenAIRestClient.GetStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _openAIIntegrationRPModelRestClient.GetStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/AllTrafficFiltersRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/AllTrafficFiltersRestOperations.cs deleted file mode 100644 index 429b68647952..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/AllTrafficFiltersRestOperations.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.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class AllTrafficFiltersRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of AllTrafficFiltersRestOperations. - /// 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 AllTrafficFiltersRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listAllTrafficFilters", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listAllTrafficFilters", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get the list of all traffic filters for the account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ElasticTrafficFilterListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticTrafficFilterListResult.DeserializeElasticTrafficFilterListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the list of all traffic filters for the account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ElasticTrafficFilterListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticTrafficFilterListResult.DeserializeElasticTrafficFilterListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/AssociateTrafficFilterRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/AssociateTrafficFilterRestOperations.cs deleted file mode 100644 index a0daa634ddd7..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/AssociateTrafficFilterRestOperations.cs +++ /dev/null @@ -1,131 +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.Elastic -{ - internal partial class AssociateTrafficFilterRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of AssociateTrafficFilterRestOperations. - /// 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 AssociateTrafficFilterRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateAssociateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/associateTrafficFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (rulesetId != null) - { - uri.AppendQuery("rulesetId", rulesetId, true); - } - return uri; - } - - internal HttpMessage CreateAssociateRequest(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/associateTrafficFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (rulesetId != null) - { - uri.AppendQuery("rulesetId", rulesetId, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Associate traffic filter for the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Ruleset Id of the filter. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task AssociateAsync(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateAssociateRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Associate traffic filter for the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Ruleset Id of the filter. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Associate(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateAssociateRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/BillingInfoRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/BillingInfoRestOperations.cs deleted file mode 100644 index 6ab03bb4c1bb..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/BillingInfoRestOperations.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.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class BillingInfoRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of BillingInfoRestOperations. - /// 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 BillingInfoRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/getBillingInfo", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/getBillingInfo", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get marketplace and organization info mapped to the given monitor. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// 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 monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ElasticBillingInfoResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticBillingInfoResult.DeserializeElasticBillingInfoResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get marketplace and organization info mapped to the given monitor. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// 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 monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ElasticBillingInfoResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticBillingInfoResult.DeserializeElasticBillingInfoResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ConnectedPartnerResourcesRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ConnectedPartnerResourcesRestOperations.cs deleted file mode 100644 index 49a07b77b268..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ConnectedPartnerResourcesRestOperations.cs +++ /dev/null @@ -1,217 +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.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class ConnectedPartnerResourcesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of ConnectedPartnerResourcesRestOperations. - /// 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 ConnectedPartnerResourcesRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listConnectedPartnerResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listConnectedPartnerResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List of all active deployments that are associated with the marketplace subscription linked to the given monitor. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ConnectedPartnerResourcesListResponse value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ConnectedPartnerResourcesListResponse.DeserializeConnectedPartnerResourcesListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List of all active deployments that are associated with the marketplace subscription linked to the given monitor. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ConnectedPartnerResourcesListResponse value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ConnectedPartnerResourcesListResponse.DeserializeConnectedPartnerResourcesListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) - { - 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 of all active deployments that are associated with the marketplace subscription linked to the given monitor. - /// 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. - /// Monitor resource name. - /// 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 monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ConnectedPartnerResourcesListResponse value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ConnectedPartnerResourcesListResponse.DeserializeConnectedPartnerResourcesListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List of all active deployments that are associated with the marketplace subscription linked to the given monitor. - /// 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. - /// Monitor resource name. - /// 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 monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ConnectedPartnerResourcesListResponse value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ConnectedPartnerResourcesListResponse.DeserializeConnectedPartnerResourcesListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/CreateAndAssociateIPFilterRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/CreateAndAssociateIPFilterRestOperations.cs deleted file mode 100644 index b7c84b09eb35..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/CreateAndAssociateIPFilterRestOperations.cs +++ /dev/null @@ -1,143 +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.Elastic -{ - internal partial class CreateAndAssociateIPFilterRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of CreateAndAssociateIPFilterRestOperations. - /// 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 CreateAndAssociateIPFilterRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string ips, string name) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/createAndAssociateIPFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (ips != null) - { - uri.AppendQuery("ips", ips, true); - } - if (name != null) - { - uri.AppendQuery("name", name, true); - } - return uri; - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string monitorName, string ips, string name) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/createAndAssociateIPFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (ips != null) - { - uri.AppendQuery("ips", ips, true); - } - if (name != null) - { - uri.AppendQuery("name", name, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Create and Associate IP traffic filter for the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// List of ips. - /// Name of the traffic filter. - /// 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 monitorName, string ips = null, string name = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, monitorName, ips, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create and Associate IP traffic filter for the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// List of ips. - /// Name of the traffic filter. - /// 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 monitorName, string ips = null, string name = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, monitorName, ips, name); - _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/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/CreateAndAssociatePLFilterRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/CreateAndAssociatePLFilterRestOperations.cs deleted file mode 100644 index e94c0d94dfda..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/CreateAndAssociatePLFilterRestOperations.cs +++ /dev/null @@ -1,153 +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.Elastic -{ - internal partial class CreateAndAssociatePLFilterRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of CreateAndAssociatePLFilterRestOperations. - /// 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 CreateAndAssociatePLFilterRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string name, string privateEndpointGuid, string privateEndpointName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/createAndAssociatePLFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (name != null) - { - uri.AppendQuery("name", name, true); - } - if (privateEndpointGuid != null) - { - uri.AppendQuery("privateEndpointGuid", privateEndpointGuid, true); - } - if (privateEndpointName != null) - { - uri.AppendQuery("privateEndpointName", privateEndpointName, true); - } - return uri; - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string monitorName, string name, string privateEndpointGuid, string privateEndpointName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/createAndAssociatePLFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (name != null) - { - uri.AppendQuery("name", name, true); - } - if (privateEndpointGuid != null) - { - uri.AppendQuery("privateEndpointGuid", privateEndpointGuid, true); - } - if (privateEndpointName != null) - { - uri.AppendQuery("privateEndpointName", privateEndpointName, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Create and Associate private link traffic filter for the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Name of the traffic filter. - /// Guid of the private endpoint. - /// Name of the private endpoint. - /// 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 monitorName, string name = null, string privateEndpointGuid = null, string privateEndpointName = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create and Associate private link traffic filter for the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Name of the traffic filter. - /// Guid of the private endpoint. - /// Name of the private endpoint. - /// 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 monitorName, string name = null, string privateEndpointGuid = null, string privateEndpointName = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName); - _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/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/DeploymentInfoRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/DeploymentInfoRestOperations.cs deleted file mode 100644 index 302c83b60bfb..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/DeploymentInfoRestOperations.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.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class DeploymentInfoRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of DeploymentInfoRestOperations. - /// 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 DeploymentInfoRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listDeploymentInfo", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listDeploymentInfo", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ElasticDeploymentInfoResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticDeploymentInfoResult.DeserializeElasticDeploymentInfoResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ElasticDeploymentInfoResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticDeploymentInfoResult.DeserializeElasticDeploymentInfoResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/DetachAndDeleteTrafficFilterRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/DetachAndDeleteTrafficFilterRestOperations.cs deleted file mode 100644 index 42c6f2527eb3..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/DetachAndDeleteTrafficFilterRestOperations.cs +++ /dev/null @@ -1,131 +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.Elastic -{ - internal partial class DetachAndDeleteTrafficFilterRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of DetachAndDeleteTrafficFilterRestOperations. - /// 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 DetachAndDeleteTrafficFilterRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/detachAndDeleteTrafficFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (rulesetId != null) - { - uri.AppendQuery("rulesetId", rulesetId, true); - } - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/detachAndDeleteTrafficFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (rulesetId != null) - { - uri.AppendQuery("rulesetId", rulesetId, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Detach and Delete traffic filter from the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Ruleset Id of the filter. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Detach and Delete traffic filter from the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Ruleset Id of the filter. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/DetachTrafficFilterRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/DetachTrafficFilterRestOperations.cs deleted file mode 100644 index c6de3c6b05b7..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/DetachTrafficFilterRestOperations.cs +++ /dev/null @@ -1,131 +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.Elastic -{ - internal partial class DetachTrafficFilterRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of DetachTrafficFilterRestOperations. - /// 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 DetachTrafficFilterRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/detachTrafficFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (rulesetId != null) - { - uri.AppendQuery("rulesetId", rulesetId, true); - } - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/detachTrafficFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (rulesetId != null) - { - uri.AppendQuery("rulesetId", rulesetId, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Detach traffic filter for the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Ruleset Id of the filter. - /// 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 monitorName, string rulesetId = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Detach traffic filter for the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Ruleset Id of the filter. - /// 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 monitorName, string rulesetId = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ElasticMonitorResourcesRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ElasticMonitorResourcesRestOperations.cs new file mode 100644 index 000000000000..891a86cfbbf5 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ElasticMonitorResourcesRestOperations.cs @@ -0,0 +1,2805 @@ +// 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.Elastic.Models; + +namespace Azure.ResourceManager.Elastic +{ + internal partial class ElasticMonitorResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ElasticMonitorResourcesRestOperations. + /// 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 ElasticMonitorResourcesRestOperations(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 ?? "2025-01-15-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the properties of a specific monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// 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 monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ElasticMonitorResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ElasticMonitorResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the properties of a specific monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// 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 monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ElasticMonitorResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ElasticMonitorResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorResourceData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Elastic monitor resource model. + /// 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 monitorName, ElasticMonitorResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, monitorName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Elastic monitor resource model. + /// 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 monitorName, ElasticMonitorResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, monitorName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorResourcePatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorResourcePatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Elastic resource model update parameters. + /// 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 monitorName, ElasticMonitorResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, monitorName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Elastic resource model update parameters. + /// 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 monitorName, ElasticMonitorResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, monitorName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName); + _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 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.Elastic/monitors", 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.Elastic/monitors", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all monitors under the specified 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: + { + ElasticMonitorResourceListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all monitors under the specified 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: + { + ElasticMonitorResourceListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Elastic/monitors", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Elastic/monitors", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all monitors under the specified 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> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ElasticMonitorResourceListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all monitors under the specified 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 List(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ElasticMonitorResourceListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateMonitoredResourcesListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listMonitoredResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateMonitoredResourcesListRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listMonitoredResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the resources currently being monitored by the Elastic monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> MonitoredResourcesListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateMonitoredResourcesListRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MonitoredResourceListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MonitoredResourceListResponse.DeserializeMonitoredResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the resources currently being monitored by the Elastic monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response MonitoredResourcesList(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateMonitoredResourcesListRequest(subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MonitoredResourceListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MonitoredResourceListResponse.DeserializeMonitoredResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeploymentInfoListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listDeploymentInfo", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeploymentInfoListRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listDeploymentInfo", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> DeploymentInfoListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateDeploymentInfoListRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentInfoResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DeploymentInfoResponse.DeserializeDeploymentInfoResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response DeploymentInfoList(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateDeploymentInfoListRequest(subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentInfoResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DeploymentInfoResponse.DeserializeDeploymentInfoResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, ExternalUserContent 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/createOrUpdateExternalUser", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, ExternalUserContent 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/createOrUpdateExternalUser", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (content != null) + { + 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; + } + + /// Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Elastic External User Creation Parameters. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string monitorName, ExternalUserContent content = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, monitorName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ExternalUserCreationResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ExternalUserCreationResponse.DeserializeExternalUserCreationResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Elastic External User Creation Parameters. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string monitorName, ExternalUserContent content = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, monitorName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ExternalUserCreationResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ExternalUserCreationResponse.DeserializeExternalUserCreationResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateBillingInfoGetRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/getBillingInfo", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateBillingInfoGetRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/getBillingInfo", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get marketplace and organization info mapped to the given monitor. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> BillingInfoGetAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateBillingInfoGetRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BillingInfoResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = BillingInfoResponse.DeserializeBillingInfoResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get marketplace and organization info mapped to the given monitor. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response BillingInfoGet(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateBillingInfoGetRequest(subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BillingInfoResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = BillingInfoResponse.DeserializeBillingInfoResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateConnectedPartnerResourcesListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listConnectedPartnerResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateConnectedPartnerResourcesListRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listConnectedPartnerResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List of all active deployments that are associated with the marketplace subscription linked to the given monitor. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ConnectedPartnerResourcesListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateConnectedPartnerResourcesListRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConnectedPartnerResourcesListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ConnectedPartnerResourcesListResponse.DeserializeConnectedPartnerResourcesListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List of all active deployments that are associated with the marketplace subscription linked to the given monitor. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ConnectedPartnerResourcesList(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateConnectedPartnerResourcesListRequest(subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConnectedPartnerResourcesListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ConnectedPartnerResourcesListResponse.DeserializeConnectedPartnerResourcesListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateVmHostListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listVMHost", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateVmHostListRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listVMHost", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the vm resources currently being monitored by the Elastic monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> VmHostListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateVmHostListRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + VmHostListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = VmHostListResponse.DeserializeVmHostListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the vm resources currently being monitored by the Elastic monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response VmHostList(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateVmHostListRequest(subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + VmHostListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = VmHostListResponse.DeserializeVmHostListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDetailsRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/vmIngestionDetails", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDetailsRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/vmIngestionDetails", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the vm ingestion details that will be monitored by the Elastic monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> DetailsAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateDetailsRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + VmIngestionDetailsResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = VmIngestionDetailsResponse.DeserializeVmIngestionDetailsResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the vm ingestion details that will be monitored by the Elastic monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Details(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateDetailsRequest(subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + VmIngestionDetailsResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = VmIngestionDetailsResponse.DeserializeVmIngestionDetailsResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateVmCollectionUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, VmCollectionUpdate body) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/vmCollectionUpdate", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateVmCollectionUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, VmCollectionUpdate body) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/vmCollectionUpdate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (body != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body, ModelSerializationExtensions.WireOptions); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Update the vm details that will be monitored by the Elastic monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// VM resource Id. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task VmCollectionUpdateAsync(string subscriptionId, string resourceGroupName, string monitorName, VmCollectionUpdate body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateVmCollectionUpdateRequest(subscriptionId, resourceGroupName, monitorName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update the vm details that will be monitored by the Elastic monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// VM resource Id. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response VmCollectionUpdate(string subscriptionId, string resourceGroupName, string monitorName, VmCollectionUpdate body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateVmCollectionUpdateRequest(subscriptionId, resourceGroupName, monitorName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpgradableVersionsDetailsRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listUpgradableVersions", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpgradableVersionsDetailsRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listUpgradableVersions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List of upgradable versions for a given monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpgradableVersionsDetailsAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateUpgradableVersionsDetailsRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UpgradableVersionsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = UpgradableVersionsList.DeserializeUpgradableVersionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List of upgradable versions for a given monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpgradableVersionsDetails(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateUpgradableVersionsDetailsRequest(subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UpgradableVersionsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = UpgradableVersionsList.DeserializeUpgradableVersionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpgradeRequestUri(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorUpgrade body) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/upgrade", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpgradeRequest(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorUpgrade body) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/upgrade", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (body != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body, ModelSerializationExtensions.WireOptions); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Upgradable version for a monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Elastic Monitor Upgrade Parameters. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpgradeAsync(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorUpgrade body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateUpgradeRequest(subscriptionId, resourceGroupName, monitorName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Upgradable version for a monitor resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Elastic Monitor Upgrade Parameters. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Upgrade(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorUpgrade body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateUpgradeRequest(subscriptionId, resourceGroupName, monitorName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateAllTrafficFiltersListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listAllTrafficFilters", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateAllTrafficFiltersListRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listAllTrafficFilters", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of all traffic filters for the account. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> AllTrafficFiltersListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateAllTrafficFiltersListRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ElasticTrafficFilterResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticTrafficFilterResponse.DeserializeElasticTrafficFilterResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of all traffic filters for the account. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response AllTrafficFiltersList(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateAllTrafficFiltersListRequest(subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ElasticTrafficFilterResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticTrafficFilterResponse.DeserializeElasticTrafficFilterResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListAssociatedTrafficFiltersListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listAssociatedTrafficFilters", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListAssociatedTrafficFiltersListRequest(string subscriptionId, string resourceGroupName, string monitorName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/listAssociatedTrafficFilters", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of all associated traffic filters for the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAssociatedTrafficFiltersListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateListAssociatedTrafficFiltersListRequest(subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ElasticTrafficFilterResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticTrafficFilterResponse.DeserializeElasticTrafficFilterResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of all associated traffic filters for the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListAssociatedTrafficFiltersList(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateListAssociatedTrafficFiltersListRequest(subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ElasticTrafficFilterResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticTrafficFilterResponse.DeserializeElasticTrafficFilterResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateAndAssociateIPFilterCreateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string ips, string name) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/createAndAssociateIPFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (ips != null) + { + uri.AppendQuery("ips", ips, true); + } + if (name != null) + { + uri.AppendQuery("name", name, true); + } + return uri; + } + + internal HttpMessage CreateCreateAndAssociateIPFilterCreateRequest(string subscriptionId, string resourceGroupName, string monitorName, string ips, string name) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/createAndAssociateIPFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (ips != null) + { + uri.AppendQuery("ips", ips, true); + } + if (name != null) + { + uri.AppendQuery("name", name, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Create and Associate IP traffic filter for the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// List of ips. + /// Name of the traffic filter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateAndAssociateIPFilterCreateAsync(string subscriptionId, string resourceGroupName, string monitorName, string ips = null, string name = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateCreateAndAssociateIPFilterCreateRequest(subscriptionId, resourceGroupName, monitorName, ips, name); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create and Associate IP traffic filter for the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// List of ips. + /// Name of the traffic filter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateAndAssociateIPFilterCreate(string subscriptionId, string resourceGroupName, string monitorName, string ips = null, string name = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateCreateAndAssociateIPFilterCreateRequest(subscriptionId, resourceGroupName, monitorName, ips, name); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateAndAssociatePLFilterCreateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string name, string privateEndpointGuid, string privateEndpointName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/createAndAssociatePLFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (name != null) + { + uri.AppendQuery("name", name, true); + } + if (privateEndpointGuid != null) + { + uri.AppendQuery("privateEndpointGuid", privateEndpointGuid, true); + } + if (privateEndpointName != null) + { + uri.AppendQuery("privateEndpointName", privateEndpointName, true); + } + return uri; + } + + internal HttpMessage CreateCreateAndAssociatePLFilterCreateRequest(string subscriptionId, string resourceGroupName, string monitorName, string name, string privateEndpointGuid, string privateEndpointName) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/createAndAssociatePLFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (name != null) + { + uri.AppendQuery("name", name, true); + } + if (privateEndpointGuid != null) + { + uri.AppendQuery("privateEndpointGuid", privateEndpointGuid, true); + } + if (privateEndpointName != null) + { + uri.AppendQuery("privateEndpointName", privateEndpointName, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Create and Associate private link traffic filter for the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Name of the traffic filter. + /// Guid of the private endpoint. + /// Name of the private endpoint. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateAndAssociatePLFilterCreateAsync(string subscriptionId, string resourceGroupName, string monitorName, string name = null, string privateEndpointGuid = null, string privateEndpointName = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateCreateAndAssociatePLFilterCreateRequest(subscriptionId, resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create and Associate private link traffic filter for the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Name of the traffic filter. + /// Guid of the private endpoint. + /// Name of the private endpoint. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateAndAssociatePLFilterCreate(string subscriptionId, string resourceGroupName, string monitorName, string name = null, string privateEndpointGuid = null, string privateEndpointName = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateCreateAndAssociatePLFilterCreateRequest(subscriptionId, resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateAssociateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/associateTrafficFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (rulesetId != null) + { + uri.AppendQuery("rulesetId", rulesetId, true); + } + return uri; + } + + internal HttpMessage CreateAssociateRequest(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/associateTrafficFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (rulesetId != null) + { + uri.AppendQuery("rulesetId", rulesetId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Associate traffic filter for the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Ruleset Id of the filter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task AssociateAsync(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateAssociateRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Associate traffic filter for the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Ruleset Id of the filter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Associate(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateAssociateRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDetachAndDeleteTrafficFilterDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/detachAndDeleteTrafficFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (rulesetId != null) + { + uri.AppendQuery("rulesetId", rulesetId, true); + } + return uri; + } + + internal HttpMessage CreateDetachAndDeleteTrafficFilterDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/detachAndDeleteTrafficFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (rulesetId != null) + { + uri.AppendQuery("rulesetId", rulesetId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Detach and Delete traffic filter from the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Ruleset Id of the filter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DetachAndDeleteTrafficFilterDeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateDetachAndDeleteTrafficFilterDeleteRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Detach and Delete traffic filter from the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Ruleset Id of the filter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response DetachAndDeleteTrafficFilterDelete(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateDetachAndDeleteTrafficFilterDeleteRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDetachTrafficFilterUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/detachTrafficFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (rulesetId != null) + { + uri.AppendQuery("rulesetId", rulesetId, true); + } + return uri; + } + + internal HttpMessage CreateDetachTrafficFilterUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/detachTrafficFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (rulesetId != null) + { + uri.AppendQuery("rulesetId", rulesetId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Detach traffic filter for the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Ruleset Id of the filter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DetachTrafficFilterUpdateAsync(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateDetachTrafficFilterUpdateRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Detach traffic filter for the given deployment. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Ruleset Id of the filter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response DetachTrafficFilterUpdate(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateDetachTrafficFilterUpdateRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateTrafficFiltersDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/deleteTrafficFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (rulesetId != null) + { + uri.AppendQuery("rulesetId", rulesetId, true); + } + return uri; + } + + internal HttpMessage CreateTrafficFiltersDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/deleteTrafficFilter", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (rulesetId != null) + { + uri.AppendQuery("rulesetId", rulesetId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete traffic filter from the account. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Ruleset Id of the filter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task TrafficFiltersDeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateTrafficFiltersDeleteRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete traffic filter from the account. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Ruleset Id of the filter. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response TrafficFiltersDelete(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateTrafficFiltersDeleteRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateResubscribeRequestUri(string subscriptionId, string resourceGroupName, string monitorName, ResubscribeProperties body) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/resubscribe", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateResubscribeRequest(string subscriptionId, string resourceGroupName, string monitorName, ResubscribeProperties body) + { + 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.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/resubscribe", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (body != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body, ModelSerializationExtensions.WireOptions); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Resubscribe the Elasticsearch Organization. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Resubscribe Properties. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task ResubscribeAsync(string subscriptionId, string resourceGroupName, string monitorName, ResubscribeProperties body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateResubscribeRequest(subscriptionId, resourceGroupName, monitorName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Resubscribe the Elasticsearch Organization. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. + /// Resubscribe Properties. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Resubscribe(string subscriptionId, string resourceGroupName, string monitorName, ResubscribeProperties body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateResubscribeRequest(subscriptionId, resourceGroupName, monitorName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return 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; + } + + /// List all monitors under the specified 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: + { + ElasticMonitorResourceListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all monitors under the specified 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: + { + ElasticMonitorResourceListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all monitors under the specified subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ElasticMonitorResourceListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all monitors under the specified subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ElasticMonitorResourceListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateMonitoredResourcesListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateMonitoredResourcesListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) + { + 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 the resources currently being monitored by the Elastic monitor resource. + /// 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. + /// Monitor resource name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> MonitoredResourcesListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateMonitoredResourcesListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MonitoredResourceListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MonitoredResourceListResponse.DeserializeMonitoredResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the resources currently being monitored by the Elastic monitor resource. + /// 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. + /// Monitor resource name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response MonitoredResourcesListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateMonitoredResourcesListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MonitoredResourceListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MonitoredResourceListResponse.DeserializeMonitoredResourceListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateConnectedPartnerResourcesListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateConnectedPartnerResourcesListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) + { + 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 of all active deployments that are associated with the marketplace subscription linked to the given monitor. + /// 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. + /// Monitor resource name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ConnectedPartnerResourcesListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateConnectedPartnerResourcesListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConnectedPartnerResourcesListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ConnectedPartnerResourcesListResponse.DeserializeConnectedPartnerResourcesListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List of all active deployments that are associated with the marketplace subscription linked to the given monitor. + /// 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. + /// Monitor resource name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ConnectedPartnerResourcesListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateConnectedPartnerResourcesListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConnectedPartnerResourcesListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ConnectedPartnerResourcesListResponse.DeserializeConnectedPartnerResourcesListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateVmHostListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateVmHostListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) + { + 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 the vm resources currently being monitored by the Elastic monitor resource. + /// 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. + /// Monitor resource name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> VmHostListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateVmHostListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + VmHostListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = VmHostListResponse.DeserializeVmHostListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the vm resources currently being monitored by the Elastic monitor resource. + /// 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. + /// Monitor resource name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response VmHostListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + + using var message = CreateVmHostListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + VmHostListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = VmHostListResponse.DeserializeVmHostListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ElasticVersionsRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ElasticVersionsOperationGroupRestOperations.cs similarity index 95% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ElasticVersionsRestOperations.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ElasticVersionsOperationGroupRestOperations.cs index 1626c1360d9f..35b3f0b65e6a 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ElasticVersionsRestOperations.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ElasticVersionsOperationGroupRestOperations.cs @@ -15,24 +15,24 @@ namespace Azure.ResourceManager.Elastic { - internal partial class ElasticVersionsRestOperations + internal partial class ElasticVersionsOperationGroupRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of ElasticVersionsRestOperations. + /// Initializes a new instance of ElasticVersionsOperationGroupRestOperations. /// 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 ElasticVersionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public ElasticVersionsOperationGroupRestOperations(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-03-01"; + _apiVersion = apiVersion ?? "2025-01-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ExternalUserRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ExternalUserRestOperations.cs deleted file mode 100644 index b3dfc74dadc7..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ExternalUserRestOperations.cs +++ /dev/null @@ -1,142 +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.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class ExternalUserRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of ExternalUserRestOperations. - /// 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 ExternalUserRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, ElasticExternalUserContent 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/createOrUpdateExternalUser", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, ElasticExternalUserContent 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/createOrUpdateExternalUser", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (content != null) - { - 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; - } - - /// Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Elastic External User Creation Parameters. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string monitorName, ElasticExternalUserContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, monitorName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ElasticExternalUserCreationResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticExternalUserCreationResult.DeserializeElasticExternalUserCreationResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create User inside elastic deployment which are used by customers to perform operations on the elastic deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Elastic External User Creation Parameters. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string monitorName, ElasticExternalUserContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, monitorName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ElasticExternalUserCreationResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticExternalUserCreationResult.DeserializeElasticExternalUserCreationResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ListAssociatedTrafficFiltersRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ListAssociatedTrafficFiltersRestOperations.cs deleted file mode 100644 index c30d29d89ff2..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/ListAssociatedTrafficFiltersRestOperations.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.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class ListAssociatedTrafficFiltersRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of ListAssociatedTrafficFiltersRestOperations. - /// 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 ListAssociatedTrafficFiltersRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listAssociatedTrafficFilters", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listAssociatedTrafficFilters", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get the list of all associated traffic filters for the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ElasticTrafficFilterListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticTrafficFilterListResult.DeserializeElasticTrafficFilterListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the list of all associated traffic filters for the given deployment. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ElasticTrafficFilterListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticTrafficFilterListResult.DeserializeElasticTrafficFilterListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitorRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitorRestOperations.cs deleted file mode 100644 index 191f4cdf0265..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitorRestOperations.cs +++ /dev/null @@ -1,131 +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; -using Azure.ResourceManager.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class MonitorRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of MonitorRestOperations. - /// 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 MonitorRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateUpgradeRequestUri(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorUpgrade body) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/upgrade", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpgradeRequest(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorUpgrade body) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/upgrade", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (body != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body, ModelSerializationExtensions.WireOptions); - request.Content = content; - } - _userAgent.Apply(message); - return message; - } - - /// Upgradable version for a monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Elastic Monitor Upgrade Parameters. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task UpgradeAsync(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorUpgrade body = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateUpgradeRequest(subscriptionId, resourceGroupName, monitorName, body); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Upgradable version for a monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Elastic Monitor Upgrade Parameters. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Upgrade(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorUpgrade body = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateUpgradeRequest(subscriptionId, resourceGroupName, monitorName, body); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitoredResourcesRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitoredResourcesRestOperations.cs deleted file mode 100644 index c0e6a4a7acb2..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitoredResourcesRestOperations.cs +++ /dev/null @@ -1,217 +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.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class MonitoredResourcesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of MonitoredResourcesRestOperations. - /// 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 MonitoredResourcesRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listMonitoredResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listMonitoredResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List the resources currently being monitored by the Elastic monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - MonitoredResourceListResponse value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = MonitoredResourceListResponse.DeserializeMonitoredResourceListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List the resources currently being monitored by the Elastic monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - MonitoredResourceListResponse value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = MonitoredResourceListResponse.DeserializeMonitoredResourceListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) - { - 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 the resources currently being monitored by the Elastic monitor resource. - /// 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. - /// Monitor resource name. - /// 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 monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - MonitoredResourceListResponse value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = MonitoredResourceListResponse.DeserializeMonitoredResourceListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List the resources currently being monitored by the Elastic monitor resource. - /// 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. - /// Monitor resource name. - /// 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 monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - MonitoredResourceListResponse value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = MonitoredResourceListResponse.DeserializeMonitoredResourceListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitorsRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitoredSubscriptionsRestOperations.cs similarity index 57% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitorsRestOperations.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitoredSubscriptionsRestOperations.cs index e4230df94ab8..c8c00a76b657 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitorsRestOperations.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/MonitoredSubscriptionsRestOperations.cs @@ -15,192 +15,28 @@ namespace Azure.ResourceManager.Elastic { - internal partial class MonitorsRestOperations + internal partial class MonitoredSubscriptionsRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of MonitorsRestOperations. + /// Initializes a new instance of MonitoredSubscriptionsRestOperations. /// 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 MonitorsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public MonitoredSubscriptionsRestOperations(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-03-01"; + _apiVersion = apiVersion ?? "2025-01-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Elastic/monitors", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Elastic/monitors", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List all monitors under the specified 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> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ElasticMonitorResourceListResponse value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List all monitors under the specified 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 List(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ElasticMonitorResourceListResponse value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - 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.Elastic/monitors", 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.Elastic/monitors", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List all monitors under the specified 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: - { - ElasticMonitorResourceListResponse value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List all monitors under the specified 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: - { - ElasticMonitorResourceListResponse value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string configurationName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -210,11 +46,13 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); + uri.AppendPath("/monitoredSubscriptions/", false); + uri.AppendPath(configurationName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string monitorName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string monitorName, string configurationName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -227,6 +65,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); + uri.AppendPath("/monitoredSubscriptions/", false); + uri.AppendPath(configurationName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -234,69 +74,73 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Get the properties of a specific monitor resource. + /// List all the subscriptions currently being monitored by the Elastic monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. + /// The configuration name. Only 'default' value is supported. /// 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 monitorName, 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 monitorName, string configurationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, configurationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticMonitorData value = default; + MonitoredSubscriptionPropertyData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticMonitorData.DeserializeElasticMonitorData(document.RootElement); + value = MonitoredSubscriptionPropertyData.DeserializeMonitoredSubscriptionPropertyData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((ElasticMonitorData)null, message.Response); + return Response.FromValue((MonitoredSubscriptionPropertyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get the properties of a specific monitor resource. + /// List all the subscriptions currently being monitored by the Elastic monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. + /// The configuration name. Only 'default' value is supported. /// 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 monitorName, 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 monitorName, string configurationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, configurationName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticMonitorData value = default; + MonitoredSubscriptionPropertyData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticMonitorData.DeserializeElasticMonitorData(document.RootElement); + value = MonitoredSubscriptionPropertyData.DeserializeMonitoredSubscriptionPropertyData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((ElasticMonitorData)null, message.Response); + return Response.FromValue((MonitoredSubscriptionPropertyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorData data) + internal RequestUriBuilder CreateCreateorUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string configurationName, MonitoredSubscriptionPropertyData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -306,11 +150,13 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); + uri.AppendPath("/monitoredSubscriptions/", false); + uri.AppendPath(configurationName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorData data) + internal HttpMessage CreateCreateorUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, string configurationName, MonitoredSubscriptionPropertyData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -323,6 +169,8 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); + uri.AppendPath("/monitoredSubscriptions/", false); + uri.AppendPath(configurationName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -334,22 +182,24 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG return message; } - /// Create a monitor resource. + /// Add the subscriptions that should be monitored by the Elastic monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. - /// Elastic monitor resource model. + /// The configuration name. Only 'default' value is supported. + /// The to use. /// 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 monitorName, ElasticMonitorData data, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateorUpdateAsync(string subscriptionId, string resourceGroupName, string monitorName, string configurationName, MonitoredSubscriptionPropertyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, monitorName, data); + using var message = CreateCreateorUpdateRequest(subscriptionId, resourceGroupName, monitorName, configurationName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -361,22 +211,24 @@ public async Task CreateAsync(string subscriptionId, string resourceGr } } - /// Create a monitor resource. + /// Add the subscriptions that should be monitored by the Elastic monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. - /// Elastic monitor resource model. + /// The configuration name. Only 'default' value is supported. + /// The to use. /// 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 monitorName, ElasticMonitorData data, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateorUpdate(string subscriptionId, string resourceGroupName, string monitorName, string configurationName, MonitoredSubscriptionPropertyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, monitorName, data); + using var message = CreateCreateorUpdateRequest(subscriptionId, resourceGroupName, monitorName, configurationName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -388,7 +240,7 @@ public Response Create(string subscriptionId, string resourceGroupName, string m } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorPatch patch) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string configurationName, MonitoredSubscriptionPropertyData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -398,11 +250,13 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); + uri.AppendPath("/monitoredSubscriptions/", false); + uri.AppendPath(configurationName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, ElasticMonitorPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, string configurationName, MonitoredSubscriptionPropertyData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -415,80 +269,78 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); + uri.AppendPath("/monitoredSubscriptions/", false); + uri.AppendPath(configurationName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); request.Content = content; _userAgent.Apply(message); return message; } - /// Update a monitor resource. + /// Updates the subscriptions that are being monitored by the Elastic monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. - /// Elastic resource model update parameters. + /// The configuration name. Only 'default' value is supported. + /// The to use. /// 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 monitorName, ElasticMonitorPatch patch, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string monitorName, string configurationName, MonitoredSubscriptionPropertyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, monitorName, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, monitorName, configurationName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ElasticMonitorData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticMonitorData.DeserializeElasticMonitorData(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Update a monitor resource. + /// Updates the subscriptions that are being monitored by the Elastic monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. - /// Elastic resource model update parameters. + /// The configuration name. Only 'default' value is supported. + /// The to use. /// 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 monitorName, ElasticMonitorPatch patch, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string monitorName, string configurationName, MonitoredSubscriptionPropertyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, monitorName, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, monitorName, configurationName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ElasticMonitorData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticMonitorData.DeserializeElasticMonitorData(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string configurationName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -498,11 +350,13 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); + uri.AppendPath("/monitoredSubscriptions/", false); + uri.AppendPath(configurationName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName, string configurationName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -515,6 +369,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); + uri.AppendPath("/monitoredSubscriptions/", false); + uri.AppendPath(configurationName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -522,24 +378,25 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Delete a monitor resource. + /// Updates the subscriptions that are being monitored by the Elastic monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. + /// The configuration name. Only 'default' value is supported. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, string configurationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, configurationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: case 202: case 204: return message.Response; @@ -548,24 +405,25 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } } - /// Delete a monitor resource. + /// Updates the subscriptions that are being monitored by the Elastic monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. + /// The configuration name. Only 'default' value is supported. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string monitorName, string configurationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNullOrEmpty(configurationName, nameof(configurationName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, configurationName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: case 202: case 204: return message.Response; @@ -574,48 +432,64 @@ public Response Delete(string subscriptionId, string resourceGroupName, string m } } - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/monitoredSubscriptions", false); + uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); + uri.AppendPath(monitorName, true); + uri.AppendPath("/monitoredSubscriptions", false); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List all monitors under the specified subscription. - /// The URL to the next page of results. + /// List all the subscriptions currently being monitored by the Elastic monitor resource. /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId); + using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticMonitorResourceListResponse value = default; + MonitoredSubscriptionPropertiesList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + value = MonitoredSubscriptionPropertiesList.DeserializeMonitoredSubscriptionPropertiesList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -623,26 +497,28 @@ public async Task> ListNextPageAsyn } } - /// List all monitors under the specified subscription. - /// The URL to the next page of results. + /// List all the subscriptions currently being monitored by the Elastic monitor resource. /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Monitor resource name. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId); + using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticMonitorResourceListResponse value = default; + MonitoredSubscriptionPropertiesList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + value = MonitoredSubscriptionPropertiesList.DeserializeMonitoredSubscriptionPropertiesList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -650,7 +526,7 @@ public Response ListNextPage(string nextLink } } - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -658,7 +534,7 @@ internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string ne return uri; } - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -672,28 +548,30 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s return message; } - /// List all monitors under the specified resource group. + /// List all the subscriptions currently being monitored by the Elastic monitor resource. /// 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. + /// Monitor resource name. /// 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> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ElasticMonitorResourceListResponse value = default; + MonitoredSubscriptionPropertiesList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + value = MonitoredSubscriptionPropertiesList.DeserializeMonitoredSubscriptionPropertiesList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -701,28 +579,30 @@ public async Task> ListByResourceGr } } - /// List all monitors under the specified resource group. + /// List all the subscriptions currently being monitored by the Elastic monitor resource. /// 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. + /// Monitor resource name. /// 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 ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ElasticMonitorResourceListResponse value = default; + MonitoredSubscriptionPropertiesList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticMonitorResourceListResponse.DeserializeElasticMonitorResourceListResponse(document.RootElement); + value = MonitoredSubscriptionPropertiesList.DeserializeMonitoredSubscriptionPropertiesList(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OpenAIRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OpenAIIntegrationRPModelsRestOperations.cs similarity index 92% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OpenAIRestOperations.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OpenAIIntegrationRPModelsRestOperations.cs index fea7d55ed1ab..d3c7436f8221 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OpenAIRestOperations.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OpenAIIntegrationRPModelsRestOperations.cs @@ -15,28 +15,28 @@ namespace Azure.ResourceManager.Elastic { - internal partial class OpenAIRestOperations + internal partial class OpenAIIntegrationRPModelsRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of OpenAIRestOperations. + /// Initializes a new instance of OpenAIIntegrationRPModelsRestOperations. /// 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 OpenAIRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public OpenAIIntegrationRPModelsRestOperations(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-03-01"; + _apiVersion = apiVersion ?? "2025-01-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string integrationName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,12 +46,13 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); - uri.AppendPath("/openAIIntegrations", false); + uri.AppendPath("/openAIIntegrations/", false); + uri.AppendPath(integrationName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string monitorName, string integrationName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -64,7 +65,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); - uri.AppendPath("/openAIIntegrations", false); + uri.AppendPath("/openAIIntegrations/", false); + uri.AppendPath(integrationName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -72,65 +74,73 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro return message; } - /// List OpenAI integration rule for a given monitor resource. + /// Get OpenAI integration rule for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. + /// OpenAI Integration name. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, 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 monitorName, string integrationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, integrationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - OpenAIIntegrationRPModelListResponse value = default; + OpenAIIntegrationRPModelData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OpenAIIntegrationRPModelListResponse.DeserializeOpenAIIntegrationRPModelListResponse(document.RootElement); + value = OpenAIIntegrationRPModelData.DeserializeOpenAIIntegrationRPModelData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((OpenAIIntegrationRPModelData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// List OpenAI integration rule for a given monitor resource. + /// Get OpenAI integration rule for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. + /// OpenAI Integration name. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string monitorName, 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 monitorName, string integrationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, integrationName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - OpenAIIntegrationRPModelListResponse value = default; + OpenAIIntegrationRPModelData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OpenAIIntegrationRPModelListResponse.DeserializeOpenAIIntegrationRPModelListResponse(document.RootElement); + value = OpenAIIntegrationRPModelData.DeserializeOpenAIIntegrationRPModelData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((OpenAIIntegrationRPModelData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string integrationName) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, OpenAIIntegrationRPModelData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -146,11 +156,11 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string monitorName, string integrationName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, OpenAIIntegrationRPModelData 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); @@ -164,77 +174,83 @@ 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; } - /// Get OpenAI integration rule for a given monitor resource. + /// Create or update a OpenAI integration rule for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. /// OpenAI Integration name. + /// The to use. /// 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 monitorName, string integrationName, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, OpenAIIntegrationRPModelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, integrationName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, monitorName, integrationName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 201: { - ElasticOpenAIIntegrationData value = default; + OpenAIIntegrationRPModelData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticOpenAIIntegrationData.DeserializeElasticOpenAIIntegrationData(document.RootElement); + value = OpenAIIntegrationRPModelData.DeserializeOpenAIIntegrationRPModelData(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ElasticOpenAIIntegrationData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get OpenAI integration rule for a given monitor resource. + /// Create or update a OpenAI integration rule for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. /// OpenAI Integration name. + /// The to use. /// 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 monitorName, string integrationName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, OpenAIIntegrationRPModelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, integrationName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, monitorName, integrationName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 201: { - ElasticOpenAIIntegrationData value = default; + OpenAIIntegrationRPModelData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticOpenAIIntegrationData.DeserializeElasticOpenAIIntegrationData(document.RootElement); + value = OpenAIIntegrationRPModelData.DeserializeOpenAIIntegrationRPModelData(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ElasticOpenAIIntegrationData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, ElasticOpenAIIntegrationData data) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string integrationName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -250,11 +266,11 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, ElasticOpenAIIntegrationData data) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName, string integrationName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -268,83 +284,65 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r 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 or update a OpenAI integration rule for a given monitor resource. + /// Delete OpenAI integration rule for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. /// OpenAI Integration name. - /// The to use. /// 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> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, ElasticOpenAIIntegrationData data, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, monitorName, integrationName, data); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, integrationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - { - ElasticOpenAIIntegrationData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticOpenAIIntegrationData.DeserializeElasticOpenAIIntegrationData(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Create or update a OpenAI integration rule for a given monitor resource. + /// Delete OpenAI integration rule for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. /// OpenAI Integration name. - /// The to use. /// 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 CreateOrUpdate(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, ElasticOpenAIIntegrationData data, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, monitorName, integrationName, data); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, integrationName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - { - ElasticOpenAIIntegrationData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticOpenAIIntegrationData.DeserializeElasticOpenAIIntegrationData(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string integrationName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -354,17 +352,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); - uri.AppendPath("/openAIIntegrations/", false); - uri.AppendPath(integrationName, true); + uri.AppendPath("/openAIIntegrations", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName, string integrationName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -373,8 +370,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); - uri.AppendPath("/openAIIntegrations/", false); - uri.AppendPath(integrationName, true); + uri.AppendPath("/openAIIntegrations", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -382,55 +378,59 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Delete OpenAI integration rule for a given monitor resource. + /// List OpenAI integration rule for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. - /// OpenAI Integration name. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, integrationName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + OpenAIIntegrationRPModelListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OpenAIIntegrationRPModelListResponse.DeserializeOpenAIIntegrationRPModelListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Delete OpenAI integration rule for a given monitor resource. + /// List OpenAI integration rule for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. - /// OpenAI Integration name. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - Argument.AssertNotNullOrEmpty(integrationName, nameof(integrationName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, integrationName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + OpenAIIntegrationRPModelListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OpenAIIntegrationRPModelListResponse.DeserializeOpenAIIntegrationRPModelListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } @@ -484,7 +484,7 @@ internal HttpMessage CreateGetStatusRequest(string subscriptionId, string resour /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetStatusAsync(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, CancellationToken cancellationToken = default) + public async Task> GetStatusAsync(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -497,9 +497,9 @@ public async Task> GetStatusAsync { case 200: { - ElasticOpenAIIntegrationStatusResult value = default; + OpenAIIntegrationStatusResponse value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticOpenAIIntegrationStatusResult.DeserializeElasticOpenAIIntegrationStatusResult(document.RootElement); + value = OpenAIIntegrationStatusResponse.DeserializeOpenAIIntegrationStatusResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -515,7 +515,7 @@ public async Task> GetStatusAsync /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response GetStatus(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, CancellationToken cancellationToken = default) + public Response GetStatus(string subscriptionId, string resourceGroupName, string monitorName, string integrationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -528,9 +528,9 @@ public Response GetStatus(string subscript { case 200: { - ElasticOpenAIIntegrationStatusResult value = default; + OpenAIIntegrationStatusResponse value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticOpenAIIntegrationStatusResult.DeserializeElasticOpenAIIntegrationStatusResult(document.RootElement); + value = OpenAIIntegrationStatusResponse.DeserializeOpenAIIntegrationStatusResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OperationsRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OperationsRestOperations.cs new file mode 100644 index 000000000000..eb5f3ed1cd09 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OperationsRestOperations.cs @@ -0,0 +1,173 @@ +// 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.Elastic.Models; + +namespace Azure.ResourceManager.Elastic +{ + internal partial class OperationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OperationsRestOperations. + /// 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 OperationsRestOperations(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 ?? "2025-01-15-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri() + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Elastic/operations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Elastic/operations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the operations for the provider. + /// The cancellation token to use. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the operations for the provider. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink) + { + 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 the operations for the provider. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the operations for the provider. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OrganizationsRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OrganizationsOperationGroupRestOperations.cs similarity index 77% rename from sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OrganizationsRestOperations.cs rename to sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OrganizationsOperationGroupRestOperations.cs index f40c1de30491..b82f84fd9ee7 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OrganizationsRestOperations.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/OrganizationsOperationGroupRestOperations.cs @@ -15,28 +15,28 @@ namespace Azure.ResourceManager.Elastic { - internal partial class OrganizationsRestOperations + internal partial class OrganizationsOperationGroupRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of OrganizationsRestOperations. + /// Initializes a new instance of OrganizationsOperationGroupRestOperations. /// 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 OrganizationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public OrganizationsOperationGroupRestOperations(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-03-01"; + _apiVersion = apiVersion ?? "2025-01-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetApiKeyRequestUri(string subscriptionId, ElasticUserEmailId body) + internal RequestUriBuilder CreateGetApiKeyRequestUri(string subscriptionId, UserEmailId body) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -47,7 +47,7 @@ internal RequestUriBuilder CreateGetApiKeyRequestUri(string subscriptionId, Elas return uri; } - internal HttpMessage CreateGetApiKeyRequest(string subscriptionId, ElasticUserEmailId body) + internal HttpMessage CreateGetApiKeyRequest(string subscriptionId, UserEmailId body) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -60,26 +60,24 @@ internal HttpMessage CreateGetApiKeyRequest(string subscriptionId, ElasticUserEm uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - if (body != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body, ModelSerializationExtensions.WireOptions); - request.Content = content; - } + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } /// Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch Organization. /// The ID of the target subscription. The value must be an UUID. - /// Email Id parameter of the User Organization, of which the API Key must be returned. + /// The request body. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> GetApiKeyAsync(string subscriptionId, ElasticUserEmailId body = null, CancellationToken cancellationToken = default) + public async Task> GetApiKeyAsync(string subscriptionId, UserEmailId body, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(body, nameof(body)); using var message = CreateGetApiKeyRequest(subscriptionId, body); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); @@ -87,9 +85,9 @@ public async Task> GetApiKeyAsync(string subsc { case 200: { - ElasticUserApiKeyResult value = default; + UserApiKeyResponse value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticUserApiKeyResult.DeserializeElasticUserApiKeyResult(document.RootElement); + value = UserApiKeyResponse.DeserializeUserApiKeyResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -99,13 +97,14 @@ public async Task> GetApiKeyAsync(string subsc /// Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch Organization. /// The ID of the target subscription. The value must be an UUID. - /// Email Id parameter of the User Organization, of which the API Key must be returned. + /// The request body. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response GetApiKey(string subscriptionId, ElasticUserEmailId body = null, CancellationToken cancellationToken = default) + public Response GetApiKey(string subscriptionId, UserEmailId body, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(body, nameof(body)); using var message = CreateGetApiKeyRequest(subscriptionId, body); _pipeline.Send(message, cancellationToken); @@ -113,9 +112,9 @@ public Response GetApiKey(string subscriptionId, Elasti { case 200: { - ElasticUserApiKeyResult value = default; + UserApiKeyResponse value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticUserApiKeyResult.DeserializeElasticUserApiKeyResult(document.RootElement); + value = UserApiKeyResponse.DeserializeUserApiKeyResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -151,12 +150,16 @@ internal HttpMessage CreateGetElasticToAzureSubscriptionMappingRequest(string su return message; } - /// Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + /// + /// >; + /// /** + /// Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + /// /// 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> GetElasticToAzureSubscriptionMappingAsync(string subscriptionId, CancellationToken cancellationToken = default) + public async Task> GetElasticToAzureSubscriptionMappingAsync(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -166,9 +169,9 @@ public async Task> { case 200: { - ElasticOrganizationToAzureSubscriptionMappingResult value = default; + ElasticOrganizationToAzureSubscriptionMappingResponse value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticOrganizationToAzureSubscriptionMappingResult.DeserializeElasticOrganizationToAzureSubscriptionMappingResult(document.RootElement); + value = ElasticOrganizationToAzureSubscriptionMappingResponse.DeserializeElasticOrganizationToAzureSubscriptionMappingResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -176,12 +179,16 @@ public async Task> } } - /// Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + /// + /// >; + /// /** + /// Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + /// /// 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 GetElasticToAzureSubscriptionMapping(string subscriptionId, CancellationToken cancellationToken = default) + public Response GetElasticToAzureSubscriptionMapping(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -191,9 +198,9 @@ public Response GetElasticT { case 200: { - ElasticOrganizationToAzureSubscriptionMappingResult value = default; + ElasticOrganizationToAzureSubscriptionMappingResponse value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticOrganizationToAzureSubscriptionMappingResult.DeserializeElasticOrganizationToAzureSubscriptionMappingResult(document.RootElement); + value = ElasticOrganizationToAzureSubscriptionMappingResponse.DeserializeElasticOrganizationToAzureSubscriptionMappingResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/TagRulesRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/TagRulesRestOperations.cs index 5fc277024b01..6ce3e02f25d0 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/TagRulesRestOperations.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/TagRulesRestOperations.cs @@ -25,18 +25,18 @@ internal partial class TagRulesRestOperations /// Initializes a new instance of TagRulesRestOperations. /// 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 TagRulesRestOperations(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-03-01"; + _apiVersion = apiVersion ?? "2025-01-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,12 +46,13 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); - uri.AppendPath("/tagRules", false); + uri.AppendPath("/tagRules/", false); + uri.AppendPath(ruleSetName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -64,7 +65,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); - uri.AppendPath("/tagRules", false); + uri.AppendPath("/tagRules/", false); + uri.AppendPath(ruleSetName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -72,65 +74,73 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro return message; } - /// List the tag rules for a given monitor resource. + /// Get a tag rule set for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. + /// Tag Rule Set resource name. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, 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 monitorName, string ruleSetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, ruleSetName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - MonitoringTagRulesListResponse value = default; + MonitoringTagRuleData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = MonitoringTagRulesListResponse.DeserializeMonitoringTagRulesListResponse(document.RootElement); + value = MonitoringTagRuleData.DeserializeMonitoringTagRuleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((MonitoringTagRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// List the tag rules for a given monitor resource. + /// Get a tag rule set for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. + /// Tag Rule Set resource name. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string monitorName, 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 monitorName, string ruleSetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); + Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, ruleSetName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - MonitoringTagRulesListResponse value = default; + MonitoringTagRuleData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = MonitoringTagRulesListResponse.DeserializeMonitoringTagRulesListResponse(document.RootElement); + value = MonitoringTagRuleData.DeserializeMonitoringTagRuleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((MonitoringTagRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, ElasticTagRuleData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, MonitoringTagRuleData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -146,7 +156,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, ElasticTagRuleData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, MonitoringTagRuleData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -181,7 +191,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, ElasticTagRuleData data, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, MonitoringTagRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -195,9 +205,9 @@ public async Task> CreateOrUpdateAsync(string subsc { case 200: { - ElasticTagRuleData value = default; + MonitoringTagRuleData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticTagRuleData.DeserializeElasticTagRuleData(document.RootElement); + value = MonitoringTagRuleData.DeserializeMonitoringTagRuleData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -214,7 +224,7 @@ public async Task> CreateOrUpdateAsync(string subsc /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, ElasticTagRuleData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, MonitoringTagRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -228,9 +238,9 @@ public Response CreateOrUpdate(string subscriptionId, string { case 200: { - ElasticTagRuleData value = default; + MonitoringTagRuleData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticTagRuleData.DeserializeElasticTagRuleData(document.RootElement); + value = MonitoringTagRuleData.DeserializeMonitoringTagRuleData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -238,7 +248,7 @@ public Response CreateOrUpdate(string subscriptionId, string } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -254,11 +264,11 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) { 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); @@ -276,7 +286,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Get a tag rule set for a given monitor resource. + /// Delete a tag rule set for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. @@ -284,32 +294,27 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, ruleSetName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, ruleSetName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ElasticTagRuleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ElasticTagRuleData.DeserializeElasticTagRuleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ElasticTagRuleData)null, message.Response); + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Get a tag rule set for a given monitor resource. + /// Delete a tag rule set for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. @@ -317,32 +322,27 @@ public async Task> GetAsync(string subscriptionId, /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, ruleSetName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, ruleSetName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ElasticTagRuleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ElasticTagRuleData.DeserializeElasticTagRuleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ElasticTagRuleData)null, message.Response); + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -352,17 +352,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); - uri.AppendPath("/tagRules/", false); - uri.AppendPath(ruleSetName, true); + uri.AppendPath("/tagRules", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -371,8 +370,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Elastic/monitors/", false); uri.AppendPath(monitorName, true); - uri.AppendPath("/tagRules/", false); - uri.AppendPath(ruleSetName, true); + uri.AppendPath("/tagRules", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -380,57 +378,59 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Delete a tag rule set for a given monitor resource. + /// List the tag rules for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. - /// Tag Rule Set resource name. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, ruleSetName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - case 204: - return message.Response; + { + MonitoringTagRulesListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MonitoringTagRulesListResponse.DeserializeMonitoringTagRulesListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Delete a tag rule set for a given monitor resource. + /// List the tag rules for a given monitor resource. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// Monitor resource name. - /// Tag Rule Set resource name. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, ruleSetName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - case 204: - return message.Response; + { + MonitoringTagRulesListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MonitoringTagRulesListResponse.DeserializeMonitoringTagRulesListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/TrafficFiltersRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/TrafficFiltersRestOperations.cs deleted file mode 100644 index 62b85fcbd89a..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/TrafficFiltersRestOperations.cs +++ /dev/null @@ -1,131 +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.Elastic -{ - internal partial class TrafficFiltersRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of TrafficFiltersRestOperations. - /// 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 TrafficFiltersRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/deleteTrafficFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (rulesetId != null) - { - uri.AppendQuery("rulesetId", rulesetId, true); - } - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/deleteTrafficFilter", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (rulesetId != null) - { - uri.AppendQuery("rulesetId", rulesetId, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete traffic filter from the account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Ruleset Id of the filter. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete traffic filter from the account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// Ruleset Id of the filter. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string monitorName, string rulesetId = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, monitorName, rulesetId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/UpgradableVersionsRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/UpgradableVersionsRestOperations.cs deleted file mode 100644 index eeec48d39a85..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/UpgradableVersionsRestOperations.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.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class UpgradableVersionsRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of UpgradableVersionsRestOperations. - /// 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 UpgradableVersionsRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateDetailsRequestUri(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listUpgradableVersions", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDetailsRequest(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listUpgradableVersions", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List of upgradable versions for a given monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> DetailsAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateDetailsRequest(subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - UpgradableVersionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = UpgradableVersionListResult.DeserializeUpgradableVersionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List of upgradable versions for a given monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Details(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateDetailsRequest(subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - UpgradableVersionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = UpgradableVersionListResult.DeserializeUpgradableVersionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/VMCollectionRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/VMCollectionRestOperations.cs deleted file mode 100644 index a0033462eda4..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/VMCollectionRestOperations.cs +++ /dev/null @@ -1,131 +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; -using Azure.ResourceManager.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class VMCollectionRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of VMCollectionRestOperations. - /// 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 VMCollectionRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string monitorName, VmCollectionContent 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/vmCollectionUpdate", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string monitorName, VmCollectionContent 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/vmCollectionUpdate", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (content != null) - { - 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; - } - - /// Update the vm details that will be monitored by the Elastic monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// VM resource Id. - /// 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 monitorName, VmCollectionContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, monitorName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update the vm details that will be monitored by the Elastic monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// VM resource Id. - /// 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 monitorName, VmCollectionContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, monitorName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/VMHostRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/VMHostRestOperations.cs deleted file mode 100644 index 07cde8df0307..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/VMHostRestOperations.cs +++ /dev/null @@ -1,217 +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.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class VMHostRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of VMHostRestOperations. - /// 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 VMHostRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listVMHost", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/listVMHost", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List the vm resources currently being monitored by the Elastic monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VmHostListResponse value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VmHostListResponse.DeserializeVmHostListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List the vm resources currently being monitored by the Elastic monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VmHostListResponse value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VmHostListResponse.DeserializeVmHostListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string monitorName) - { - 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 the vm resources currently being monitored by the Elastic monitor resource. - /// 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. - /// Monitor resource name. - /// 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 monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VmHostListResponse value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VmHostListResponse.DeserializeVmHostListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List the vm resources currently being monitored by the Elastic monitor resource. - /// 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. - /// Monitor resource name. - /// 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 monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VmHostListResponse value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VmHostListResponse.DeserializeVmHostListResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/VMIngestionRestOperations.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/VMIngestionRestOperations.cs deleted file mode 100644 index 680b960f76f8..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/RestOperations/VMIngestionRestOperations.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.Elastic.Models; - -namespace Azure.ResourceManager.Elastic -{ - internal partial class VMIngestionRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of VMIngestionRestOperations. - /// 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 VMIngestionRestOperations(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-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateDetailsRequestUri(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/vmIngestionDetails", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDetailsRequest(string subscriptionId, string resourceGroupName, string monitorName) - { - 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.Elastic/monitors/", false); - uri.AppendPath(monitorName, true); - uri.AppendPath("/vmIngestionDetails", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List the vm ingestion details that will be monitored by the Elastic monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> DetailsAsync(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateDetailsRequest(subscriptionId, resourceGroupName, monitorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VmIngestionDetailsResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VmIngestionDetailsResult.DeserializeVmIngestionDetailsResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List the vm ingestion details that will be monitored by the Elastic monitor resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Monitor resource name. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Details(string subscriptionId, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName)); - - using var message = CreateDetailsRequest(subscriptionId, resourceGroupName, monitorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VmIngestionDetailsResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VmIngestionDetailsResult.DeserializeVmIngestionDetailsResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/autorest.md b/sdk/elastic/Azure.ResourceManager.Elastic/src/autorest.md deleted file mode 100644 index 1bb713bd5a92..000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/autorest.md +++ /dev/null @@ -1,126 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml - -azure-arm: true -csharp: true -library-name: Elastic -namespace: Azure.ResourceManager.Elastic -require: https://github.com/Azure/azure-rest-api-specs/blob/700bd7b4e10d2bd83672ee56fd6aedcf7e195a06/specification/elastic/resource-manager/readme.md -#tag: package-2024-03-01 -output-folder: $(this-folder)/Generated -clear-output-folder: true -sample-gen: - output-folder: $(this-folder)/../samples/Generated - clear-output-folder: true -skip-csproj: true -modelerfour: - flatten-payloads: false -use-model-reader-writer: true - -#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 - -rename-mapping: - ElasticMonitorResource: ElasticMonitor - MonitoringTagRules: ElasticTagRule - MonitoringTagRulesProperties: ElasticTagRuleProperties - ElasticVersionListProperties.version: AvailableVersion - OpenAIIntegrationRPModel: ElasticOpenAIIntegration - OpenAIIntegrationProperties: ElasticOpenAIIntegrationProperties - BillingInfoResponse: ElasticBillingInfoResult - ConnectedPartnerResourceProperties.azureResourceId: -|arm-id - ConnectedPartnerResourcesListFormat: ConnectedPartnerResourceInfo - DeploymentInfoResponse: ElasticDeploymentInfoResult - ElasticOrganizationToAzureSubscriptionMappingResponse: ElasticOrganizationToAzureSubscriptionMappingResult - ElasticOrganizationToAzureSubscriptionMappingResponseProperties: ElasticOrganizationToAzureSubscriptionMappingProperties - ElasticProperties: ElasticCloudProperties - ElasticTrafficFilter.includeByDefault: DoesIncludeByDefault - ElasticTrafficFilterResponse: ElasticTrafficFilterListResult - ElasticVersionListFormat: ElasticVersion - ElasticVersionListProperties: ElasticVersionProperties - ExternalUserInfo: ElasticExternalUserContent - ExternalUserCreationResponse: ElasticExternalUserCreationResult - ExternalUserCreationResponse.created: IsCreated - FilteringTag: ElasticFilteringTag - LiftrResourceCategories: ElasticLiftrResourceCategories - LogRules: ElasticLogRules - LogRules.sendAadLogs: ShouldAadLogsBeSent - LogRules.sendSubscriptionLogs: ShouldSubscriptionLogsBeSent - LogRules.sendActivityLogs: ShouldActivityLogsBeSent - MarketplaceSaaSInfo.subscribed: IsSubscribed - MonitoredResource: MonitoredResourceInfo - MonitoredResource.id: -|arm-id - MonitorProperties.generateApiKey: IsApiKeyGenerated - OpenAIIntegrationStatusResponse: ElasticOpenAIIntegrationStatusResult - OpenAIIntegrationStatusResponseProperties: ElasticOpenAIIntegrationStatusProperties - OperationName: VMCollectionUpdateOperationName - ResourceSku: ElasticSku - SendingLogs: SendingLogsStatus - TagAction: FilteringTagAction - Type: ElasticFilterType - UpgradableVersionsList: UpgradableVersionListResult - UserApiKeyResponse: ElasticUserApiKeyResult - UserApiKeyResponseProperties: ElasticUserApiKeyProperties - UserInfo: ElasticUserInfo - UserEmailId: ElasticUserEmailId - VMCollectionUpdate: VmCollectionContent - VMCollectionUpdate.vmResourceId: -|arm-id - VMIngestionDetailsResponse: VmIngestionDetailsResult - VMResources: ElasticVMResourceInfo - VMResources.vmResourceId: -|arm-id - -prepend-rp-prefix: - - MonitoringStatus - - MonitorProperties - - CompanyInfo - - PlanDetails - - ProvisioningState - -override-operation-name: - VMHost_List: GetVmHosts - VMIngestion_Details: GetVmIngestionDetails - VMCollection_Update: UpdateVmCollection - UpgradableVersions_Details: GetUpgradableVersionDetails - listAssociatedTrafficFilters_List: GetAssociatedTrafficFilters - createAndAssociateIPFilter_Create: CreateAndAssociateIPFilter - createAndAssociatePLFilter_Create: CreateAndAssociatePrivateLinkFilter - AssociateTrafficFilter_Associate: AssociateTrafficFilter - DetachAndDeleteTrafficFilter_Delete: DetachAndDeleteTrafficFilter - DetachTrafficFilter_Update: DetachTrafficFilter - Organizations_GetApiKey: GetApiKey - Organizations_GetElasticToAzureSubscriptionMapping: GetElasticToAzureSubscriptionMapping - -``` diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/tsp-location.yaml b/sdk/elastic/Azure.ResourceManager.Elastic/tsp-location.yaml new file mode 100644 index 000000000000..341d765362a7 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/elastic/Elastic.Management +commit: 5c92dda155f958f8acd565f5ececf28dd940b560 +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/