diff --git a/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md b/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md index 11f0452a7f3b..d0889b08ea49 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md +++ b/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md @@ -1,14 +1,107 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2025-05-13) -### Features Added +- Azure Resource Manager Elastic client library for Java. This package contains Microsoft Azure SDK for Elastic Management SDK. Package tag package-2025-01-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.MonitorProperties` was modified + +* `withProvisioningState(models.ProvisioningState)` was removed + +#### `models.MonitoringTagRulesProperties` was modified + +* `withProvisioningState(models.ProvisioningState)` was removed + +#### `models.Organizations` was modified + +* `getApiKey()` was removed + +### Features Added + +* `models.MonitoredSubscriptionProperties$Definition` was added + +* `models.ConfigurationType` was added + +* `models.MonitoredSubscription` was added + +* `models.ResubscribeProperties` was added + +* `models.ProjectType` was added + +* `models.MonitoredSubscriptionProperties` was added + +* `models.MonitoredSubscriptionPropertiesList` was added + +* `models.MonitoredSubscriptionProperties$Update` was added + +* `models.MonitoredSubscriptionProperties$DefinitionStages` was added + +* `models.HostingType` was added + +* `models.MonitoredSubscriptionProperties$UpdateStages` was added + +* `models.ProjectDetails` was added + +* `models.MonitoredSubscriptions` was added + +* `models.Status` was added + +* `models.SubscriptionList` was added + +* `models.Operation` was added + +#### `models.ConnectedPartnerResourceProperties` was modified + +* `withType(java.lang.String)` was added +* `type()` was added + +#### `models.OpenAIIntegrationRPModel` was modified + +* `systemData()` was added + +#### `models.MarketplaceSaaSInfoMarketplaceSubscription` was modified + +* `offerId()` was added +* `publisherId()` was added +* `withPublisherId(java.lang.String)` was added +* `withOfferId(java.lang.String)` was added + +#### `models.DeploymentInfoResponse` was modified + +* `projectType()` was added +* `configurationType()` was added + +#### `models.ElasticMonitorResource` was modified + +* `kind()` was added + +#### `models.MonitorProperties` was modified + +* `hostingType()` was added +* `projectDetails()` was added +* `withProjectDetails(models.ProjectDetails)` was added +* `withHostingType(models.HostingType)` was added + +#### `ElasticManager` was modified + +* `monitoredSubscriptions()` was added + +#### `models.OpenAIIntegrationProperties` was modified + +* `withOpenAIConnectorId(java.lang.String)` was added +* `openAIConnectorId()` was added + +#### `models.Organizations` was modified + +* `resubscribe(java.lang.String,java.lang.String,models.ResubscribeProperties,com.azure.core.util.Context)` was added +* `resubscribe(java.lang.String,java.lang.String)` was added +* `getApiKey(models.UserEmailId)` was added + +#### `models.ElasticMonitorResource$Definition` was modified -### Other Changes +* `withKind(java.lang.String)` was added ## 1.0.0 (2024-10-21) diff --git a/sdk/elastic/azure-resourcemanager-elastic/README.md b/sdk/elastic/azure-resourcemanager-elastic/README.md index 9a83f5c06c4d..f90a5f0a7515 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/README.md +++ b/sdk/elastic/azure-resourcemanager-elastic/README.md @@ -2,7 +2,7 @@ Azure Resource Manager Elastic client library for Java. -This package contains Microsoft Azure SDK for Elastic Management SDK. Package tag package-2024-03-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for Elastic Management SDK. Package tag package-2025-01-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -52,7 +52,7 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); @@ -60,7 +60,7 @@ ElasticManager manager = ElasticManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ - - diff --git a/sdk/elastic/azure-resourcemanager-elastic/SAMPLE.md b/sdk/elastic/azure-resourcemanager-elastic/SAMPLE.md index a17c3adb71e8..8d523a03f65f 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/SAMPLE.md +++ b/sdk/elastic/azure-resourcemanager-elastic/SAMPLE.md @@ -57,6 +57,14 @@ - [List](#monitoredresources_list) +## MonitoredSubscriptions + +- [CreateorUpdate](#monitoredsubscriptions_createorupdate) +- [Delete](#monitoredsubscriptions_delete) +- [Get](#monitoredsubscriptions_get) +- [List](#monitoredsubscriptions_list) +- [Update](#monitoredsubscriptions_update) + ## Monitors - [Create](#monitors_create) @@ -82,6 +90,7 @@ - [GetApiKey](#organizations_getapikey) - [GetElasticToAzureSubscriptionMapping](#organizations_getelastictoazuresubscriptionmapping) +- [Resubscribe](#organizations_resubscribe) ## TagRules @@ -113,20 +122,22 @@ ```java /** - * Samples for AllTrafficFilters List. + * Samples for TrafficFilters Delete. */ -public final class AllTrafficFiltersListSamples { +public final class TrafficFiltersDeleteSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/AllTrafficFilters_list.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * TrafficFilters_Delete.json */ /** - * Sample code: AllTrafficFilters_list. + * Sample code: TrafficFilters_Delete. * * @param manager Entry point to ElasticManager. */ - public static void allTrafficFiltersList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.allTrafficFilters().listWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void trafficFiltersDelete(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.trafficFilters() + .deleteWithResponse("myResourceGroup", "myMonitor", "31d91b5afb6f4c2eaaf104c97b1991dd", + com.azure.core.util.Context.NONE); } } ``` @@ -135,23 +146,21 @@ public final class AllTrafficFiltersListSamples { ```java /** - * Samples for AssociateTrafficFilter Associate. + * Samples for VMIngestion Details. */ -public final class AssociateTrafficFilterAssociateSamples { +public final class VMIngestionDetailsSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/AssociateTrafficFilter_Update - * .json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/VMIngestion_Details. + * json */ /** - * Sample code: AssociateTrafficFilter_Associate. + * Sample code: VMIngestion_Details. * * @param manager Entry point to ElasticManager. */ - public static void associateTrafficFilterAssociate(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.associateTrafficFilters() - .associate("myResourceGroup", "myMonitor", "31d91b5afb6f4c2eaaf104c97b1991dd", - com.azure.core.util.Context.NONE); + public static void vMIngestionDetails(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.vMIngestions().detailsWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` @@ -160,20 +169,21 @@ public final class AssociateTrafficFilterAssociateSamples { ```java /** - * Samples for BillingInfo Get. + * Samples for MonitoredSubscriptions Delete. */ -public final class BillingInfoGetSamples { +public final class MonitoredSubscriptionsDeleteSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/BillingInfo_Get.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredSubscriptions_Delete.json */ /** - * Sample code: BillingInfo_Get. + * Sample code: Monitors_DeleteMonitoredSubscriptions. * * @param manager Entry point to ElasticManager. */ - public static void billingInfoGet(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.billingInfoes().getWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void monitorsDeleteMonitoredSubscriptions(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitoredSubscriptions() + .delete("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); } } ``` @@ -181,21 +191,22 @@ public final class BillingInfoGetSamples { ### ConnectedPartnerResources_List ```java + /** - * Samples for ConnectedPartnerResources List. + * Samples for Organizations GetApiKey. */ -public final class ConnectedPartnerResourcesListSamples { +public final class OrganizationsGetApiKeySamples { /* - * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ - * ConnectedPartnerResources_List.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * Organizations_GetApiKey.json */ /** - * Sample code: ConnectedPartnerResources_List. + * Sample code: Organizations_GetApiKey. * * @param manager Entry point to ElasticManager. */ - public static void connectedPartnerResourcesList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.connectedPartnerResources().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void organizationsGetApiKey(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.organizations().getApiKeyWithResponse(null, com.azure.core.util.Context.NONE); } } ``` @@ -204,22 +215,20 @@ public final class ConnectedPartnerResourcesListSamples { ```java /** - * Samples for CreateAndAssociateIpFilter Create. + * Samples for OpenAI List. */ -public final class CreateAndAssociateIpFilterCreateSamples { +public final class OpenAIListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/IPTrafficFilter_Create.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/OpenAI_List.json */ /** - * Sample code: createAndAssociateIPFilter_Create. + * Sample code: OpenAI_List. * * @param manager Entry point to ElasticManager. */ - public static void createAndAssociateIPFilterCreate(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.createAndAssociateIpFilters() - .create("myResourceGroup", "myMonitor", "192.168.131.0, 192.168.132.6/22", null, - com.azure.core.util.Context.NONE); + public static void openAIList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.openAIs().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` @@ -228,21 +237,21 @@ public final class CreateAndAssociateIpFilterCreateSamples { ```java /** - * Samples for CreateAndAssociatePLFilter Create. + * Samples for DetachAndDeleteTrafficFilter Delete. */ -public final class CreateAndAssociatePLFilterCreateSamples { +public final class DetachAndDeleteTrafficFilterDeleteSamples { /* - * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ - * PrivateLinkTrafficFilters_Create.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * DetachAndDeleteTrafficFilter_Delete.json */ /** - * Sample code: createAndAssociatePLFilter_Create. + * Sample code: DetachAndDeleteTrafficFilter_Delete. * * @param manager Entry point to ElasticManager. */ - public static void createAndAssociatePLFilterCreate(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.createAndAssociatePLFilters() - .create("myResourceGroup", "myMonitor", null, "fdb54d3b-e85e-4d08-8958-0d2f7g523df9", "myPrivateEndpoint", + public static void detachAndDeleteTrafficFilterDelete(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.detachAndDeleteTrafficFilters() + .deleteWithResponse("myResourceGroup", "myMonitor", "31d91b5afb6f4c2eaaf104c97b1991dd", com.azure.core.util.Context.NONE); } } @@ -252,20 +261,21 @@ public final class CreateAndAssociatePLFilterCreateSamples { ```java /** - * Samples for DeploymentInfo List. + * Samples for ListAssociatedTrafficFilters List. */ -public final class DeploymentInfoListSamples { +public final class ListAssociatedTrafficFiltersListSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/DeploymentInfo_List.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * AssociatedFiltersForDeployment_list.json */ /** - * Sample code: DeploymentInfo_List. + * Sample code: listAssociatedTrafficFilters_list. * * @param manager Entry point to ElasticManager. */ - public static void deploymentInfoList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.deploymentInfoes().listWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void listAssociatedTrafficFiltersList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.listAssociatedTrafficFilters() + .listWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` @@ -274,22 +284,20 @@ public final class DeploymentInfoListSamples { ```java /** - * Samples for DetachAndDeleteTrafficFilter Delete. + * Samples for AllTrafficFilters List. */ -public final class DetachAndDeleteTrafficFilterDeleteSamples { +public final class AllTrafficFiltersListSamples { /* - * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ - * DetachAndDeleteTrafficFilter_Delete.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * AllTrafficFilters_list.json */ /** - * Sample code: DetachAndDeleteTrafficFilter_Delete. + * Sample code: AllTrafficFilters_list. * * @param manager Entry point to ElasticManager. */ - public static void detachAndDeleteTrafficFilterDelete(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.detachAndDeleteTrafficFilters() - .deleteWithResponse("myResourceGroup", "myMonitor", "31d91b5afb6f4c2eaaf104c97b1991dd", - com.azure.core.util.Context.NONE); + public static void allTrafficFiltersList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.allTrafficFilters().listWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` @@ -298,23 +306,20 @@ public final class DetachAndDeleteTrafficFilterDeleteSamples { ```java /** - * Samples for DetachTrafficFilter Update. + * Samples for TagRules CreateOrUpdate. */ -public final class DetachTrafficFilterUpdateSamples { +public final class TagRulesCreateOrUpdateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/DetachTrafficFilters_Update. - * json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * TagRules_CreateOrUpdate.json */ /** - * Sample code: DetachTrafficFilter_Update. + * Sample code: TagRules_CreateOrUpdate. * * @param manager Entry point to ElasticManager. */ - public static void detachTrafficFilterUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.detachTrafficFilters() - .update("myResourceGroup", "myMonitor", "31d91b5afb6f4c2eaaf104c97b1991dd", - com.azure.core.util.Context.NONE); + public static void tagRulesCreateOrUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.tagRules().define("default").withExistingMonitor("myResourceGroup", "myMonitor").create(); } } ``` @@ -323,20 +328,20 @@ public final class DetachTrafficFilterUpdateSamples { ```java /** - * Samples for ElasticVersions List. + * Samples for Monitors Delete. */ -public final class ElasticVersionsListSamples { +public final class MonitorsDeleteSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ElasticVersions_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitors_Delete.json */ /** - * Sample code: ElasticVersions_List. + * Sample code: Monitors_Delete. * * @param manager Entry point to ElasticManager. */ - public static void elasticVersionsList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.elasticVersions().list("myregion", com.azure.core.util.Context.NONE); + public static void monitorsDelete(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitors().delete("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` @@ -344,23 +349,22 @@ public final class ElasticVersionsListSamples { ### ExternalUser_CreateOrUpdate ```java - /** - * Samples for ExternalUser CreateOrUpdate. + * Samples for ElasticVersions List. */ -public final class ExternalUserCreateOrUpdateSamples { +public final class ElasticVersionsListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ExternalUserInfo.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ElasticVersions_List + * .json */ /** - * Sample code: ExternalUser_CreateOrUpdate. + * Sample code: ElasticVersions_List. * * @param manager Entry point to ElasticManager. */ - public static void externalUserCreateOrUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.externalUsers() - .createOrUpdateWithResponse("myResourceGroup", "myMonitor", null, com.azure.core.util.Context.NONE); + public static void elasticVersionsList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.elasticVersions().list("myregion", com.azure.core.util.Context.NONE); } } ``` @@ -369,21 +373,21 @@ public final class ExternalUserCreateOrUpdateSamples { ```java /** - * Samples for ListAssociatedTrafficFilters List. + * Samples for Organizations GetElasticToAzureSubscriptionMapping. */ -public final class ListAssociatedTrafficFiltersListSamples { +public final class OrganizationsGetElasticToAzureSubscriptionMappingSamples { /* - * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ - * AssociatedFiltersForDeployment_list.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * Organizations_GetElasticToAzureSubscriptionMapping.json */ /** - * Sample code: listAssociatedTrafficFilters_list. + * Sample code: Organizations_GetElasticToAzureSubscriptionMapping. * * @param manager Entry point to ElasticManager. */ - public static void listAssociatedTrafficFiltersList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.listAssociatedTrafficFilters() - .listWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void + organizationsGetElasticToAzureSubscriptionMapping(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.organizations().getElasticToAzureSubscriptionMappingWithResponse(com.azure.core.util.Context.NONE); } } ``` @@ -391,22 +395,22 @@ public final class ListAssociatedTrafficFiltersListSamples { ### MonitorOperation_Upgrade ```java - /** - * Samples for MonitorOperation Upgrade. + * Samples for UpgradableVersions Details. */ -public final class MonitorOperationUpgradeSamples { +public final class UpgradableVersionsDetailsSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitor_Upgrade.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * UpgradableVersions_Details.json */ /** - * Sample code: Monitor_Upgrade. + * Sample code: UpgradableVersions_Details. * * @param manager Entry point to ElasticManager. */ - public static void monitorUpgrade(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.monitorOperations().upgrade("myResourceGroup", "myMonitor", null, com.azure.core.util.Context.NONE); + public static void upgradableVersionsDetails(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.upgradableVersions() + .detailsWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` @@ -415,190 +419,283 @@ public final class MonitorOperationUpgradeSamples { ```java /** - * Samples for MonitoredResources List. + * Samples for MonitoredSubscriptions CreateorUpdate. */ -public final class MonitoredResourcesListSamples { +public final class MonitoredSubscriptionsCreateorUpdateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/MonitoredResources_List.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredSubscriptions_CreateorUpdate.json */ /** - * Sample code: MonitoredResources_List. + * Sample code: Monitors_AddMonitoredSubscriptions. * * @param manager Entry point to ElasticManager. */ - public static void monitoredResourcesList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.monitoredResources().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void monitorsAddMonitoredSubscriptions(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitoredSubscriptions().define("default").withExistingMonitor("myResourceGroup", "myMonitor").create(); } } ``` -### Monitors_Create +### MonitoredSubscriptions_CreateorUpdate ```java /** - * Samples for Monitors Create. + * Samples for TagRules Delete. */ -public final class MonitorsCreateSamples { +public final class TagRulesDeleteSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Create.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/TagRules_Delete.json */ /** - * Sample code: Monitors_Create. + * Sample code: TagRules_Delete. * * @param manager Entry point to ElasticManager. */ - public static void monitorsCreate(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.monitors() - .define("myMonitor") - .withRegion((String) null) - .withExistingResourceGroup("myResourceGroup") - .create(); + public static void tagRulesDelete(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.tagRules().delete("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); } } ``` -### Monitors_Delete +### MonitoredSubscriptions_Delete ```java + /** - * Samples for Monitors Delete. + * Samples for VMCollection Update. */ -public final class MonitorsDeleteSamples { +public final class VMCollectionUpdateSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Delete.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/VMCollection_Update. + * json */ /** - * Sample code: Monitors_Delete. + * Sample code: VMCollection_Update. * * @param manager Entry point to ElasticManager. */ - public static void monitorsDelete(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.monitors().delete("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void vMCollectionUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.vMCollections() + .updateWithResponse("myResourceGroup", "myMonitor", null, com.azure.core.util.Context.NONE); } } ``` -### Monitors_GetByResourceGroup +### MonitoredSubscriptions_Get ```java /** - * Samples for Monitors GetByResourceGroup. + * Samples for Monitors Create. */ -public final class MonitorsGetByResourceGroupSamples { +public final class MonitorsCreateSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Get.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitors_Create.json */ /** - * Sample code: Monitors_Get. + * Sample code: Monitors_Create. * * @param manager Entry point to ElasticManager. */ - public static void monitorsGet(com.azure.resourcemanager.elastic.ElasticManager manager) { + public static void monitorsCreate(com.azure.resourcemanager.elastic.ElasticManager manager) { manager.monitors() - .getByResourceGroupWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + .define("myMonitor") + .withRegion((String) null) + .withExistingResourceGroup("myResourceGroup") + .create(); } } ``` -### Monitors_List +### MonitoredSubscriptions_List ```java /** - * Samples for Monitors List. + * Samples for BillingInfo Get. */ -public final class MonitorsListSamples { +public final class BillingInfoGetSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/BillingInfo_Get.json */ /** - * Sample code: Monitors_List. + * Sample code: BillingInfo_Get. * * @param manager Entry point to ElasticManager. */ - public static void monitorsList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.monitors().list(com.azure.core.util.Context.NONE); + public static void billingInfoGet(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.billingInfoes().getWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` -### Monitors_ListByResourceGroup +### MonitoredSubscriptions_Update ```java /** - * Samples for Monitors ListByResourceGroup. + * Samples for VMHost List. */ -public final class MonitorsListByResourceGroupSamples { +public final class VMHostListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_ListByResourceGroup. - * json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/VMHost_List.json */ /** - * Sample code: Monitors_ListByResourceGroup. + * Sample code: VMHost_List. * * @param manager Entry point to ElasticManager. */ - public static void monitorsListByResourceGroup(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.monitors().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + public static void vMHostList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.vMHosts().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` -### Monitors_Update +### Monitors_Create ```java -import com.azure.resourcemanager.elastic.models.ElasticMonitorResource; /** - * Samples for Monitors Update. + * Samples for MonitorOperation Upgrade. */ -public final class MonitorsUpdateSamples { +public final class MonitorOperationUpgradeSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Update.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitor_Upgrade.json */ /** - * Sample code: Monitors_Update. + * Sample code: Monitor_Upgrade. * * @param manager Entry point to ElasticManager. */ - public static void monitorsUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { - ElasticMonitorResource resource = manager.monitors() - .getByResourceGroupWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE) - .getValue(); - resource.update().apply(); + public static void monitorUpgrade(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitorOperations().upgrade("myResourceGroup", "myMonitor", null, com.azure.core.util.Context.NONE); } } ``` -### OpenAI_CreateOrUpdate +### Monitors_Delete ```java /** - * Samples for OpenAI CreateOrUpdate. + * Samples for DeploymentInfo List. */ -public final class OpenAICreateOrUpdateSamples { +public final class DeploymentInfoListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_CreateOrUpdate.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/DeploymentInfo_List. + * json */ /** - * Sample code: OpenAI_CreateOrUpdate. + * Sample code: DeploymentInfo_List. * * @param manager Entry point to ElasticManager. */ - public static void openAICreateOrUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.openAIs().define("default").withExistingMonitor("myResourceGroup", "myMonitor").create(); + public static void deploymentInfoList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.deploymentInfoes().listWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` -### OpenAI_Delete +### Monitors_GetByResourceGroup + +```java +/** + * Samples for CreateAndAssociateIpFilter Create. + */ +public final class CreateAndAssociateIpFilterCreateSamples { + /* + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * IPTrafficFilter_Create.json + */ + /** + * Sample code: createAndAssociateIPFilter_Create. + * + * @param manager Entry point to ElasticManager. + */ + public static void createAndAssociateIPFilterCreate(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.createAndAssociateIpFilters() + .create("myResourceGroup", "myMonitor", "192.168.131.0, 192.168.132.6/22", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_List + +```java +import com.azure.resourcemanager.elastic.models.MonitoredSubscriptionProperties; + +/** + * Samples for MonitoredSubscriptions Update. + */ +public final class MonitoredSubscriptionsUpdateSamples { + /* + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredSubscriptions_Update.json + */ + /** + * Sample code: Monitors_UpdateMonitoredSubscriptions. + * + * @param manager Entry point to ElasticManager. + */ + public static void monitorsUpdateMonitoredSubscriptions(com.azure.resourcemanager.elastic.ElasticManager manager) { + MonitoredSubscriptionProperties resource = manager.monitoredSubscriptions() + .getWithResponse("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### Monitors_ListByResourceGroup + +```java +/** + * Samples for TagRules List. + */ +public final class TagRulesListSamples { + /* + * x-ms-original-file: + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/TagRules_List.json + */ + /** + * Sample code: TagRules_List. + * + * @param manager Entry point to ElasticManager. + */ + public static void tagRulesList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.tagRules().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_Update + +```java +/** + * Samples for ConnectedPartnerResources List. + */ +public final class ConnectedPartnerResourcesListSamples { + /* + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * ConnectedPartnerResources_List.json + */ + /** + * Sample code: ConnectedPartnerResources_List. + * + * @param manager Entry point to ElasticManager. + */ + public static void connectedPartnerResourcesList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.connectedPartnerResources().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + } +} +``` + +### OpenAI_CreateOrUpdate ```java /** @@ -607,7 +704,7 @@ public final class OpenAICreateOrUpdateSamples { public final class OpenAIDeleteSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_Delete.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/OpenAI_Delete.json */ /** * Sample code: OpenAI_Delete. @@ -621,24 +718,48 @@ public final class OpenAIDeleteSamples { } ``` +### OpenAI_Delete + +```java +/** + * Samples for OpenAI GetStatus. + */ +public final class OpenAIGetStatusSamples { + /* + * x-ms-original-file: + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/OpenAI_GetStatus. + * json + */ + /** + * Sample code: OpenAI_GetStatus. + * + * @param manager Entry point to ElasticManager. + */ + public static void openAIGetStatus(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.openAIs() + .getStatusWithResponse("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); + } +} +``` + ### OpenAI_Get ```java /** - * Samples for OpenAI Get. + * Samples for Operations List. */ -public final class OpenAIGetSamples { +public final class OperationsListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_Get.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Operations_List.json */ /** - * Sample code: OpenAI_Get. + * Sample code: Operations_List. * * @param manager Entry point to ElasticManager. */ - public static void openAIGet(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.openAIs().getWithResponse("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); + public static void operationsList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); } } ``` @@ -646,22 +767,22 @@ public final class OpenAIGetSamples { ### OpenAI_GetStatus ```java + /** - * Samples for OpenAI GetStatus. + * Samples for Organizations Resubscribe. */ -public final class OpenAIGetStatusSamples { +public final class OrganizationsResubscribeSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_GetStatus.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * Organizations_Resubscribe.json */ /** - * Sample code: OpenAI_GetStatus. + * Sample code: Organizations_Resubscribe. * * @param manager Entry point to ElasticManager. */ - public static void openAIGetStatus(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.openAIs() - .getStatusWithResponse("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); + public static void organizationsResubscribe(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.organizations().resubscribe("myResourceGroup", "myMonitor", null, com.azure.core.util.Context.NONE); } } ``` @@ -670,20 +791,22 @@ public final class OpenAIGetStatusSamples { ```java /** - * Samples for OpenAI List. + * Samples for CreateAndAssociatePLFilter Create. */ -public final class OpenAIListSamples { +public final class CreateAndAssociatePLFilterCreateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_List.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * PrivateLinkTrafficFilters_Create.json */ /** - * Sample code: OpenAI_List. + * Sample code: createAndAssociatePLFilter_Create. * * @param manager Entry point to ElasticManager. */ - public static void openAIList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.openAIs().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void createAndAssociatePLFilterCreate(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.createAndAssociatePLFilters() + .create("myResourceGroup", "myMonitor", null, "fdb54d3b-e85e-4d08-8958-0d2f7g523df9", "myPrivateEndpoint", + com.azure.core.util.Context.NONE); } } ``` @@ -692,66 +815,90 @@ public final class OpenAIListSamples { ```java /** - * Samples for Operations List. + * Samples for TagRules Get. */ -public final class OperationsListSamples { +public final class TagRulesGetSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Operations_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/TagRules_Get.json */ /** - * Sample code: Operations_List. + * Sample code: TagRules_Get. * * @param manager Entry point to ElasticManager. */ - public static void operationsList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.operations().list(com.azure.core.util.Context.NONE); + public static void tagRulesGet(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.tagRules().getWithResponse("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); } } ``` ### Organizations_GetApiKey +```java +/** + * Samples for MonitoredResources List. + */ +public final class MonitoredResourcesListSamples { + /* + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredResources_List.json + */ + /** + * Sample code: MonitoredResources_List. + * + * @param manager Entry point to ElasticManager. + */ + public static void monitoredResourcesList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitoredResources().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_GetElasticToAzureSubscriptionMapping + ```java /** - * Samples for Organizations GetApiKey. + * Samples for ExternalUser CreateOrUpdate. */ -public final class OrganizationsGetApiKeySamples { +public final class ExternalUserCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Organizations_GetApiKey.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ExternalUserInfo. + * json */ /** - * Sample code: Organizations_GetApiKey. + * Sample code: ExternalUser_CreateOrUpdate. * * @param manager Entry point to ElasticManager. */ - public static void organizationsGetApiKey(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.organizations().getApiKeyWithResponse(null, com.azure.core.util.Context.NONE); + public static void externalUserCreateOrUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.externalUsers() + .createOrUpdateWithResponse("myResourceGroup", "myMonitor", null, com.azure.core.util.Context.NONE); } } ``` -### Organizations_GetElasticToAzureSubscriptionMapping +### Organizations_Resubscribe ```java /** - * Samples for Organizations GetElasticToAzureSubscriptionMapping. + * Samples for Monitors GetByResourceGroup. */ -public final class OrganizationsGetElasticToAzureSubscriptionMappingSamples { +public final class MonitorsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ - * Organizations_GetElasticToAzureSubscriptionMapping.json + * x-ms-original-file: + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitors_Get.json */ /** - * Sample code: Organizations_GetElasticToAzureSubscriptionMapping. + * Sample code: Monitors_Get. * * @param manager Entry point to ElasticManager. */ - public static void - organizationsGetElasticToAzureSubscriptionMapping(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.organizations().getElasticToAzureSubscriptionMappingWithResponse(com.azure.core.util.Context.NONE); + public static void monitorsGet(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitors() + .getByResourceGroupWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` @@ -759,21 +906,26 @@ public final class OrganizationsGetElasticToAzureSubscriptionMappingSamples { ### TagRules_CreateOrUpdate ```java +import com.azure.resourcemanager.elastic.models.ElasticMonitorResource; + /** - * Samples for TagRules CreateOrUpdate. + * Samples for Monitors Update. */ -public final class TagRulesCreateOrUpdateSamples { +public final class MonitorsUpdateSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_CreateOrUpdate.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitors_Update.json */ /** - * Sample code: TagRules_CreateOrUpdate. + * Sample code: Monitors_Update. * * @param manager Entry point to ElasticManager. */ - public static void tagRulesCreateOrUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.tagRules().define("default").withExistingMonitor("myResourceGroup", "myMonitor").create(); + public static void monitorsUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { + ElasticMonitorResource resource = manager.monitors() + .getByResourceGroupWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); } } ``` @@ -782,20 +934,21 @@ public final class TagRulesCreateOrUpdateSamples { ```java /** - * Samples for TagRules Delete. + * Samples for MonitoredSubscriptions Get. */ -public final class TagRulesDeleteSamples { +public final class MonitoredSubscriptionsGetSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_Delete.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredSubscriptions_Get.json */ /** - * Sample code: TagRules_Delete. + * Sample code: Monitors_GetMonitoredSubscriptions. * * @param manager Entry point to ElasticManager. */ - public static void tagRulesDelete(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.tagRules().delete("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); + public static void monitorsGetMonitoredSubscriptions(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitoredSubscriptions() + .getWithResponse("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); } } ``` @@ -804,20 +957,20 @@ public final class TagRulesDeleteSamples { ```java /** - * Samples for TagRules Get. + * Samples for Monitors List. */ -public final class TagRulesGetSamples { +public final class MonitorsListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_Get.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitors_List.json */ /** - * Sample code: TagRules_Get. + * Sample code: Monitors_List. * * @param manager Entry point to ElasticManager. */ - public static void tagRulesGet(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.tagRules().getWithResponse("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); + public static void monitorsList(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitors().list(com.azure.core.util.Context.NONE); } } ``` @@ -826,20 +979,20 @@ public final class TagRulesGetSamples { ```java /** - * Samples for TagRules List. + * Samples for OpenAI Get. */ -public final class TagRulesListSamples { +public final class OpenAIGetSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/OpenAI_Get.json */ /** - * Sample code: TagRules_List. + * Sample code: OpenAI_Get. * * @param manager Entry point to ElasticManager. */ - public static void tagRulesList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.tagRules().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void openAIGet(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.openAIs().getWithResponse("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); } } ``` @@ -848,21 +1001,21 @@ public final class TagRulesListSamples { ```java /** - * Samples for TrafficFilters Delete. + * Samples for AssociateTrafficFilter Associate. */ -public final class TrafficFiltersDeleteSamples { +public final class AssociateTrafficFilterAssociateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TrafficFilters_Delete.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * AssociateTrafficFilter_Update.json */ /** - * Sample code: TrafficFilters_Delete. + * Sample code: AssociateTrafficFilter_Associate. * * @param manager Entry point to ElasticManager. */ - public static void trafficFiltersDelete(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.trafficFilters() - .deleteWithResponse("myResourceGroup", "myMonitor", "31d91b5afb6f4c2eaaf104c97b1991dd", + public static void associateTrafficFilterAssociate(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.associateTrafficFilters() + .associate("myResourceGroup", "myMonitor", "31d91b5afb6f4c2eaaf104c97b1991dd", com.azure.core.util.Context.NONE); } } @@ -872,22 +1025,20 @@ public final class TrafficFiltersDeleteSamples { ```java /** - * Samples for UpgradableVersions Details. + * Samples for OpenAI CreateOrUpdate. */ -public final class UpgradableVersionsDetailsSamples { +public final class OpenAICreateOrUpdateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/UpgradableVersions_Details. - * json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * OpenAI_CreateOrUpdate.json */ /** - * Sample code: UpgradableVersions_Details. + * Sample code: OpenAI_CreateOrUpdate. * * @param manager Entry point to ElasticManager. */ - public static void upgradableVersionsDetails(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.upgradableVersions() - .detailsWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void openAICreateOrUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.openAIs().define("default").withExistingMonitor("myResourceGroup", "myMonitor").create(); } } ``` @@ -895,23 +1046,21 @@ public final class UpgradableVersionsDetailsSamples { ### VMCollection_Update ```java - /** - * Samples for VMCollection Update. + * Samples for Monitors ListByResourceGroup. */ -public final class VMCollectionUpdateSamples { +public final class MonitorsListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMCollection_Update.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * Monitors_ListByResourceGroup.json */ /** - * Sample code: VMCollection_Update. + * Sample code: Monitors_ListByResourceGroup. * * @param manager Entry point to ElasticManager. */ - public static void vMCollectionUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.vMCollections() - .updateWithResponse("myResourceGroup", "myMonitor", null, com.azure.core.util.Context.NONE); + public static void monitorsListByResourceGroup(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitors().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); } } ``` @@ -920,20 +1069,22 @@ public final class VMCollectionUpdateSamples { ```java /** - * Samples for VMHost List. + * Samples for DetachTrafficFilter Update. */ -public final class VMHostListSamples { +public final class DetachTrafficFilterUpdateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMHost_List.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * DetachTrafficFilters_Update.json */ /** - * Sample code: VMHost_List. + * Sample code: DetachTrafficFilter_Update. * * @param manager Entry point to ElasticManager. */ - public static void vMHostList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.vMHosts().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void detachTrafficFilterUpdate(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.detachTrafficFilters() + .update("myResourceGroup", "myMonitor", "31d91b5afb6f4c2eaaf104c97b1991dd", + com.azure.core.util.Context.NONE); } } ``` @@ -942,20 +1093,20 @@ public final class VMHostListSamples { ```java /** - * Samples for VMIngestion Details. + * Samples for MonitoredSubscriptions List. */ -public final class VMIngestionDetailsSamples { +public final class MonitoredSubscriptionsListSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMIngestion_Details.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredSubscriptions_List.json */ /** - * Sample code: VMIngestion_Details. + * Sample code: Monitors_GetMonitoredSubscriptions. * * @param manager Entry point to ElasticManager. */ - public static void vMIngestionDetails(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.vMIngestions().detailsWithResponse("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + public static void monitorsGetMonitoredSubscriptions(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitoredSubscriptions().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/elastic/azure-resourcemanager-elastic/pom.xml b/sdk/elastic/azure-resourcemanager-elastic/pom.xml index 261a51ab6985..4b0909e8539f 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/pom.xml +++ b/sdk/elastic/azure-resourcemanager-elastic/pom.xml @@ -18,7 +18,7 @@ jar Microsoft Azure SDK for Elastic Management - This package contains Microsoft Azure SDK for Elastic Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-03-01. + This package contains Microsoft Azure SDK for Elastic Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2025-01-15-preview. https://github.com/Azure/azure-sdk-for-java @@ -45,6 +45,7 @@ UTF-8 0 0 + true diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java index e4f13187b7f5..8b17ed2a1761 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java @@ -11,6 +11,7 @@ import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -19,9 +20,9 @@ import com.azure.core.http.policy.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.ElasticManagementClient; import com.azure.resourcemanager.elastic.implementation.AllTrafficFiltersImpl; @@ -39,6 +40,7 @@ import com.azure.resourcemanager.elastic.implementation.ListAssociatedTrafficFiltersImpl; import com.azure.resourcemanager.elastic.implementation.MonitorOperationsImpl; import com.azure.resourcemanager.elastic.implementation.MonitoredResourcesImpl; +import com.azure.resourcemanager.elastic.implementation.MonitoredSubscriptionsImpl; import com.azure.resourcemanager.elastic.implementation.MonitorsImpl; import com.azure.resourcemanager.elastic.implementation.OpenAIsImpl; import com.azure.resourcemanager.elastic.implementation.OperationsImpl; @@ -63,6 +65,7 @@ import com.azure.resourcemanager.elastic.models.ListAssociatedTrafficFilters; import com.azure.resourcemanager.elastic.models.MonitorOperations; import com.azure.resourcemanager.elastic.models.MonitoredResources; +import com.azure.resourcemanager.elastic.models.MonitoredSubscriptions; import com.azure.resourcemanager.elastic.models.Monitors; import com.azure.resourcemanager.elastic.models.OpenAIs; import com.azure.resourcemanager.elastic.models.Operations; @@ -77,6 +80,7 @@ import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; @@ -86,51 +90,53 @@ public final class ElasticManager { private Operations operations; + private ElasticVersions elasticVersions; + + private Organizations organizations; + private Monitors monitors; - private ElasticVersions elasticVersions; + private AssociateTrafficFilters associateTrafficFilters; - private MonitoredResources monitoredResources; + private CreateAndAssociateIpFilters createAndAssociateIpFilters; - private DeploymentInfoes deploymentInfoes; + private CreateAndAssociatePLFilters createAndAssociatePLFilters; private ExternalUsers externalUsers; - private BillingInfoes billingInfoes; - - private ConnectedPartnerResources connectedPartnerResources; + private TrafficFilters trafficFilters; - private OpenAIs openAIs; + private DetachAndDeleteTrafficFilters detachAndDeleteTrafficFilters; - private TagRules tagRules; + private DetachTrafficFilters detachTrafficFilters; - private VMHosts vMHosts; + private BillingInfoes billingInfoes; - private VMIngestions vMIngestions; + private AllTrafficFilters allTrafficFilters; - private VMCollections vMCollections; + private ListAssociatedTrafficFilters listAssociatedTrafficFilters; - private UpgradableVersions upgradableVersions; + private ConnectedPartnerResources connectedPartnerResources; - private MonitorOperations monitorOperations; + private DeploymentInfoes deploymentInfoes; - private AllTrafficFilters allTrafficFilters; + private MonitoredResources monitoredResources; - private ListAssociatedTrafficFilters listAssociatedTrafficFilters; + private UpgradableVersions upgradableVersions; - private CreateAndAssociateIpFilters createAndAssociateIpFilters; + private VMHosts vMHosts; - private CreateAndAssociatePLFilters createAndAssociatePLFilters; + private MonitoredSubscriptions monitoredSubscriptions; - private AssociateTrafficFilters associateTrafficFilters; + private OpenAIs openAIs; - private DetachAndDeleteTrafficFilters detachAndDeleteTrafficFilters; + private TagRules tagRules; - private DetachTrafficFilters detachTrafficFilters; + private MonitorOperations monitorOperations; - private TrafficFilters trafficFilters; + private VMCollections vMCollections; - private Organizations organizations; + private VMIngestions vMIngestions; private final ElasticManagementClient clientObject; @@ -184,6 +190,9 @@ public static Configurable configure() { */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-elastic.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -291,12 +300,14 @@ public ElasticManager authenticate(TokenCredential credential, AzureProfile prof Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + StringBuilder userAgentBuilder = new StringBuilder(); userAgentBuilder.append("azsdk-java") .append("-") .append("com.azure.resourcemanager.elastic") .append("/") - .append("1.0.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -329,7 +340,7 @@ public ElasticManager authenticate(TokenCredential credential, AzureProfile prof HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .collect(Collectors.toList())); @@ -354,6 +365,30 @@ public Operations operations() { return operations; } + /** + * Gets the resource collection API of ElasticVersions. + * + * @return Resource collection API of ElasticVersions. + */ + public ElasticVersions elasticVersions() { + if (this.elasticVersions == null) { + this.elasticVersions = new ElasticVersionsImpl(clientObject.getElasticVersions(), this); + } + return elasticVersions; + } + + /** + * Gets the resource collection API of Organizations. + * + * @return Resource collection API of Organizations. + */ + public Organizations organizations() { + if (this.organizations == null) { + this.organizations = new OrganizationsImpl(clientObject.getOrganizations(), this); + } + return organizations; + } + /** * Gets the resource collection API of Monitors. It manages ElasticMonitorResource. * @@ -367,39 +402,42 @@ public Monitors monitors() { } /** - * Gets the resource collection API of ElasticVersions. + * Gets the resource collection API of AssociateTrafficFilters. * - * @return Resource collection API of ElasticVersions. + * @return Resource collection API of AssociateTrafficFilters. */ - public ElasticVersions elasticVersions() { - if (this.elasticVersions == null) { - this.elasticVersions = new ElasticVersionsImpl(clientObject.getElasticVersions(), this); + public AssociateTrafficFilters associateTrafficFilters() { + if (this.associateTrafficFilters == null) { + this.associateTrafficFilters + = new AssociateTrafficFiltersImpl(clientObject.getAssociateTrafficFilters(), this); } - return elasticVersions; + return associateTrafficFilters; } /** - * Gets the resource collection API of MonitoredResources. + * Gets the resource collection API of CreateAndAssociateIpFilters. * - * @return Resource collection API of MonitoredResources. + * @return Resource collection API of CreateAndAssociateIpFilters. */ - public MonitoredResources monitoredResources() { - if (this.monitoredResources == null) { - this.monitoredResources = new MonitoredResourcesImpl(clientObject.getMonitoredResources(), this); + public CreateAndAssociateIpFilters createAndAssociateIpFilters() { + if (this.createAndAssociateIpFilters == null) { + this.createAndAssociateIpFilters + = new CreateAndAssociateIpFiltersImpl(clientObject.getCreateAndAssociateIpFilters(), this); } - return monitoredResources; + return createAndAssociateIpFilters; } /** - * Gets the resource collection API of DeploymentInfoes. + * Gets the resource collection API of CreateAndAssociatePLFilters. * - * @return Resource collection API of DeploymentInfoes. + * @return Resource collection API of CreateAndAssociatePLFilters. */ - public DeploymentInfoes deploymentInfoes() { - if (this.deploymentInfoes == null) { - this.deploymentInfoes = new DeploymentInfoesImpl(clientObject.getDeploymentInfoes(), this); + public CreateAndAssociatePLFilters createAndAssociatePLFilters() { + if (this.createAndAssociatePLFilters == null) { + this.createAndAssociatePLFilters + = new CreateAndAssociatePLFiltersImpl(clientObject.getCreateAndAssociatePLFilters(), this); } - return deploymentInfoes; + return createAndAssociatePLFilters; } /** @@ -415,225 +453,211 @@ public ExternalUsers externalUsers() { } /** - * Gets the resource collection API of BillingInfoes. - * - * @return Resource collection API of BillingInfoes. - */ - public BillingInfoes billingInfoes() { - if (this.billingInfoes == null) { - this.billingInfoes = new BillingInfoesImpl(clientObject.getBillingInfoes(), this); - } - return billingInfoes; - } - - /** - * Gets the resource collection API of ConnectedPartnerResources. + * Gets the resource collection API of TrafficFilters. * - * @return Resource collection API of ConnectedPartnerResources. + * @return Resource collection API of TrafficFilters. */ - public ConnectedPartnerResources connectedPartnerResources() { - if (this.connectedPartnerResources == null) { - this.connectedPartnerResources - = new ConnectedPartnerResourcesImpl(clientObject.getConnectedPartnerResources(), this); + public TrafficFilters trafficFilters() { + if (this.trafficFilters == null) { + this.trafficFilters = new TrafficFiltersImpl(clientObject.getTrafficFilters(), this); } - return connectedPartnerResources; + return trafficFilters; } /** - * Gets the resource collection API of OpenAIs. It manages OpenAIIntegrationRPModel. + * Gets the resource collection API of DetachAndDeleteTrafficFilters. * - * @return Resource collection API of OpenAIs. + * @return Resource collection API of DetachAndDeleteTrafficFilters. */ - public OpenAIs openAIs() { - if (this.openAIs == null) { - this.openAIs = new OpenAIsImpl(clientObject.getOpenAIs(), this); + public DetachAndDeleteTrafficFilters detachAndDeleteTrafficFilters() { + if (this.detachAndDeleteTrafficFilters == null) { + this.detachAndDeleteTrafficFilters + = new DetachAndDeleteTrafficFiltersImpl(clientObject.getDetachAndDeleteTrafficFilters(), this); } - return openAIs; + return detachAndDeleteTrafficFilters; } /** - * Gets the resource collection API of TagRules. It manages MonitoringTagRules. + * Gets the resource collection API of DetachTrafficFilters. * - * @return Resource collection API of TagRules. + * @return Resource collection API of DetachTrafficFilters. */ - public TagRules tagRules() { - if (this.tagRules == null) { - this.tagRules = new TagRulesImpl(clientObject.getTagRules(), this); + public DetachTrafficFilters detachTrafficFilters() { + if (this.detachTrafficFilters == null) { + this.detachTrafficFilters = new DetachTrafficFiltersImpl(clientObject.getDetachTrafficFilters(), this); } - return tagRules; + return detachTrafficFilters; } /** - * Gets the resource collection API of VMHosts. + * Gets the resource collection API of BillingInfoes. * - * @return Resource collection API of VMHosts. + * @return Resource collection API of BillingInfoes. */ - public VMHosts vMHosts() { - if (this.vMHosts == null) { - this.vMHosts = new VMHostsImpl(clientObject.getVMHosts(), this); + public BillingInfoes billingInfoes() { + if (this.billingInfoes == null) { + this.billingInfoes = new BillingInfoesImpl(clientObject.getBillingInfoes(), this); } - return vMHosts; + return billingInfoes; } /** - * Gets the resource collection API of VMIngestions. + * Gets the resource collection API of AllTrafficFilters. * - * @return Resource collection API of VMIngestions. + * @return Resource collection API of AllTrafficFilters. */ - public VMIngestions vMIngestions() { - if (this.vMIngestions == null) { - this.vMIngestions = new VMIngestionsImpl(clientObject.getVMIngestions(), this); + public AllTrafficFilters allTrafficFilters() { + if (this.allTrafficFilters == null) { + this.allTrafficFilters = new AllTrafficFiltersImpl(clientObject.getAllTrafficFilters(), this); } - return vMIngestions; + return allTrafficFilters; } /** - * Gets the resource collection API of VMCollections. + * Gets the resource collection API of ListAssociatedTrafficFilters. * - * @return Resource collection API of VMCollections. + * @return Resource collection API of ListAssociatedTrafficFilters. */ - public VMCollections vMCollections() { - if (this.vMCollections == null) { - this.vMCollections = new VMCollectionsImpl(clientObject.getVMCollections(), this); + public ListAssociatedTrafficFilters listAssociatedTrafficFilters() { + if (this.listAssociatedTrafficFilters == null) { + this.listAssociatedTrafficFilters + = new ListAssociatedTrafficFiltersImpl(clientObject.getListAssociatedTrafficFilters(), this); } - return vMCollections; + return listAssociatedTrafficFilters; } /** - * Gets the resource collection API of UpgradableVersions. + * Gets the resource collection API of ConnectedPartnerResources. * - * @return Resource collection API of UpgradableVersions. + * @return Resource collection API of ConnectedPartnerResources. */ - public UpgradableVersions upgradableVersions() { - if (this.upgradableVersions == null) { - this.upgradableVersions = new UpgradableVersionsImpl(clientObject.getUpgradableVersions(), this); + public ConnectedPartnerResources connectedPartnerResources() { + if (this.connectedPartnerResources == null) { + this.connectedPartnerResources + = new ConnectedPartnerResourcesImpl(clientObject.getConnectedPartnerResources(), this); } - return upgradableVersions; + return connectedPartnerResources; } /** - * Gets the resource collection API of MonitorOperations. + * Gets the resource collection API of DeploymentInfoes. * - * @return Resource collection API of MonitorOperations. + * @return Resource collection API of DeploymentInfoes. */ - public MonitorOperations monitorOperations() { - if (this.monitorOperations == null) { - this.monitorOperations = new MonitorOperationsImpl(clientObject.getMonitorOperations(), this); + public DeploymentInfoes deploymentInfoes() { + if (this.deploymentInfoes == null) { + this.deploymentInfoes = new DeploymentInfoesImpl(clientObject.getDeploymentInfoes(), this); } - return monitorOperations; + return deploymentInfoes; } /** - * Gets the resource collection API of AllTrafficFilters. + * Gets the resource collection API of MonitoredResources. * - * @return Resource collection API of AllTrafficFilters. + * @return Resource collection API of MonitoredResources. */ - public AllTrafficFilters allTrafficFilters() { - if (this.allTrafficFilters == null) { - this.allTrafficFilters = new AllTrafficFiltersImpl(clientObject.getAllTrafficFilters(), this); + public MonitoredResources monitoredResources() { + if (this.monitoredResources == null) { + this.monitoredResources = new MonitoredResourcesImpl(clientObject.getMonitoredResources(), this); } - return allTrafficFilters; + return monitoredResources; } /** - * Gets the resource collection API of ListAssociatedTrafficFilters. + * Gets the resource collection API of UpgradableVersions. * - * @return Resource collection API of ListAssociatedTrafficFilters. + * @return Resource collection API of UpgradableVersions. */ - public ListAssociatedTrafficFilters listAssociatedTrafficFilters() { - if (this.listAssociatedTrafficFilters == null) { - this.listAssociatedTrafficFilters - = new ListAssociatedTrafficFiltersImpl(clientObject.getListAssociatedTrafficFilters(), this); + public UpgradableVersions upgradableVersions() { + if (this.upgradableVersions == null) { + this.upgradableVersions = new UpgradableVersionsImpl(clientObject.getUpgradableVersions(), this); } - return listAssociatedTrafficFilters; + return upgradableVersions; } /** - * Gets the resource collection API of CreateAndAssociateIpFilters. + * Gets the resource collection API of VMHosts. * - * @return Resource collection API of CreateAndAssociateIpFilters. + * @return Resource collection API of VMHosts. */ - public CreateAndAssociateIpFilters createAndAssociateIpFilters() { - if (this.createAndAssociateIpFilters == null) { - this.createAndAssociateIpFilters - = new CreateAndAssociateIpFiltersImpl(clientObject.getCreateAndAssociateIpFilters(), this); + public VMHosts vMHosts() { + if (this.vMHosts == null) { + this.vMHosts = new VMHostsImpl(clientObject.getVMHosts(), this); } - return createAndAssociateIpFilters; + return vMHosts; } /** - * Gets the resource collection API of CreateAndAssociatePLFilters. + * Gets the resource collection API of MonitoredSubscriptions. It manages MonitoredSubscriptionProperties. * - * @return Resource collection API of CreateAndAssociatePLFilters. + * @return Resource collection API of MonitoredSubscriptions. */ - public CreateAndAssociatePLFilters createAndAssociatePLFilters() { - if (this.createAndAssociatePLFilters == null) { - this.createAndAssociatePLFilters - = new CreateAndAssociatePLFiltersImpl(clientObject.getCreateAndAssociatePLFilters(), this); + public MonitoredSubscriptions monitoredSubscriptions() { + if (this.monitoredSubscriptions == null) { + this.monitoredSubscriptions + = new MonitoredSubscriptionsImpl(clientObject.getMonitoredSubscriptions(), this); } - return createAndAssociatePLFilters; + return monitoredSubscriptions; } /** - * Gets the resource collection API of AssociateTrafficFilters. + * Gets the resource collection API of OpenAIs. It manages OpenAIIntegrationRPModel. * - * @return Resource collection API of AssociateTrafficFilters. + * @return Resource collection API of OpenAIs. */ - public AssociateTrafficFilters associateTrafficFilters() { - if (this.associateTrafficFilters == null) { - this.associateTrafficFilters - = new AssociateTrafficFiltersImpl(clientObject.getAssociateTrafficFilters(), this); + public OpenAIs openAIs() { + if (this.openAIs == null) { + this.openAIs = new OpenAIsImpl(clientObject.getOpenAIs(), this); } - return associateTrafficFilters; + return openAIs; } /** - * Gets the resource collection API of DetachAndDeleteTrafficFilters. + * Gets the resource collection API of TagRules. It manages MonitoringTagRules. * - * @return Resource collection API of DetachAndDeleteTrafficFilters. + * @return Resource collection API of TagRules. */ - public DetachAndDeleteTrafficFilters detachAndDeleteTrafficFilters() { - if (this.detachAndDeleteTrafficFilters == null) { - this.detachAndDeleteTrafficFilters - = new DetachAndDeleteTrafficFiltersImpl(clientObject.getDetachAndDeleteTrafficFilters(), this); + public TagRules tagRules() { + if (this.tagRules == null) { + this.tagRules = new TagRulesImpl(clientObject.getTagRules(), this); } - return detachAndDeleteTrafficFilters; + return tagRules; } /** - * Gets the resource collection API of DetachTrafficFilters. + * Gets the resource collection API of MonitorOperations. * - * @return Resource collection API of DetachTrafficFilters. + * @return Resource collection API of MonitorOperations. */ - public DetachTrafficFilters detachTrafficFilters() { - if (this.detachTrafficFilters == null) { - this.detachTrafficFilters = new DetachTrafficFiltersImpl(clientObject.getDetachTrafficFilters(), this); + public MonitorOperations monitorOperations() { + if (this.monitorOperations == null) { + this.monitorOperations = new MonitorOperationsImpl(clientObject.getMonitorOperations(), this); } - return detachTrafficFilters; + return monitorOperations; } /** - * Gets the resource collection API of TrafficFilters. + * Gets the resource collection API of VMCollections. * - * @return Resource collection API of TrafficFilters. + * @return Resource collection API of VMCollections. */ - public TrafficFilters trafficFilters() { - if (this.trafficFilters == null) { - this.trafficFilters = new TrafficFiltersImpl(clientObject.getTrafficFilters(), this); + public VMCollections vMCollections() { + if (this.vMCollections == null) { + this.vMCollections = new VMCollectionsImpl(clientObject.getVMCollections(), this); } - return trafficFilters; + return vMCollections; } /** - * Gets the resource collection API of Organizations. + * Gets the resource collection API of VMIngestions. * - * @return Resource collection API of Organizations. + * @return Resource collection API of VMIngestions. */ - public Organizations organizations() { - if (this.organizations == null) { - this.organizations = new OrganizationsImpl(clientObject.getOrganizations(), this); + public VMIngestions vMIngestions() { + if (this.vMIngestions == null) { + this.vMIngestions = new VMIngestionsImpl(clientObject.getVMIngestions(), this); } - return organizations; + return vMIngestions; } /** diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/ElasticManagementClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/ElasticManagementClient.java index 828a80ef1989..e235148671ab 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/ElasticManagementClient.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/ElasticManagementClient.java @@ -53,6 +53,20 @@ public interface ElasticManagementClient { */ OperationsClient getOperations(); + /** + * Gets the ElasticVersionsClient object to access its operations. + * + * @return the ElasticVersionsClient object. + */ + ElasticVersionsClient getElasticVersions(); + + /** + * Gets the OrganizationsClient object to access its operations. + * + * @return the OrganizationsClient object. + */ + OrganizationsClient getOrganizations(); + /** * Gets the MonitorsClient object to access its operations. * @@ -61,25 +75,25 @@ public interface ElasticManagementClient { MonitorsClient getMonitors(); /** - * Gets the ElasticVersionsClient object to access its operations. + * Gets the AssociateTrafficFiltersClient object to access its operations. * - * @return the ElasticVersionsClient object. + * @return the AssociateTrafficFiltersClient object. */ - ElasticVersionsClient getElasticVersions(); + AssociateTrafficFiltersClient getAssociateTrafficFilters(); /** - * Gets the MonitoredResourcesClient object to access its operations. + * Gets the CreateAndAssociateIpFiltersClient object to access its operations. * - * @return the MonitoredResourcesClient object. + * @return the CreateAndAssociateIpFiltersClient object. */ - MonitoredResourcesClient getMonitoredResources(); + CreateAndAssociateIpFiltersClient getCreateAndAssociateIpFilters(); /** - * Gets the DeploymentInfoesClient object to access its operations. + * Gets the CreateAndAssociatePLFiltersClient object to access its operations. * - * @return the DeploymentInfoesClient object. + * @return the CreateAndAssociatePLFiltersClient object. */ - DeploymentInfoesClient getDeploymentInfoes(); + CreateAndAssociatePLFiltersClient getCreateAndAssociatePLFilters(); /** * Gets the ExternalUsersClient object to access its operations. @@ -89,128 +103,121 @@ public interface ElasticManagementClient { ExternalUsersClient getExternalUsers(); /** - * Gets the BillingInfoesClient object to access its operations. - * - * @return the BillingInfoesClient object. - */ - BillingInfoesClient getBillingInfoes(); - - /** - * Gets the ConnectedPartnerResourcesClient object to access its operations. + * Gets the TrafficFiltersClient object to access its operations. * - * @return the ConnectedPartnerResourcesClient object. + * @return the TrafficFiltersClient object. */ - ConnectedPartnerResourcesClient getConnectedPartnerResources(); + TrafficFiltersClient getTrafficFilters(); /** - * Gets the OpenAIsClient object to access its operations. + * Gets the DetachAndDeleteTrafficFiltersClient object to access its operations. * - * @return the OpenAIsClient object. + * @return the DetachAndDeleteTrafficFiltersClient object. */ - OpenAIsClient getOpenAIs(); + DetachAndDeleteTrafficFiltersClient getDetachAndDeleteTrafficFilters(); /** - * Gets the TagRulesClient object to access its operations. + * Gets the DetachTrafficFiltersClient object to access its operations. * - * @return the TagRulesClient object. + * @return the DetachTrafficFiltersClient object. */ - TagRulesClient getTagRules(); + DetachTrafficFiltersClient getDetachTrafficFilters(); /** - * Gets the VMHostsClient object to access its operations. + * Gets the BillingInfoesClient object to access its operations. * - * @return the VMHostsClient object. + * @return the BillingInfoesClient object. */ - VMHostsClient getVMHosts(); + BillingInfoesClient getBillingInfoes(); /** - * Gets the VMIngestionsClient object to access its operations. + * Gets the AllTrafficFiltersClient object to access its operations. * - * @return the VMIngestionsClient object. + * @return the AllTrafficFiltersClient object. */ - VMIngestionsClient getVMIngestions(); + AllTrafficFiltersClient getAllTrafficFilters(); /** - * Gets the VMCollectionsClient object to access its operations. + * Gets the ListAssociatedTrafficFiltersClient object to access its operations. * - * @return the VMCollectionsClient object. + * @return the ListAssociatedTrafficFiltersClient object. */ - VMCollectionsClient getVMCollections(); + ListAssociatedTrafficFiltersClient getListAssociatedTrafficFilters(); /** - * Gets the UpgradableVersionsClient object to access its operations. + * Gets the ConnectedPartnerResourcesClient object to access its operations. * - * @return the UpgradableVersionsClient object. + * @return the ConnectedPartnerResourcesClient object. */ - UpgradableVersionsClient getUpgradableVersions(); + ConnectedPartnerResourcesClient getConnectedPartnerResources(); /** - * Gets the MonitorOperationsClient object to access its operations. + * Gets the DeploymentInfoesClient object to access its operations. * - * @return the MonitorOperationsClient object. + * @return the DeploymentInfoesClient object. */ - MonitorOperationsClient getMonitorOperations(); + DeploymentInfoesClient getDeploymentInfoes(); /** - * Gets the AllTrafficFiltersClient object to access its operations. + * Gets the MonitoredResourcesClient object to access its operations. * - * @return the AllTrafficFiltersClient object. + * @return the MonitoredResourcesClient object. */ - AllTrafficFiltersClient getAllTrafficFilters(); + MonitoredResourcesClient getMonitoredResources(); /** - * Gets the ListAssociatedTrafficFiltersClient object to access its operations. + * Gets the UpgradableVersionsClient object to access its operations. * - * @return the ListAssociatedTrafficFiltersClient object. + * @return the UpgradableVersionsClient object. */ - ListAssociatedTrafficFiltersClient getListAssociatedTrafficFilters(); + UpgradableVersionsClient getUpgradableVersions(); /** - * Gets the CreateAndAssociateIpFiltersClient object to access its operations. + * Gets the VMHostsClient object to access its operations. * - * @return the CreateAndAssociateIpFiltersClient object. + * @return the VMHostsClient object. */ - CreateAndAssociateIpFiltersClient getCreateAndAssociateIpFilters(); + VMHostsClient getVMHosts(); /** - * Gets the CreateAndAssociatePLFiltersClient object to access its operations. + * Gets the MonitoredSubscriptionsClient object to access its operations. * - * @return the CreateAndAssociatePLFiltersClient object. + * @return the MonitoredSubscriptionsClient object. */ - CreateAndAssociatePLFiltersClient getCreateAndAssociatePLFilters(); + MonitoredSubscriptionsClient getMonitoredSubscriptions(); /** - * Gets the AssociateTrafficFiltersClient object to access its operations. + * Gets the OpenAIsClient object to access its operations. * - * @return the AssociateTrafficFiltersClient object. + * @return the OpenAIsClient object. */ - AssociateTrafficFiltersClient getAssociateTrafficFilters(); + OpenAIsClient getOpenAIs(); /** - * Gets the DetachAndDeleteTrafficFiltersClient object to access its operations. + * Gets the TagRulesClient object to access its operations. * - * @return the DetachAndDeleteTrafficFiltersClient object. + * @return the TagRulesClient object. */ - DetachAndDeleteTrafficFiltersClient getDetachAndDeleteTrafficFilters(); + TagRulesClient getTagRules(); /** - * Gets the DetachTrafficFiltersClient object to access its operations. + * Gets the MonitorOperationsClient object to access its operations. * - * @return the DetachTrafficFiltersClient object. + * @return the MonitorOperationsClient object. */ - DetachTrafficFiltersClient getDetachTrafficFilters(); + MonitorOperationsClient getMonitorOperations(); /** - * Gets the TrafficFiltersClient object to access its operations. + * Gets the VMCollectionsClient object to access its operations. * - * @return the TrafficFiltersClient object. + * @return the VMCollectionsClient object. */ - TrafficFiltersClient getTrafficFilters(); + VMCollectionsClient getVMCollections(); /** - * Gets the OrganizationsClient object to access its operations. + * Gets the VMIngestionsClient object to access its operations. * - * @return the OrganizationsClient object. + * @return the VMIngestionsClient object. */ - OrganizationsClient getOrganizations(); + VMIngestionsClient getVMIngestions(); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitoredSubscriptionsClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitoredSubscriptionsClient.java new file mode 100644 index 000000000000..08f9f77f329a --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitoredSubscriptionsClient.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.elastic.fluent.models.MonitoredSubscriptionPropertiesInner; + +/** + * An instance of this class provides access to all the operations defined in MonitoredSubscriptionsClient. + */ +public interface MonitoredSubscriptionsClient { + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName); + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName, + Context context); + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String monitorName, + String configurationName, Context context); + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitoredSubscriptionPropertiesInner get(String resourceGroupName, String monitorName, String configurationName); + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the request to update subscriptions needed to be monitored by the + * Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MonitoredSubscriptionPropertiesInner> + beginCreateorUpdate(String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body); + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the request to update subscriptions needed to be monitored by the + * Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MonitoredSubscriptionPropertiesInner> + beginCreateorUpdate(String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body, Context context); + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitoredSubscriptionPropertiesInner createorUpdate(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body); + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitoredSubscriptionPropertiesInner createorUpdate(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body, Context context); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the request to update subscriptions needed to be monitored by the + * Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MonitoredSubscriptionPropertiesInner> beginUpdate( + String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the request to update subscriptions needed to be monitored by the + * Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MonitoredSubscriptionPropertiesInner> beginUpdate( + String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body, Context context); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitoredSubscriptionPropertiesInner update(String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitoredSubscriptionPropertiesInner update(String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body, Context context); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, + String configurationName); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, + String configurationName, Context context); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName, String configurationName); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName, String configurationName, Context context); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitorsClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitorsClient.java index c11a7159df22..13382aa4a27e 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitorsClient.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitorsClient.java @@ -98,6 +98,7 @@ Response getByResourceGroupWithResponse(String reso * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -105,7 +106,7 @@ Response getByResourceGroupWithResponse(String reso */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ElasticMonitorResourceInner> - beginCreate(String resourceGroupName, String monitorName); + beginCreate(String resourceGroupName, String monitorName, ElasticMonitorResourceInner body); /** * Create a monitor resource. @@ -128,13 +129,14 @@ Response getByResourceGroupWithResponse(String reso * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return monitor resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - ElasticMonitorResourceInner create(String resourceGroupName, String monitorName); + ElasticMonitorResourceInner create(String resourceGroupName, String monitorName, ElasticMonitorResourceInner body); /** * Create a monitor resource. @@ -152,6 +154,21 @@ Response getByResourceGroupWithResponse(String reso ElasticMonitorResourceInner create(String resourceGroupName, String monitorName, ElasticMonitorResourceInner body, Context context); + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ElasticMonitorResourceInner> + beginUpdate(String resourceGroupName, String monitorName, ElasticMonitorResourceUpdateParameters body); + /** * Update a monitor resource. * @@ -162,24 +179,42 @@ ElasticMonitorResourceInner create(String resourceGroupName, String monitorName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return monitor resource along with {@link Response}. + * @return the {@link SyncPoller} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ElasticMonitorResourceInner> beginUpdate( + String resourceGroupName, String monitorName, ElasticMonitorResourceUpdateParameters body, Context context); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse(String resourceGroupName, String monitorName, - ElasticMonitorResourceUpdateParameters body, Context context); + ElasticMonitorResourceInner update(String resourceGroupName, String monitorName, + ElasticMonitorResourceUpdateParameters body); /** * Update a monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return monitor resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - ElasticMonitorResourceInner update(String resourceGroupName, String monitorName); + ElasticMonitorResourceInner update(String resourceGroupName, String monitorName, + ElasticMonitorResourceUpdateParameters body, Context context); /** * Delete a monitor resource. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OpenAIsClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OpenAIsClient.java index 0874f364e09c..1d660fed8168 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OpenAIsClient.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OpenAIsClient.java @@ -96,13 +96,15 @@ Response createOrUpdateWithResponse(String resour * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param integrationName OpenAI Integration name. + * @param body The body parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return capture properties of Open AI resource Integration. */ @ServiceMethod(returns = ReturnType.SINGLE) - OpenAIIntegrationRPModelInner createOrUpdate(String resourceGroupName, String monitorName, String integrationName); + OpenAIIntegrationRPModelInner createOrUpdate(String resourceGroupName, String monitorName, String integrationName, + OpenAIIntegrationRPModelInner body); /** * Delete OpenAI integration rule for a given monitor resource. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OperationsClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OperationsClient.java index b1a10f1f5ee4..f953a99c13d9 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OperationsClient.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OperationsClient.java @@ -15,25 +15,23 @@ */ public interface OperationsClient { /** - * List all operations provided by Microsoft.Elastic. + * List the operations for the provider. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations as paginated response with - * {@link PagedIterable}. + * @return represents a paginated list of operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); /** - * List all operations provided by Microsoft.Elastic. + * List the operations for the provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations as paginated response with - * {@link PagedIterable}. + * @return represents a paginated list of operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OrganizationsClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OrganizationsClient.java index 6a4fe7e8c923..e2fb86a18132 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OrganizationsClient.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OrganizationsClient.java @@ -7,20 +7,56 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.elastic.fluent.models.ElasticMonitorResourceInner; import com.azure.resourcemanager.elastic.fluent.models.ElasticOrganizationToAzureSubscriptionMappingResponseInner; import com.azure.resourcemanager.elastic.fluent.models.UserApiKeyResponseInner; +import com.azure.resourcemanager.elastic.models.ResubscribeProperties; import com.azure.resourcemanager.elastic.models.UserEmailId; /** * An instance of this class provides access to all the operations defined in OrganizationsClient. */ public interface OrganizationsClient { + /** + * 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response + getElasticToAzureSubscriptionMappingWithResponse(Context context); + + /** + * 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. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticOrganizationToAzureSubscriptionMappingResponseInner getElasticToAzureSubscriptionMapping(); + /** * Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch * Organization. * - * @param body Email Id parameter of the User Organization, of which the API Key must be returned. + * @param body The request body. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -35,35 +71,72 @@ public interface OrganizationsClient { * Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch * Organization. * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the User Api Key created for the Organization associated with the User Email Id that was passed in the * request. */ @ServiceMethod(returns = ReturnType.SINGLE) - UserApiKeyResponseInner getApiKey(); + UserApiKeyResponseInner getApiKey(UserEmailId body); /** - * Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + * Resubscribe the Elasticsearch Organization. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ElasticMonitorResourceInner> + beginResubscribe(String resourceGroupName, String monitorName); + + /** + * Resubscribe the Elasticsearch Organization. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return elastic Organization To Azure Subscription Mapping details for the logged-in user along with - * {@link Response}. + * @return the {@link SyncPoller} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ElasticMonitorResourceInner> + beginResubscribe(String resourceGroupName, String monitorName, ResubscribeProperties body, Context context); + + /** + * Resubscribe the Elasticsearch Organization. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response - getElasticToAzureSubscriptionMappingWithResponse(Context context); + ElasticMonitorResourceInner resubscribe(String resourceGroupName, String monitorName); /** - * Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + * Resubscribe the Elasticsearch Organization. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return elastic Organization To Azure Subscription Mapping details for the logged-in user. + * @return monitor resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - ElasticOrganizationToAzureSubscriptionMappingResponseInner getElasticToAzureSubscriptionMapping(); + ElasticMonitorResourceInner resubscribe(String resourceGroupName, String monitorName, ResubscribeProperties body, + Context context); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/TagRulesClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/TagRulesClient.java index c9556b6f65dd..d8efcff0886e 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/TagRulesClient.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/TagRulesClient.java @@ -45,24 +45,23 @@ public interface TagRulesClient { PagedIterable list(String resourceGroupName, String monitorName, Context context); /** - * Create or update a tag rule set for a given monitor resource. + * Get a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. - * @param body request body of MonitoringTagRules. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return capture logs and metrics of Azure resources based on ARM tags along with {@link Response}. + * @return a tag rule set for a given monitor resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse(String resourceGroupName, String monitorName, - String ruleSetName, MonitoringTagRulesInner body, Context context); + Response getWithResponse(String resourceGroupName, String monitorName, String ruleSetName, + Context context); /** - * Create or update a tag rule set for a given monitor resource. + * Get a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. @@ -70,40 +69,43 @@ Response createOrUpdateWithResponse(String resourceGrou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return capture logs and metrics of Azure resources based on ARM tags. + * @return a tag rule set for a given monitor resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - MonitoringTagRulesInner createOrUpdate(String resourceGroupName, String monitorName, String ruleSetName); + MonitoringTagRulesInner get(String resourceGroupName, String monitorName, String ruleSetName); /** - * Get a tag rule set for a given monitor resource. + * Create or update a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a tag rule set for a given monitor resource along with {@link Response}. + * @return capture logs and metrics of Azure resources based on ARM tags along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String monitorName, String ruleSetName, - Context context); + Response createOrUpdateWithResponse(String resourceGroupName, String monitorName, + String ruleSetName, MonitoringTagRulesInner body, Context context); /** - * Get a tag rule set for a given monitor resource. + * Create or update a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a tag rule set for a given monitor resource. + * @return capture logs and metrics of Azure resources based on ARM tags. */ @ServiceMethod(returns = ReturnType.SINGLE) - MonitoringTagRulesInner get(String resourceGroupName, String monitorName, String ruleSetName); + MonitoringTagRulesInner createOrUpdate(String resourceGroupName, String monitorName, String ruleSetName, + MonitoringTagRulesInner body); /** * Delete a tag rule set for a given monitor resource. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/DeploymentInfoResponseInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/DeploymentInfoResponseInner.java index 5c7bc52bc0a8..1b28d1e57f58 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/DeploymentInfoResponseInner.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/DeploymentInfoResponseInner.java @@ -54,6 +54,16 @@ public final class DeploymentInfoResponseInner implements JsonSerializable tags) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (sku() != null) { - sku().validate(); - } if (properties() != null) { properties().validate(); } + if (sku() != null) { + sku().validate(); + } if (identity() != null) { identity().validate(); } @@ -204,8 +229,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("location", location()); jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("sku", this.sku); jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeJsonField("sku", this.sku); jsonWriter.writeJsonField("identity", this.identity); return jsonWriter.writeEndObject(); } @@ -237,10 +263,12 @@ public static ElasticMonitorResourceInner fromJson(JsonReader jsonReader) throws } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); deserializedElasticMonitorResourceInner.withTags(tags); - } else if ("sku".equals(fieldName)) { - deserializedElasticMonitorResourceInner.sku = ResourceSku.fromJson(reader); } else if ("properties".equals(fieldName)) { deserializedElasticMonitorResourceInner.properties = MonitorProperties.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedElasticMonitorResourceInner.kind = reader.getString(); + } else if ("sku".equals(fieldName)) { + deserializedElasticMonitorResourceInner.sku = ResourceSku.fromJson(reader); } else if ("identity".equals(fieldName)) { deserializedElasticMonitorResourceInner.identity = IdentityProperties.fromJson(reader); } else if ("systemData".equals(fieldName)) { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoredSubscriptionPropertiesInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoredSubscriptionPropertiesInner.java new file mode 100644 index 000000000000..ec33669cfbf2 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoredSubscriptionPropertiesInner.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.elastic.models.SubscriptionList; +import java.io.IOException; + +/** + * The request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ +@Fluent +public final class MonitoredSubscriptionPropertiesInner extends ProxyResource { + /* + * The request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + private SubscriptionList properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MonitoredSubscriptionPropertiesInner class. + */ + public MonitoredSubscriptionPropertiesInner() { + } + + /** + * Get the properties property: The request to update subscriptions needed to be monitored by the Elastic monitor + * resource. + * + * @return the properties value. + */ + public SubscriptionList properties() { + return this.properties; + } + + /** + * Set the properties property: The request to update subscriptions needed to be monitored by the Elastic monitor + * resource. + * + * @param properties the properties value to set. + * @return the MonitoredSubscriptionPropertiesInner object itself. + */ + public MonitoredSubscriptionPropertiesInner withProperties(SubscriptionList properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MonitoredSubscriptionPropertiesInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MonitoredSubscriptionPropertiesInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MonitoredSubscriptionPropertiesInner. + */ + public static MonitoredSubscriptionPropertiesInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MonitoredSubscriptionPropertiesInner deserializedMonitoredSubscriptionPropertiesInner + = new MonitoredSubscriptionPropertiesInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMonitoredSubscriptionPropertiesInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMonitoredSubscriptionPropertiesInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMonitoredSubscriptionPropertiesInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedMonitoredSubscriptionPropertiesInner.properties = SubscriptionList.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedMonitoredSubscriptionPropertiesInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMonitoredSubscriptionPropertiesInner; + }); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoringTagRulesInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoringTagRulesInner.java index 8e0601ee525b..76540d594ae4 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoringTagRulesInner.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoringTagRulesInner.java @@ -24,7 +24,7 @@ public final class MonitoringTagRulesInner extends ProxyResource { private MonitoringTagRulesProperties properties; /* - * The system metadata relating to this resource + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ private SystemData systemData; @@ -70,7 +70,7 @@ public MonitoringTagRulesInner withProperties(MonitoringTagRulesProperties prope } /** - * Get the systemData property: The system metadata relating to this resource. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/OpenAIIntegrationRPModelInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/OpenAIIntegrationRPModelInner.java index 3a525d365a35..4aa26cf53d4f 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/OpenAIIntegrationRPModelInner.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/OpenAIIntegrationRPModelInner.java @@ -6,6 +6,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -22,6 +23,11 @@ public final class OpenAIIntegrationRPModelInner extends ProxyResource { */ private OpenAIIntegrationProperties properties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -63,6 +69,15 @@ public OpenAIIntegrationRPModelInner withProperties(OpenAIIntegrationProperties return this; } + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the type property: The type of the resource. * @@ -139,6 +154,8 @@ public static OpenAIIntegrationRPModelInner fromJson(JsonReader jsonReader) thro deserializedOpenAIIntegrationRPModelInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedOpenAIIntegrationRPModelInner.properties = OpenAIIntegrationProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedOpenAIIntegrationRPModelInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/AllTrafficFiltersClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/AllTrafficFiltersClientImpl.java index 8045e5ea76b1..730cf8099411 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/AllTrafficFiltersClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/AllTrafficFiltersClientImpl.java @@ -21,6 +21,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.AllTrafficFiltersClient; import com.azure.resourcemanager.elastic.fluent.models.ElasticTrafficFilterResponseInner; import reactor.core.publisher.Mono; @@ -65,6 +66,15 @@ Mono> list(@HostParam("$host") Strin @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAllTrafficFilters") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); } /** @@ -103,42 +113,6 @@ private Mono> listWithResponseAsync( .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get the list of all traffic filters for the account. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of all traffic filters for the account along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(String resourceGroupName, - String monitorName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context); - } - /** * Get the list of all traffic filters for the account. * @@ -168,7 +142,27 @@ private Mono listAsync(String resourceGroupNa @ServiceMethod(returns = ReturnType.SINGLE) public Response listWithResponse(String resourceGroupName, String monitorName, Context context) { - return listWithResponseAsync(resourceGroupName, monitorName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, context); } /** @@ -185,4 +179,6 @@ public Response listWithResponse(String resou public ElasticTrafficFilterResponseInner list(String resourceGroupName, String monitorName) { return listWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(AllTrafficFiltersClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/AssociateTrafficFiltersClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/AssociateTrafficFiltersClientImpl.java index 5f31a078f150..40ff575de390 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/AssociateTrafficFiltersClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/AssociateTrafficFiltersClientImpl.java @@ -20,8 +20,10 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.elastic.fluent.AssociateTrafficFiltersClient; @@ -69,6 +71,15 @@ Mono>> associate(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @QueryParam("rulesetId") String rulesetId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/associateTrafficFilter") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response associateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @QueryParam("rulesetId") String rulesetId, @HeaderParam("Accept") String accept, Context context); } /** @@ -107,6 +118,42 @@ private Mono>> associateWithResponseAsync(String resou .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Associate traffic filter for the given deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param rulesetId Ruleset Id of the filter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response associateWithResponse(String resourceGroupName, String monitorName, String rulesetId) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.associateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, rulesetId, accept, Context.NONE); + } + /** * Associate traffic filter for the given deployment. * @@ -117,29 +164,31 @@ private Mono>> associateWithResponseAsync(String resou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> associateWithResponseAsync(String resourceGroupName, String monitorName, - String rulesetId, Context context) { + private Response associateWithResponse(String resourceGroupName, String monitorName, String rulesetId, + Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.associate(this.client.getEndpoint(), this.client.getApiVersion(), + return service.associateSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, monitorName, rulesetId, accept, context); } @@ -186,20 +235,16 @@ private PollerFlux, Void> beginAssociateAsync(String resourceGr * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param rulesetId Ruleset Id of the filter. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginAssociateAsync(String resourceGroupName, String monitorName, - String rulesetId, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = associateWithResponseAsync(resourceGroupName, monitorName, rulesetId, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + public SyncPoller, Void> beginAssociate(String resourceGroupName, String monitorName, + String rulesetId) { + Response response = associateWithResponse(resourceGroupName, monitorName, rulesetId); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -215,7 +260,8 @@ private PollerFlux, Void> beginAssociateAsync(String resourceGr @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginAssociate(String resourceGroupName, String monitorName) { final String rulesetId = null; - return this.beginAssociateAsync(resourceGroupName, monitorName, rulesetId).getSyncPoller(); + Response response = associateWithResponse(resourceGroupName, monitorName, rulesetId); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -233,7 +279,8 @@ public SyncPoller, Void> beginAssociate(String resourceGroupNam @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginAssociate(String resourceGroupName, String monitorName, String rulesetId, Context context) { - return this.beginAssociateAsync(resourceGroupName, monitorName, rulesetId, context).getSyncPoller(); + Response response = associateWithResponse(resourceGroupName, monitorName, rulesetId, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -270,24 +317,6 @@ private Mono associateAsync(String resourceGroupName, String monitorName) .flatMap(this.client::getLroFinalResultOrError); } - /** - * Associate traffic filter for the given deployment. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param rulesetId Ruleset Id of the filter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono associateAsync(String resourceGroupName, String monitorName, String rulesetId, Context context) { - return beginAssociateAsync(resourceGroupName, monitorName, rulesetId, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Associate traffic filter for the given deployment. * @@ -300,7 +329,7 @@ private Mono associateAsync(String resourceGroupName, String monitorName, @ServiceMethod(returns = ReturnType.SINGLE) public void associate(String resourceGroupName, String monitorName) { final String rulesetId = null; - associateAsync(resourceGroupName, monitorName, rulesetId).block(); + beginAssociate(resourceGroupName, monitorName, rulesetId).getFinalResult(); } /** @@ -316,6 +345,8 @@ public void associate(String resourceGroupName, String monitorName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void associate(String resourceGroupName, String monitorName, String rulesetId, Context context) { - associateAsync(resourceGroupName, monitorName, rulesetId, context).block(); + beginAssociate(resourceGroupName, monitorName, rulesetId, context).getFinalResult(); } + + private static final ClientLogger LOGGER = new ClientLogger(AssociateTrafficFiltersClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/BillingInfoesClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/BillingInfoesClientImpl.java index d8ac7d4696a5..edcb9a98b22a 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/BillingInfoesClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/BillingInfoesClientImpl.java @@ -21,6 +21,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.BillingInfoesClient; import com.azure.resourcemanager.elastic.fluent.models.BillingInfoResponseInner; import reactor.core.publisher.Mono; @@ -65,6 +66,15 @@ Mono> get(@HostParam("$host") String endpoint @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/getBillingInfo") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); } /** @@ -103,42 +113,6 @@ private Mono> getWithResponseAsync(String res .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get marketplace and organization info mapped to the given monitor. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return marketplace and organization info mapped to the given monitor along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String monitorName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context); - } - /** * Get marketplace and organization info mapped to the given monitor. * @@ -168,7 +142,27 @@ private Mono getAsync(String resourceGroupName, String @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String monitorName, Context context) { - return getWithResponseAsync(resourceGroupName, monitorName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, context); } /** @@ -185,4 +179,6 @@ public Response getWithResponse(String resourceGroupNa public BillingInfoResponseInner get(String resourceGroupName, String monitorName) { return getWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(BillingInfoesClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ConnectedPartnerResourcesClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ConnectedPartnerResourcesClientImpl.java index cd1658ec4a97..304c688513a5 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ConnectedPartnerResourcesClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ConnectedPartnerResourcesClientImpl.java @@ -26,6 +26,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.ConnectedPartnerResourcesClient; import com.azure.resourcemanager.elastic.fluent.models.ConnectedPartnerResourcesListFormatInner; import com.azure.resourcemanager.elastic.models.ConnectedPartnerResourcesListResponse; @@ -72,6 +73,15 @@ Mono> list(@HostParam("$host") S @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listConnectedPartnerResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -79,6 +89,14 @@ Mono> list(@HostParam("$host") S Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -125,38 +143,16 @@ private Mono> listSingle * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of all active elastic deployments along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of all active elastic deployments as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, - String monitorName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, + String monitorName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -167,13 +163,35 @@ private Mono> listSingle * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of all active elastic deployments as paginated response with {@link PagedFlux}. + * @return list of all active elastic deployments along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String monitorName) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), - nextLink -> listNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -185,13 +203,35 @@ private PagedFlux listAsync(String res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of all active elastic deployments as paginated response with {@link PagedFlux}. + * @return list of all active elastic deployments along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String monitorName, - Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -206,7 +246,8 @@ private PagedFlux listAsync(String res */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String monitorName) { - return new PagedIterable<>(listAsync(resourceGroupName, monitorName)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName), + nextLink -> listNextSinglePage(nextLink)); } /** @@ -223,7 +264,8 @@ public PagedIterable list(String resou @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String monitorName, Context context) { - return new PagedIterable<>(listAsync(resourceGroupName, monitorName, context)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -253,6 +295,33 @@ private Mono> listNextSi .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all active elastic deployments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -261,23 +330,26 @@ private Mono> listNextSi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of all active elastic deployments along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of all active elastic deployments along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(ConnectedPartnerResourcesClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/CreateAndAssociateIpFiltersClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/CreateAndAssociateIpFiltersClientImpl.java index ae42d3a0a325..ca49bdb59485 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/CreateAndAssociateIpFiltersClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/CreateAndAssociateIpFiltersClientImpl.java @@ -20,8 +20,10 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.elastic.fluent.CreateAndAssociateIpFiltersClient; @@ -70,6 +72,16 @@ Mono>> create(@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @QueryParam("ips") String ips, @QueryParam("name") String name, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociateIPFilter") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @QueryParam("ips") String ips, @QueryParam("name") String name, @HeaderParam("Accept") String accept, + Context context); } /** @@ -109,6 +121,44 @@ private Mono>> createWithResponseAsync(String resource .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Create and Associate IP traffic filter for the given deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ips List of ips. + * @param name Name of the traffic filter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String monitorName, String ips, + String name) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, ips, name, accept, Context.NONE); + } + /** * Create and Associate IP traffic filter for the given deployment. * @@ -120,30 +170,32 @@ private Mono>> createWithResponseAsync(String resource * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync(String resourceGroupName, String monitorName, - String ips, String name, Context context) { + private Response createWithResponse(String resourceGroupName, String monitorName, String ips, + String name, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, ips, name, accept, context); + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, ips, name, accept, context); } /** @@ -192,20 +244,16 @@ private PollerFlux, Void> beginCreateAsync(String resourceGroup * @param monitorName Monitor resource name. * @param ips List of ips. * @param name Name of the traffic filter. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginCreateAsync(String resourceGroupName, String monitorName, - String ips, String name, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = createWithResponseAsync(resourceGroupName, monitorName, ips, name, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + public SyncPoller, Void> beginCreate(String resourceGroupName, String monitorName, String ips, + String name) { + Response response = createWithResponse(resourceGroupName, monitorName, ips, name); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -222,7 +270,8 @@ private PollerFlux, Void> beginCreateAsync(String resourceGroup public SyncPoller, Void> beginCreate(String resourceGroupName, String monitorName) { final String ips = null; final String name = null; - return this.beginCreateAsync(resourceGroupName, monitorName, ips, name).getSyncPoller(); + Response response = createWithResponse(resourceGroupName, monitorName, ips, name); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -241,7 +290,8 @@ public SyncPoller, Void> beginCreate(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginCreate(String resourceGroupName, String monitorName, String ips, String name, Context context) { - return this.beginCreateAsync(resourceGroupName, monitorName, ips, name, context).getSyncPoller(); + Response response = createWithResponse(resourceGroupName, monitorName, ips, name, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -280,26 +330,6 @@ private Mono createAsync(String resourceGroupName, String monitorName) { .flatMap(this.client::getLroFinalResultOrError); } - /** - * Create and Associate IP traffic filter for the given deployment. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param ips List of ips. - * @param name Name of the traffic filter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String resourceGroupName, String monitorName, String ips, String name, - Context context) { - return beginCreateAsync(resourceGroupName, monitorName, ips, name, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Create and Associate IP traffic filter for the given deployment. * @@ -313,7 +343,7 @@ private Mono createAsync(String resourceGroupName, String monitorName, Str public void create(String resourceGroupName, String monitorName) { final String ips = null; final String name = null; - createAsync(resourceGroupName, monitorName, ips, name).block(); + beginCreate(resourceGroupName, monitorName, ips, name).getFinalResult(); } /** @@ -330,6 +360,8 @@ public void create(String resourceGroupName, String monitorName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void create(String resourceGroupName, String monitorName, String ips, String name, Context context) { - createAsync(resourceGroupName, monitorName, ips, name, context).block(); + beginCreate(resourceGroupName, monitorName, ips, name, context).getFinalResult(); } + + private static final ClientLogger LOGGER = new ClientLogger(CreateAndAssociateIpFiltersClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/CreateAndAssociatePLFiltersClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/CreateAndAssociatePLFiltersClientImpl.java index 550609d0f0ff..564cb9f30941 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/CreateAndAssociatePLFiltersClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/CreateAndAssociatePLFiltersClientImpl.java @@ -20,8 +20,10 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.elastic.fluent.CreateAndAssociatePLFiltersClient; @@ -71,6 +73,17 @@ Mono>> create(@HostParam("$host") String endpoint, @QueryParam("name") String name, @QueryParam("privateEndpointGuid") String privateEndpointGuid, @QueryParam("privateEndpointName") String privateEndpointName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createAndAssociatePLFilter") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @QueryParam("name") String name, @QueryParam("privateEndpointGuid") String privateEndpointGuid, + @QueryParam("privateEndpointName") String privateEndpointName, @HeaderParam("Accept") String accept, + Context context); } /** @@ -112,6 +125,46 @@ private Mono>> createWithResponseAsync(String resource .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Create and Associate private link traffic filter for the given deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param name Name of the traffic filter. + * @param privateEndpointGuid Guid of the private endpoint. + * @param privateEndpointName Name of the private endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String monitorName, String name, + String privateEndpointGuid, String privateEndpointName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, name, privateEndpointGuid, + privateEndpointName, accept, Context.NONE); + } + /** * Create and Associate private link traffic filter for the given deployment. * @@ -124,30 +177,33 @@ private Mono>> createWithResponseAsync(String resource * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync(String resourceGroupName, String monitorName, - String name, String privateEndpointGuid, String privateEndpointName, Context context) { + private Response createWithResponse(String resourceGroupName, String monitorName, String name, + String privateEndpointGuid, String privateEndpointName, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName, accept, context); + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, name, privateEndpointGuid, + privateEndpointName, accept, context); } /** @@ -201,20 +257,17 @@ private PollerFlux, Void> beginCreateAsync(String resourceGroup * @param name Name of the traffic filter. * @param privateEndpointGuid Guid of the private endpoint. * @param privateEndpointName Name of the private endpoint. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginCreateAsync(String resourceGroupName, String monitorName, - String name, String privateEndpointGuid, String privateEndpointName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = createWithResponseAsync(resourceGroupName, monitorName, name, - privateEndpointGuid, privateEndpointName, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + public SyncPoller, Void> beginCreate(String resourceGroupName, String monitorName, String name, + String privateEndpointGuid, String privateEndpointName) { + Response response + = createWithResponse(resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -232,8 +285,9 @@ public SyncPoller, Void> beginCreate(String resourceGroupName, final String name = null; final String privateEndpointGuid = null; final String privateEndpointName = null; - return this.beginCreateAsync(resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName) - .getSyncPoller(); + Response response + = createWithResponse(resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -253,9 +307,9 @@ public SyncPoller, Void> beginCreate(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginCreate(String resourceGroupName, String monitorName, String name, String privateEndpointGuid, String privateEndpointName, Context context) { - return this - .beginCreateAsync(resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName, context) - .getSyncPoller(); + Response response = createWithResponse(resourceGroupName, monitorName, name, privateEndpointGuid, + privateEndpointName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -297,28 +351,6 @@ private Mono createAsync(String resourceGroupName, String monitorName) { .flatMap(this.client::getLroFinalResultOrError); } - /** - * Create and Associate private link traffic filter for the given deployment. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param name Name of the traffic filter. - * @param privateEndpointGuid Guid of the private endpoint. - * @param privateEndpointName Name of the private endpoint. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String resourceGroupName, String monitorName, String name, - String privateEndpointGuid, String privateEndpointName, Context context) { - return beginCreateAsync(resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Create and Associate private link traffic filter for the given deployment. * @@ -333,7 +365,7 @@ public void create(String resourceGroupName, String monitorName) { final String name = null; final String privateEndpointGuid = null; final String privateEndpointName = null; - createAsync(resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName).block(); + beginCreate(resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName).getFinalResult(); } /** @@ -352,6 +384,9 @@ public void create(String resourceGroupName, String monitorName) { @ServiceMethod(returns = ReturnType.SINGLE) public void create(String resourceGroupName, String monitorName, String name, String privateEndpointGuid, String privateEndpointName, Context context) { - createAsync(resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName, context).block(); + beginCreate(resourceGroupName, monitorName, name, privateEndpointGuid, privateEndpointName, context) + .getFinalResult(); } + + private static final ClientLogger LOGGER = new ClientLogger(CreateAndAssociatePLFiltersClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoResponseImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoResponseImpl.java index 281b1cec7ebf..dc57bda481f3 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoResponseImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoResponseImpl.java @@ -48,6 +48,14 @@ public MarketplaceSaaSInfo marketplaceSaasInfo() { return this.innerModel().marketplaceSaasInfo(); } + public String projectType() { + return this.innerModel().projectType(); + } + + public String configurationType() { + return this.innerModel().configurationType(); + } + public DeploymentInfoResponseInner innerModel() { return this.innerObject; } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoesClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoesClientImpl.java index 5d0c5c35034b..5597ce7e6b04 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoesClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoesClientImpl.java @@ -21,6 +21,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.DeploymentInfoesClient; import com.azure.resourcemanager.elastic.fluent.models.DeploymentInfoResponseInner; import reactor.core.publisher.Mono; @@ -65,6 +66,15 @@ Mono> list(@HostParam("$host") String endp @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listDeploymentInfo") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); } /** @@ -103,42 +113,6 @@ private Mono> listWithResponseAsync(String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of deployment in Elastic cloud corresponding to the Elastic monitor resource along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(String resourceGroupName, - String monitorName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context); - } - /** * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. * @@ -170,7 +144,27 @@ private Mono listAsync(String resourceGroupName, St @ServiceMethod(returns = ReturnType.SINGLE) public Response listWithResponse(String resourceGroupName, String monitorName, Context context) { - return listWithResponseAsync(resourceGroupName, monitorName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, context); } /** @@ -187,4 +181,6 @@ public Response listWithResponse(String resourceGro public DeploymentInfoResponseInner list(String resourceGroupName, String monitorName) { return listWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(DeploymentInfoesClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DetachAndDeleteTrafficFiltersClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DetachAndDeleteTrafficFiltersClientImpl.java index c33df54af0af..dbb1b028cf07 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DetachAndDeleteTrafficFiltersClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DetachAndDeleteTrafficFiltersClientImpl.java @@ -21,6 +21,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.DetachAndDeleteTrafficFiltersClient; import reactor.core.publisher.Mono; @@ -64,6 +65,15 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @QueryParam("rulesetId") String rulesetId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachAndDeleteTrafficFilter") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @QueryParam("rulesetId") String rulesetId, @HeaderParam("Accept") String accept, Context context); } /** @@ -102,42 +112,6 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Detach and Delete traffic filter from the given deployment. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param rulesetId Ruleset Id of the filter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String monitorName, String rulesetId, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, rulesetId, accept, context); - } - /** * Detach and Delete traffic filter from the given deployment. * @@ -169,7 +143,27 @@ private Mono deleteAsync(String resourceGroupName, String monitorName) { @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceGroupName, String monitorName, String rulesetId, Context context) { - return deleteWithResponseAsync(resourceGroupName, monitorName, rulesetId, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, rulesetId, accept, context); } /** @@ -186,4 +180,6 @@ public void delete(String resourceGroupName, String monitorName) { final String rulesetId = null; deleteWithResponse(resourceGroupName, monitorName, rulesetId, Context.NONE); } + + private static final ClientLogger LOGGER = new ClientLogger(DetachAndDeleteTrafficFiltersClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DetachTrafficFiltersClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DetachTrafficFiltersClientImpl.java index c0f51295a402..441929ebd1a9 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DetachTrafficFiltersClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DetachTrafficFiltersClientImpl.java @@ -20,8 +20,10 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.elastic.fluent.DetachTrafficFiltersClient; @@ -69,6 +71,15 @@ Mono>> update(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @QueryParam("rulesetId") String rulesetId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/detachTrafficFilter") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @QueryParam("rulesetId") String rulesetId, @HeaderParam("Accept") String accept, Context context); } /** @@ -107,6 +118,42 @@ private Mono>> updateWithResponseAsync(String resource .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Detach traffic filter for the given deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param rulesetId Ruleset Id of the filter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String monitorName, String rulesetId) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, rulesetId, accept, Context.NONE); + } + /** * Detach traffic filter for the given deployment. * @@ -117,30 +164,32 @@ private Mono>> updateWithResponseAsync(String resource * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync(String resourceGroupName, String monitorName, - String rulesetId, Context context) { + private Response updateWithResponse(String resourceGroupName, String monitorName, String rulesetId, + Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, rulesetId, accept, context); + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, rulesetId, accept, context); } /** @@ -186,20 +235,16 @@ private PollerFlux, Void> beginUpdateAsync(String resourceGroup * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param rulesetId Ruleset Id of the filter. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginUpdateAsync(String resourceGroupName, String monitorName, - String rulesetId, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = updateWithResponseAsync(resourceGroupName, monitorName, rulesetId, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + public SyncPoller, Void> beginUpdate(String resourceGroupName, String monitorName, + String rulesetId) { + Response response = updateWithResponse(resourceGroupName, monitorName, rulesetId); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -215,7 +260,8 @@ private PollerFlux, Void> beginUpdateAsync(String resourceGroup @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginUpdate(String resourceGroupName, String monitorName) { final String rulesetId = null; - return this.beginUpdateAsync(resourceGroupName, monitorName, rulesetId).getSyncPoller(); + Response response = updateWithResponse(resourceGroupName, monitorName, rulesetId); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -233,7 +279,8 @@ public SyncPoller, Void> beginUpdate(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginUpdate(String resourceGroupName, String monitorName, String rulesetId, Context context) { - return this.beginUpdateAsync(resourceGroupName, monitorName, rulesetId, context).getSyncPoller(); + Response response = updateWithResponse(resourceGroupName, monitorName, rulesetId, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -270,24 +317,6 @@ private Mono updateAsync(String resourceGroupName, String monitorName) { .flatMap(this.client::getLroFinalResultOrError); } - /** - * Detach traffic filter for the given deployment. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param rulesetId Ruleset Id of the filter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String monitorName, String rulesetId, Context context) { - return beginUpdateAsync(resourceGroupName, monitorName, rulesetId, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Detach traffic filter for the given deployment. * @@ -300,7 +329,7 @@ private Mono updateAsync(String resourceGroupName, String monitorName, Str @ServiceMethod(returns = ReturnType.SINGLE) public void update(String resourceGroupName, String monitorName) { final String rulesetId = null; - updateAsync(resourceGroupName, monitorName, rulesetId).block(); + beginUpdate(resourceGroupName, monitorName, rulesetId).getFinalResult(); } /** @@ -316,6 +345,8 @@ public void update(String resourceGroupName, String monitorName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void update(String resourceGroupName, String monitorName, String rulesetId, Context context) { - updateAsync(resourceGroupName, monitorName, rulesetId, context).block(); + beginUpdate(resourceGroupName, monitorName, rulesetId, context).getFinalResult(); } + + private static final ClientLogger LOGGER = new ClientLogger(DetachTrafficFiltersClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticManagementClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticManagementClientImpl.java index edff50f7099b..2e22aba9e2f6 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticManagementClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticManagementClientImpl.java @@ -15,12 +15,15 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.elastic.fluent.AllTrafficFiltersClient; @@ -38,6 +41,7 @@ import com.azure.resourcemanager.elastic.fluent.ListAssociatedTrafficFiltersClient; import com.azure.resourcemanager.elastic.fluent.MonitorOperationsClient; import com.azure.resourcemanager.elastic.fluent.MonitoredResourcesClient; +import com.azure.resourcemanager.elastic.fluent.MonitoredSubscriptionsClient; import com.azure.resourcemanager.elastic.fluent.MonitorsClient; import com.azure.resourcemanager.elastic.fluent.OpenAIsClient; import com.azure.resourcemanager.elastic.fluent.OperationsClient; @@ -160,6 +164,34 @@ public OperationsClient getOperations() { return this.operations; } + /** + * The ElasticVersionsClient object to access its operations. + */ + private final ElasticVersionsClient elasticVersions; + + /** + * Gets the ElasticVersionsClient object to access its operations. + * + * @return the ElasticVersionsClient object. + */ + public ElasticVersionsClient getElasticVersions() { + return this.elasticVersions; + } + + /** + * The OrganizationsClient object to access its operations. + */ + private final OrganizationsClient organizations; + + /** + * Gets the OrganizationsClient object to access its operations. + * + * @return the OrganizationsClient object. + */ + public OrganizationsClient getOrganizations() { + return this.organizations; + } + /** * The MonitorsClient object to access its operations. */ @@ -175,45 +207,45 @@ public MonitorsClient getMonitors() { } /** - * The ElasticVersionsClient object to access its operations. + * The AssociateTrafficFiltersClient object to access its operations. */ - private final ElasticVersionsClient elasticVersions; + private final AssociateTrafficFiltersClient associateTrafficFilters; /** - * Gets the ElasticVersionsClient object to access its operations. + * Gets the AssociateTrafficFiltersClient object to access its operations. * - * @return the ElasticVersionsClient object. + * @return the AssociateTrafficFiltersClient object. */ - public ElasticVersionsClient getElasticVersions() { - return this.elasticVersions; + public AssociateTrafficFiltersClient getAssociateTrafficFilters() { + return this.associateTrafficFilters; } /** - * The MonitoredResourcesClient object to access its operations. + * The CreateAndAssociateIpFiltersClient object to access its operations. */ - private final MonitoredResourcesClient monitoredResources; + private final CreateAndAssociateIpFiltersClient createAndAssociateIpFilters; /** - * Gets the MonitoredResourcesClient object to access its operations. + * Gets the CreateAndAssociateIpFiltersClient object to access its operations. * - * @return the MonitoredResourcesClient object. + * @return the CreateAndAssociateIpFiltersClient object. */ - public MonitoredResourcesClient getMonitoredResources() { - return this.monitoredResources; + public CreateAndAssociateIpFiltersClient getCreateAndAssociateIpFilters() { + return this.createAndAssociateIpFilters; } /** - * The DeploymentInfoesClient object to access its operations. + * The CreateAndAssociatePLFiltersClient object to access its operations. */ - private final DeploymentInfoesClient deploymentInfoes; + private final CreateAndAssociatePLFiltersClient createAndAssociatePLFilters; /** - * Gets the DeploymentInfoesClient object to access its operations. + * Gets the CreateAndAssociatePLFiltersClient object to access its operations. * - * @return the DeploymentInfoesClient object. + * @return the CreateAndAssociatePLFiltersClient object. */ - public DeploymentInfoesClient getDeploymentInfoes() { - return this.deploymentInfoes; + public CreateAndAssociatePLFiltersClient getCreateAndAssociatePLFilters() { + return this.createAndAssociatePLFilters; } /** @@ -231,255 +263,241 @@ public ExternalUsersClient getExternalUsers() { } /** - * The BillingInfoesClient object to access its operations. - */ - private final BillingInfoesClient billingInfoes; - - /** - * Gets the BillingInfoesClient object to access its operations. - * - * @return the BillingInfoesClient object. - */ - public BillingInfoesClient getBillingInfoes() { - return this.billingInfoes; - } - - /** - * The ConnectedPartnerResourcesClient object to access its operations. + * The TrafficFiltersClient object to access its operations. */ - private final ConnectedPartnerResourcesClient connectedPartnerResources; + private final TrafficFiltersClient trafficFilters; /** - * Gets the ConnectedPartnerResourcesClient object to access its operations. + * Gets the TrafficFiltersClient object to access its operations. * - * @return the ConnectedPartnerResourcesClient object. + * @return the TrafficFiltersClient object. */ - public ConnectedPartnerResourcesClient getConnectedPartnerResources() { - return this.connectedPartnerResources; + public TrafficFiltersClient getTrafficFilters() { + return this.trafficFilters; } /** - * The OpenAIsClient object to access its operations. + * The DetachAndDeleteTrafficFiltersClient object to access its operations. */ - private final OpenAIsClient openAIs; + private final DetachAndDeleteTrafficFiltersClient detachAndDeleteTrafficFilters; /** - * Gets the OpenAIsClient object to access its operations. + * Gets the DetachAndDeleteTrafficFiltersClient object to access its operations. * - * @return the OpenAIsClient object. + * @return the DetachAndDeleteTrafficFiltersClient object. */ - public OpenAIsClient getOpenAIs() { - return this.openAIs; + public DetachAndDeleteTrafficFiltersClient getDetachAndDeleteTrafficFilters() { + return this.detachAndDeleteTrafficFilters; } /** - * The TagRulesClient object to access its operations. + * The DetachTrafficFiltersClient object to access its operations. */ - private final TagRulesClient tagRules; + private final DetachTrafficFiltersClient detachTrafficFilters; /** - * Gets the TagRulesClient object to access its operations. + * Gets the DetachTrafficFiltersClient object to access its operations. * - * @return the TagRulesClient object. + * @return the DetachTrafficFiltersClient object. */ - public TagRulesClient getTagRules() { - return this.tagRules; + public DetachTrafficFiltersClient getDetachTrafficFilters() { + return this.detachTrafficFilters; } /** - * The VMHostsClient object to access its operations. + * The BillingInfoesClient object to access its operations. */ - private final VMHostsClient vMHosts; + private final BillingInfoesClient billingInfoes; /** - * Gets the VMHostsClient object to access its operations. + * Gets the BillingInfoesClient object to access its operations. * - * @return the VMHostsClient object. + * @return the BillingInfoesClient object. */ - public VMHostsClient getVMHosts() { - return this.vMHosts; + public BillingInfoesClient getBillingInfoes() { + return this.billingInfoes; } /** - * The VMIngestionsClient object to access its operations. + * The AllTrafficFiltersClient object to access its operations. */ - private final VMIngestionsClient vMIngestions; + private final AllTrafficFiltersClient allTrafficFilters; /** - * Gets the VMIngestionsClient object to access its operations. + * Gets the AllTrafficFiltersClient object to access its operations. * - * @return the VMIngestionsClient object. + * @return the AllTrafficFiltersClient object. */ - public VMIngestionsClient getVMIngestions() { - return this.vMIngestions; + public AllTrafficFiltersClient getAllTrafficFilters() { + return this.allTrafficFilters; } /** - * The VMCollectionsClient object to access its operations. + * The ListAssociatedTrafficFiltersClient object to access its operations. */ - private final VMCollectionsClient vMCollections; + private final ListAssociatedTrafficFiltersClient listAssociatedTrafficFilters; /** - * Gets the VMCollectionsClient object to access its operations. + * Gets the ListAssociatedTrafficFiltersClient object to access its operations. * - * @return the VMCollectionsClient object. + * @return the ListAssociatedTrafficFiltersClient object. */ - public VMCollectionsClient getVMCollections() { - return this.vMCollections; + public ListAssociatedTrafficFiltersClient getListAssociatedTrafficFilters() { + return this.listAssociatedTrafficFilters; } /** - * The UpgradableVersionsClient object to access its operations. + * The ConnectedPartnerResourcesClient object to access its operations. */ - private final UpgradableVersionsClient upgradableVersions; + private final ConnectedPartnerResourcesClient connectedPartnerResources; /** - * Gets the UpgradableVersionsClient object to access its operations. + * Gets the ConnectedPartnerResourcesClient object to access its operations. * - * @return the UpgradableVersionsClient object. + * @return the ConnectedPartnerResourcesClient object. */ - public UpgradableVersionsClient getUpgradableVersions() { - return this.upgradableVersions; + public ConnectedPartnerResourcesClient getConnectedPartnerResources() { + return this.connectedPartnerResources; } /** - * The MonitorOperationsClient object to access its operations. + * The DeploymentInfoesClient object to access its operations. */ - private final MonitorOperationsClient monitorOperations; + private final DeploymentInfoesClient deploymentInfoes; /** - * Gets the MonitorOperationsClient object to access its operations. + * Gets the DeploymentInfoesClient object to access its operations. * - * @return the MonitorOperationsClient object. + * @return the DeploymentInfoesClient object. */ - public MonitorOperationsClient getMonitorOperations() { - return this.monitorOperations; + public DeploymentInfoesClient getDeploymentInfoes() { + return this.deploymentInfoes; } /** - * The AllTrafficFiltersClient object to access its operations. + * The MonitoredResourcesClient object to access its operations. */ - private final AllTrafficFiltersClient allTrafficFilters; + private final MonitoredResourcesClient monitoredResources; /** - * Gets the AllTrafficFiltersClient object to access its operations. + * Gets the MonitoredResourcesClient object to access its operations. * - * @return the AllTrafficFiltersClient object. + * @return the MonitoredResourcesClient object. */ - public AllTrafficFiltersClient getAllTrafficFilters() { - return this.allTrafficFilters; + public MonitoredResourcesClient getMonitoredResources() { + return this.monitoredResources; } /** - * The ListAssociatedTrafficFiltersClient object to access its operations. + * The UpgradableVersionsClient object to access its operations. */ - private final ListAssociatedTrafficFiltersClient listAssociatedTrafficFilters; + private final UpgradableVersionsClient upgradableVersions; /** - * Gets the ListAssociatedTrafficFiltersClient object to access its operations. + * Gets the UpgradableVersionsClient object to access its operations. * - * @return the ListAssociatedTrafficFiltersClient object. + * @return the UpgradableVersionsClient object. */ - public ListAssociatedTrafficFiltersClient getListAssociatedTrafficFilters() { - return this.listAssociatedTrafficFilters; + public UpgradableVersionsClient getUpgradableVersions() { + return this.upgradableVersions; } /** - * The CreateAndAssociateIpFiltersClient object to access its operations. + * The VMHostsClient object to access its operations. */ - private final CreateAndAssociateIpFiltersClient createAndAssociateIpFilters; + private final VMHostsClient vMHosts; /** - * Gets the CreateAndAssociateIpFiltersClient object to access its operations. + * Gets the VMHostsClient object to access its operations. * - * @return the CreateAndAssociateIpFiltersClient object. + * @return the VMHostsClient object. */ - public CreateAndAssociateIpFiltersClient getCreateAndAssociateIpFilters() { - return this.createAndAssociateIpFilters; + public VMHostsClient getVMHosts() { + return this.vMHosts; } /** - * The CreateAndAssociatePLFiltersClient object to access its operations. + * The MonitoredSubscriptionsClient object to access its operations. */ - private final CreateAndAssociatePLFiltersClient createAndAssociatePLFilters; + private final MonitoredSubscriptionsClient monitoredSubscriptions; /** - * Gets the CreateAndAssociatePLFiltersClient object to access its operations. + * Gets the MonitoredSubscriptionsClient object to access its operations. * - * @return the CreateAndAssociatePLFiltersClient object. + * @return the MonitoredSubscriptionsClient object. */ - public CreateAndAssociatePLFiltersClient getCreateAndAssociatePLFilters() { - return this.createAndAssociatePLFilters; + public MonitoredSubscriptionsClient getMonitoredSubscriptions() { + return this.monitoredSubscriptions; } /** - * The AssociateTrafficFiltersClient object to access its operations. + * The OpenAIsClient object to access its operations. */ - private final AssociateTrafficFiltersClient associateTrafficFilters; + private final OpenAIsClient openAIs; /** - * Gets the AssociateTrafficFiltersClient object to access its operations. + * Gets the OpenAIsClient object to access its operations. * - * @return the AssociateTrafficFiltersClient object. + * @return the OpenAIsClient object. */ - public AssociateTrafficFiltersClient getAssociateTrafficFilters() { - return this.associateTrafficFilters; + public OpenAIsClient getOpenAIs() { + return this.openAIs; } /** - * The DetachAndDeleteTrafficFiltersClient object to access its operations. + * The TagRulesClient object to access its operations. */ - private final DetachAndDeleteTrafficFiltersClient detachAndDeleteTrafficFilters; + private final TagRulesClient tagRules; /** - * Gets the DetachAndDeleteTrafficFiltersClient object to access its operations. + * Gets the TagRulesClient object to access its operations. * - * @return the DetachAndDeleteTrafficFiltersClient object. + * @return the TagRulesClient object. */ - public DetachAndDeleteTrafficFiltersClient getDetachAndDeleteTrafficFilters() { - return this.detachAndDeleteTrafficFilters; + public TagRulesClient getTagRules() { + return this.tagRules; } /** - * The DetachTrafficFiltersClient object to access its operations. + * The MonitorOperationsClient object to access its operations. */ - private final DetachTrafficFiltersClient detachTrafficFilters; + private final MonitorOperationsClient monitorOperations; /** - * Gets the DetachTrafficFiltersClient object to access its operations. + * Gets the MonitorOperationsClient object to access its operations. * - * @return the DetachTrafficFiltersClient object. + * @return the MonitorOperationsClient object. */ - public DetachTrafficFiltersClient getDetachTrafficFilters() { - return this.detachTrafficFilters; + public MonitorOperationsClient getMonitorOperations() { + return this.monitorOperations; } /** - * The TrafficFiltersClient object to access its operations. + * The VMCollectionsClient object to access its operations. */ - private final TrafficFiltersClient trafficFilters; + private final VMCollectionsClient vMCollections; /** - * Gets the TrafficFiltersClient object to access its operations. + * Gets the VMCollectionsClient object to access its operations. * - * @return the TrafficFiltersClient object. + * @return the VMCollectionsClient object. */ - public TrafficFiltersClient getTrafficFilters() { - return this.trafficFilters; + public VMCollectionsClient getVMCollections() { + return this.vMCollections; } /** - * The OrganizationsClient object to access its operations. + * The VMIngestionsClient object to access its operations. */ - private final OrganizationsClient organizations; + private final VMIngestionsClient vMIngestions; /** - * Gets the OrganizationsClient object to access its operations. + * Gets the VMIngestionsClient object to access its operations. * - * @return the OrganizationsClient object. + * @return the VMIngestionsClient object. */ - public OrganizationsClient getOrganizations() { - return this.organizations; + public VMIngestionsClient getVMIngestions() { + return this.vMIngestions; } /** @@ -499,31 +517,32 @@ public OrganizationsClient getOrganizations() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2024-03-01"; + this.apiVersion = "2025-01-15-preview"; this.operations = new OperationsClientImpl(this); - this.monitors = new MonitorsClientImpl(this); this.elasticVersions = new ElasticVersionsClientImpl(this); - this.monitoredResources = new MonitoredResourcesClientImpl(this); - this.deploymentInfoes = new DeploymentInfoesClientImpl(this); + this.organizations = new OrganizationsClientImpl(this); + this.monitors = new MonitorsClientImpl(this); + this.associateTrafficFilters = new AssociateTrafficFiltersClientImpl(this); + this.createAndAssociateIpFilters = new CreateAndAssociateIpFiltersClientImpl(this); + this.createAndAssociatePLFilters = new CreateAndAssociatePLFiltersClientImpl(this); this.externalUsers = new ExternalUsersClientImpl(this); + this.trafficFilters = new TrafficFiltersClientImpl(this); + this.detachAndDeleteTrafficFilters = new DetachAndDeleteTrafficFiltersClientImpl(this); + this.detachTrafficFilters = new DetachTrafficFiltersClientImpl(this); this.billingInfoes = new BillingInfoesClientImpl(this); + this.allTrafficFilters = new AllTrafficFiltersClientImpl(this); + this.listAssociatedTrafficFilters = new ListAssociatedTrafficFiltersClientImpl(this); this.connectedPartnerResources = new ConnectedPartnerResourcesClientImpl(this); + this.deploymentInfoes = new DeploymentInfoesClientImpl(this); + this.monitoredResources = new MonitoredResourcesClientImpl(this); + this.upgradableVersions = new UpgradableVersionsClientImpl(this); + this.vMHosts = new VMHostsClientImpl(this); + this.monitoredSubscriptions = new MonitoredSubscriptionsClientImpl(this); this.openAIs = new OpenAIsClientImpl(this); this.tagRules = new TagRulesClientImpl(this); - this.vMHosts = new VMHostsClientImpl(this); - this.vMIngestions = new VMIngestionsClientImpl(this); - this.vMCollections = new VMCollectionsClientImpl(this); - this.upgradableVersions = new UpgradableVersionsClientImpl(this); this.monitorOperations = new MonitorOperationsClientImpl(this); - this.allTrafficFilters = new AllTrafficFiltersClientImpl(this); - this.listAssociatedTrafficFilters = new ListAssociatedTrafficFiltersClientImpl(this); - this.createAndAssociateIpFilters = new CreateAndAssociateIpFiltersClientImpl(this); - this.createAndAssociatePLFilters = new CreateAndAssociatePLFiltersClientImpl(this); - this.associateTrafficFilters = new AssociateTrafficFiltersClientImpl(this); - this.detachAndDeleteTrafficFilters = new DetachAndDeleteTrafficFiltersClientImpl(this); - this.detachTrafficFilters = new DetachTrafficFiltersClientImpl(this); - this.trafficFilters = new TrafficFiltersClientImpl(this); - this.organizations = new OrganizationsClientImpl(this); + this.vMCollections = new VMCollectionsClientImpl(this); + this.vMIngestions = new VMIngestionsClientImpl(this); } /** @@ -563,6 +582,23 @@ public PollerFlux, U> getLroResult(Mono type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + /** * Gets the final result, or an error, based on last async poll response. * diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticMonitorResourceImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticMonitorResourceImpl.java index ebe8026022e0..e3d5a2ab4eb6 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticMonitorResourceImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticMonitorResourceImpl.java @@ -47,14 +47,18 @@ public Map tags() { } } - public ResourceSku sku() { - return this.innerModel().sku(); - } - public MonitorProperties properties() { return this.innerModel().properties(); } + public String kind() { + return this.innerModel().kind(); + } + + public ResourceSku sku() { + return this.innerModel().sku(); + } + public IdentityProperties identity() { return this.innerModel().identity(); } @@ -122,16 +126,13 @@ public ElasticMonitorResourceImpl update() { public ElasticMonitorResource apply() { this.innerObject = serviceManager.serviceClient() .getMonitors() - .updateWithResponse(resourceGroupName, monitorName, updateBody, Context.NONE) - .getValue(); + .update(resourceGroupName, monitorName, updateBody, Context.NONE); return this; } public ElasticMonitorResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getMonitors() - .updateWithResponse(resourceGroupName, monitorName, updateBody, context) - .getValue(); + this.innerObject + = serviceManager.serviceClient().getMonitors().update(resourceGroupName, monitorName, updateBody, context); return this; } @@ -179,13 +180,18 @@ public ElasticMonitorResourceImpl withTags(Map tags) { } } - public ElasticMonitorResourceImpl withSku(ResourceSku sku) { - this.innerModel().withSku(sku); + public ElasticMonitorResourceImpl withProperties(MonitorProperties properties) { + this.innerModel().withProperties(properties); return this; } - public ElasticMonitorResourceImpl withProperties(MonitorProperties properties) { - this.innerModel().withProperties(properties); + public ElasticMonitorResourceImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public ElasticMonitorResourceImpl withSku(ResourceSku sku) { + this.innerModel().withSku(sku); return this; } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsClientImpl.java index 387804eee20a..3784fb47f225 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsClientImpl.java @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.ElasticVersionsClient; import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner; import com.azure.resourcemanager.elastic.models.ElasticVersionsListResponse; @@ -70,6 +71,14 @@ Mono> list(@HostParam("$host") String endp @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @QueryParam("region") String region, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/elasticVersions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("region") String region, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -77,6 +86,14 @@ Mono> list(@HostParam("$host") String endp Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -115,33 +132,14 @@ private Mono> listSinglePageAsync(S * Get a list of available versions for a region. * * @param region Region where elastic deployment will take place. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a list of available versions for a region as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String region, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (region == null) { - return Mono.error(new IllegalArgumentException("Parameter region is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), region, - accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String region) { + return new PagedFlux<>(() -> listSinglePageAsync(region), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -151,11 +149,29 @@ private Mono> listSinglePageAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region as paginated response with {@link PagedFlux}. + * @return a list of available versions for a region along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String region) { - return new PagedFlux<>(() -> listSinglePageAsync(region), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String region) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (region == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), region, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -166,12 +182,29 @@ private PagedFlux listAsync(String region) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region as paginated response with {@link PagedFlux}. + * @return a list of available versions for a region along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String region, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(region, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String region, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (region == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter region is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), region, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -185,7 +218,7 @@ private PagedFlux listAsync(String region, Contex */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String region) { - return new PagedIterable<>(listAsync(region)); + return new PagedIterable<>(() -> listSinglePage(region), nextLink -> listNextSinglePage(nextLink)); } /** @@ -200,7 +233,8 @@ public PagedIterable list(String region) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String region, Context context) { - return new PagedIterable<>(listAsync(region, context)); + return new PagedIterable<>(() -> listSinglePage(region, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -229,6 +263,33 @@ private Mono> listNextSinglePageAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of elastic versions available in a region along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -237,23 +298,25 @@ private Mono> listNextSinglePageAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of elastic versions available in a region along with {@link PagedResponse} on successful completion - * of {@link Mono}. + * @return list of elastic versions available in a region along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(ElasticVersionsClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ExternalUsersClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ExternalUsersClientImpl.java index 1d36f9a11717..a484f8214655 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ExternalUsersClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ExternalUsersClientImpl.java @@ -22,6 +22,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.ExternalUsersClient; import com.azure.resourcemanager.elastic.fluent.models.ExternalUserCreationResponseInner; import com.azure.resourcemanager.elastic.models.ExternalUserInfo; @@ -68,6 +69,16 @@ Mono> createOrUpdate(@HostParam("$ho @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @BodyParam("application/json") ExternalUserInfo body, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/createOrUpdateExternalUser") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @BodyParam("application/json") ExternalUserInfo body, @HeaderParam("Accept") String accept, + Context context); } /** @@ -111,47 +122,6 @@ private Mono> createOrUpdateWithResp .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Create User inside elastic deployment which are used by customers to perform operations on the elastic - * deployment. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param body Elastic External User Creation Parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of the response we got from elastic while creating external user along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String monitorName, ExternalUserInfo body, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - if (body != null) { - body.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, context); - } - /** * Create User inside elastic deployment which are used by customers to perform operations on the elastic * deployment. @@ -188,7 +158,30 @@ private Mono createOrUpdateAsync(String resou @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String resourceGroupName, String monitorName, ExternalUserInfo body, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, body, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, context); } /** @@ -207,4 +200,6 @@ public ExternalUserCreationResponseInner createOrUpdate(String resourceGroupName final ExternalUserInfo body = null; return createOrUpdateWithResponse(resourceGroupName, monitorName, body, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(ExternalUsersClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ListAssociatedTrafficFiltersClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ListAssociatedTrafficFiltersClientImpl.java index 1b9c4a97ca2b..ecd643c04b8b 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ListAssociatedTrafficFiltersClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ListAssociatedTrafficFiltersClientImpl.java @@ -21,6 +21,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.ListAssociatedTrafficFiltersClient; import com.azure.resourcemanager.elastic.fluent.models.ElasticTrafficFilterResponseInner; import reactor.core.publisher.Mono; @@ -65,6 +66,15 @@ Mono> list(@HostParam("$host") Strin @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listAssociatedTrafficFilters") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); } /** @@ -103,42 +113,6 @@ private Mono> listWithResponseAsync( .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get the list of all associated traffic filters for the given deployment. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of all associated traffic filters for the given deployment along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(String resourceGroupName, - String monitorName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context); - } - /** * Get the list of all associated traffic filters for the given deployment. * @@ -169,7 +143,27 @@ private Mono listAsync(String resourceGroupNa @ServiceMethod(returns = ReturnType.SINGLE) public Response listWithResponse(String resourceGroupName, String monitorName, Context context) { - return listWithResponseAsync(resourceGroupName, monitorName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, context); } /** @@ -186,4 +180,6 @@ public Response listWithResponse(String resou public ElasticTrafficFilterResponseInner list(String resourceGroupName, String monitorName) { return listWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(ListAssociatedTrafficFiltersClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorOperationsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorOperationsClientImpl.java index 4644299b4524..c3469156d879 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorOperationsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorOperationsClientImpl.java @@ -21,8 +21,10 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.elastic.fluent.MonitorOperationsClient; @@ -72,6 +74,16 @@ Mono>> upgrade(@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @BodyParam("application/json") ElasticMonitorUpgrade body, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/upgrade") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response upgradeSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @BodyParam("application/json") ElasticMonitorUpgrade body, @HeaderParam("Accept") String accept, + Context context); } /** @@ -113,6 +125,46 @@ private Mono>> upgradeWithResponseAsync(String resourc .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Upgradable version for a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Elastic Monitor Upgrade Parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response upgradeWithResponse(String resourceGroupName, String monitorName, + ElasticMonitorUpgrade body) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return service.upgradeSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, Context.NONE); + } + /** * Upgradable version for a monitor resource. * @@ -123,33 +175,35 @@ private Mono>> upgradeWithResponseAsync(String resourc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> upgradeWithResponseAsync(String resourceGroupName, String monitorName, + private Response upgradeWithResponse(String resourceGroupName, String monitorName, ElasticMonitorUpgrade body, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } if (body != null) { body.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.upgrade(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, body, accept, context); + return service.upgradeSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, context); } /** @@ -195,19 +249,16 @@ private PollerFlux, Void> beginUpgradeAsync(String resourceGrou * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param body Elastic Monitor Upgrade Parameters. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginUpgradeAsync(String resourceGroupName, String monitorName, - ElasticMonitorUpgrade body, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = upgradeWithResponseAsync(resourceGroupName, monitorName, body, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + public SyncPoller, Void> beginUpgrade(String resourceGroupName, String monitorName, + ElasticMonitorUpgrade body) { + Response response = upgradeWithResponse(resourceGroupName, monitorName, body); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -223,7 +274,8 @@ private PollerFlux, Void> beginUpgradeAsync(String resourceGrou @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginUpgrade(String resourceGroupName, String monitorName) { final ElasticMonitorUpgrade body = null; - return this.beginUpgradeAsync(resourceGroupName, monitorName, body).getSyncPoller(); + Response response = upgradeWithResponse(resourceGroupName, monitorName, body); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -241,7 +293,8 @@ public SyncPoller, Void> beginUpgrade(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginUpgrade(String resourceGroupName, String monitorName, ElasticMonitorUpgrade body, Context context) { - return this.beginUpgradeAsync(resourceGroupName, monitorName, body, context).getSyncPoller(); + Response response = upgradeWithResponse(resourceGroupName, monitorName, body, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -278,25 +331,6 @@ private Mono upgradeAsync(String resourceGroupName, String monitorName) { .flatMap(this.client::getLroFinalResultOrError); } - /** - * Upgradable version for a monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param body Elastic Monitor Upgrade Parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono upgradeAsync(String resourceGroupName, String monitorName, ElasticMonitorUpgrade body, - Context context) { - return beginUpgradeAsync(resourceGroupName, monitorName, body, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Upgradable version for a monitor resource. * @@ -309,7 +343,7 @@ private Mono upgradeAsync(String resourceGroupName, String monitorName, El @ServiceMethod(returns = ReturnType.SINGLE) public void upgrade(String resourceGroupName, String monitorName) { final ElasticMonitorUpgrade body = null; - upgradeAsync(resourceGroupName, monitorName, body).block(); + beginUpgrade(resourceGroupName, monitorName, body).getFinalResult(); } /** @@ -325,6 +359,8 @@ public void upgrade(String resourceGroupName, String monitorName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void upgrade(String resourceGroupName, String monitorName, ElasticMonitorUpgrade body, Context context) { - upgradeAsync(resourceGroupName, monitorName, body, context).block(); + beginUpgrade(resourceGroupName, monitorName, body, context).getFinalResult(); } + + private static final ClientLogger LOGGER = new ClientLogger(MonitorOperationsClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourcesClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourcesClientImpl.java index ac2d6757611d..be8b7082938f 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourcesClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourcesClientImpl.java @@ -26,6 +26,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.MonitoredResourcesClient; import com.azure.resourcemanager.elastic.fluent.models.MonitoredResourceInner; import com.azure.resourcemanager.elastic.models.MonitoredResourceListResponse; @@ -72,6 +73,15 @@ Mono> list(@HostParam("$host") String en @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listMonitoredResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -79,6 +89,14 @@ Mono> list(@HostParam("$host") String en Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -123,37 +141,15 @@ private Mono> listSinglePageAsync(String r * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, - String monitorName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -164,12 +160,34 @@ private Mono> listSinglePageAsync(String r * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String monitorName) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), - nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -181,12 +199,35 @@ private PagedFlux listAsync(String resourceGroupName, St * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String monitorName, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String monitorName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -201,7 +242,8 @@ private PagedFlux listAsync(String resourceGroupName, St */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String monitorName) { - return new PagedIterable<>(listAsync(resourceGroupName, monitorName)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName), + nextLink -> listNextSinglePage(nextLink)); } /** @@ -217,7 +259,8 @@ public PagedIterable list(String resourceGroupName, Stri */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String monitorName, Context context) { - return new PagedIterable<>(listAsync(resourceGroupName, monitorName, context)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -245,6 +288,33 @@ private Mono> listNextSinglePageAsync(Stri .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -253,21 +323,25 @@ private Mono> listNextSinglePageAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(MonitoredResourcesClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredSubscriptionPropertiesImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredSubscriptionPropertiesImpl.java new file mode 100644 index 000000000000..1bb5f9e48a35 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredSubscriptionPropertiesImpl.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.elastic.fluent.models.MonitoredSubscriptionPropertiesInner; +import com.azure.resourcemanager.elastic.models.MonitoredSubscriptionProperties; +import com.azure.resourcemanager.elastic.models.SubscriptionList; + +public final class MonitoredSubscriptionPropertiesImpl implements MonitoredSubscriptionProperties, + MonitoredSubscriptionProperties.Definition, MonitoredSubscriptionProperties.Update { + private MonitoredSubscriptionPropertiesInner innerObject; + + private final com.azure.resourcemanager.elastic.ElasticManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SubscriptionList properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MonitoredSubscriptionPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.elastic.ElasticManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private String configurationName; + + public MonitoredSubscriptionPropertiesImpl withExistingMonitor(String resourceGroupName, String monitorName) { + this.resourceGroupName = resourceGroupName; + this.monitorName = monitorName; + return this; + } + + public MonitoredSubscriptionProperties create() { + this.innerObject = serviceManager.serviceClient() + .getMonitoredSubscriptions() + .createorUpdate(resourceGroupName, monitorName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public MonitoredSubscriptionProperties create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMonitoredSubscriptions() + .createorUpdate(resourceGroupName, monitorName, configurationName, this.innerModel(), context); + return this; + } + + MonitoredSubscriptionPropertiesImpl(String name, com.azure.resourcemanager.elastic.ElasticManager serviceManager) { + this.innerObject = new MonitoredSubscriptionPropertiesInner(); + this.serviceManager = serviceManager; + this.configurationName = name; + } + + public MonitoredSubscriptionPropertiesImpl update() { + return this; + } + + public MonitoredSubscriptionProperties apply() { + this.innerObject = serviceManager.serviceClient() + .getMonitoredSubscriptions() + .update(resourceGroupName, monitorName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public MonitoredSubscriptionProperties apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMonitoredSubscriptions() + .update(resourceGroupName, monitorName, configurationName, this.innerModel(), context); + return this; + } + + MonitoredSubscriptionPropertiesImpl(MonitoredSubscriptionPropertiesInner innerObject, + com.azure.resourcemanager.elastic.ElasticManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "monitors"); + this.configurationName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "monitoredSubscriptions"); + } + + public MonitoredSubscriptionProperties refresh() { + this.innerObject = serviceManager.serviceClient() + .getMonitoredSubscriptions() + .getWithResponse(resourceGroupName, monitorName, configurationName, Context.NONE) + .getValue(); + return this; + } + + public MonitoredSubscriptionProperties refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMonitoredSubscriptions() + .getWithResponse(resourceGroupName, monitorName, configurationName, context) + .getValue(); + return this; + } + + public MonitoredSubscriptionPropertiesImpl withProperties(SubscriptionList properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredSubscriptionsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredSubscriptionsClientImpl.java new file mode 100644 index 000000000000..dffdf3793bc8 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredSubscriptionsClientImpl.java @@ -0,0 +1,1341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.elastic.fluent.MonitoredSubscriptionsClient; +import com.azure.resourcemanager.elastic.fluent.models.MonitoredSubscriptionPropertiesInner; +import com.azure.resourcemanager.elastic.models.MonitoredSubscriptionPropertiesList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MonitoredSubscriptionsClient. + */ +public final class MonitoredSubscriptionsClientImpl implements MonitoredSubscriptionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final MonitoredSubscriptionsService service; + + /** + * The service client containing this operation class. + */ + private final ElasticManagementClientImpl client; + + /** + * Initializes an instance of MonitoredSubscriptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MonitoredSubscriptionsClientImpl(ElasticManagementClientImpl client) { + this.service = RestProxy.create(MonitoredSubscriptionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ElasticManagementClientMonitoredSubscriptions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ElasticManagementCli") + public interface MonitoredSubscriptionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createorUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") MonitoredSubscriptionPropertiesInner body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createorUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") MonitoredSubscriptionPropertiesInner body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") MonitoredSubscriptionPropertiesInner body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") MonitoredSubscriptionPropertiesInner body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/monitoredSubscriptions/{configurationName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String monitorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String monitorName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String monitorName, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String monitorName, String configurationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, configurationName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String monitorName, + String configurationName) { + return getWithResponseAsync(resourceGroupName, monitorName, configurationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String monitorName, + String configurationName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, configurationName, accept, context); + } + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitoredSubscriptionPropertiesInner get(String resourceGroupName, String monitorName, + String configurationName) { + return getWithResponse(resourceGroupName, monitorName, configurationName, Context.NONE).getValue(); + } + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createorUpdateWithResponseAsync(String resourceGroupName, + String monitorName, String configurationName, MonitoredSubscriptionPropertiesInner body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createorUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, configurationName, body, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createorUpdateWithResponse(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.createorUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, configurationName, body, accept, + Context.NONE); + } + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createorUpdateWithResponse(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.createorUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, configurationName, body, accept, context); + } + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the request to update subscriptions needed to be monitored by the + * Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MonitoredSubscriptionPropertiesInner> + beginCreateorUpdateAsync(String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body) { + Mono>> mono + = createorUpdateWithResponseAsync(resourceGroupName, monitorName, configurationName, body); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), MonitoredSubscriptionPropertiesInner.class, + MonitoredSubscriptionPropertiesInner.class, this.client.getContext()); + } + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the request to update subscriptions needed to be monitored by the + * Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MonitoredSubscriptionPropertiesInner> + beginCreateorUpdate(String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body) { + Response response + = createorUpdateWithResponse(resourceGroupName, monitorName, configurationName, body); + return this.client.getLroResult( + response, MonitoredSubscriptionPropertiesInner.class, MonitoredSubscriptionPropertiesInner.class, + Context.NONE); + } + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the request to update subscriptions needed to be monitored by the + * Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MonitoredSubscriptionPropertiesInner> + beginCreateorUpdate(String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body, Context context) { + Response response + = createorUpdateWithResponse(resourceGroupName, monitorName, configurationName, body, context); + return this.client.getLroResult( + response, MonitoredSubscriptionPropertiesInner.class, MonitoredSubscriptionPropertiesInner.class, context); + } + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createorUpdateAsync(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body) { + return beginCreateorUpdateAsync(resourceGroupName, monitorName, configurationName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitoredSubscriptionPropertiesInner createorUpdate(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body) { + return beginCreateorUpdate(resourceGroupName, monitorName, configurationName, body).getFinalResult(); + } + + /** + * Add the subscriptions that should be monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitoredSubscriptionPropertiesInner createorUpdate(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body, Context context) { + return beginCreateorUpdate(resourceGroupName, monitorName, configurationName, body, context).getFinalResult(); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, configurationName, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, configurationName, body, accept, + Context.NONE); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, configurationName, body, accept, context); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the request to update subscriptions needed to be monitored by the + * Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MonitoredSubscriptionPropertiesInner> + beginUpdateAsync(String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, monitorName, configurationName, body); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), MonitoredSubscriptionPropertiesInner.class, + MonitoredSubscriptionPropertiesInner.class, this.client.getContext()); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the request to update subscriptions needed to be monitored by the + * Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MonitoredSubscriptionPropertiesInner> + beginUpdate(String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body) { + Response response = updateWithResponse(resourceGroupName, monitorName, configurationName, body); + return this.client.getLroResult( + response, MonitoredSubscriptionPropertiesInner.class, MonitoredSubscriptionPropertiesInner.class, + Context.NONE); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the request to update subscriptions needed to be monitored by the + * Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MonitoredSubscriptionPropertiesInner> + beginUpdate(String resourceGroupName, String monitorName, String configurationName, + MonitoredSubscriptionPropertiesInner body, Context context) { + Response response + = updateWithResponse(resourceGroupName, monitorName, configurationName, body, context); + return this.client.getLroResult( + response, MonitoredSubscriptionPropertiesInner.class, MonitoredSubscriptionPropertiesInner.class, context); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body) { + return beginUpdateAsync(resourceGroupName, monitorName, configurationName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitoredSubscriptionPropertiesInner update(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body) { + return beginUpdate(resourceGroupName, monitorName, configurationName, body).getFinalResult(); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitoredSubscriptionPropertiesInner update(String resourceGroupName, String monitorName, + String configurationName, MonitoredSubscriptionPropertiesInner body, Context context) { + return beginUpdate(resourceGroupName, monitorName, configurationName, body, context).getFinalResult(); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String monitorName, + String configurationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, configurationName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String monitorName, + String configurationName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, configurationName, accept, Context.NONE); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String monitorName, + String configurationName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, configurationName, accept, context); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String monitorName, + String configurationName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, monitorName, configurationName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, + String configurationName) { + Response response = deleteWithResponse(resourceGroupName, monitorName, configurationName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, + String configurationName, Context context) { + Response response = deleteWithResponse(resourceGroupName, monitorName, configurationName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String monitorName, String configurationName) { + return beginDeleteAsync(resourceGroupName, monitorName, configurationName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName, String configurationName) { + beginDelete(resourceGroupName, monitorName, configurationName).getFinalResult(); + } + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName, String configurationName, Context context) { + beginDelete(resourceGroupName, monitorName, configurationName, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(MonitoredSubscriptionsClientImpl.class); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredSubscriptionsImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredSubscriptionsImpl.java new file mode 100644 index 000000000000..2ce07973c619 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredSubscriptionsImpl.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.elastic.fluent.MonitoredSubscriptionsClient; +import com.azure.resourcemanager.elastic.fluent.models.MonitoredSubscriptionPropertiesInner; +import com.azure.resourcemanager.elastic.models.MonitoredSubscriptionProperties; +import com.azure.resourcemanager.elastic.models.MonitoredSubscriptions; + +public final class MonitoredSubscriptionsImpl implements MonitoredSubscriptions { + private static final ClientLogger LOGGER = new ClientLogger(MonitoredSubscriptionsImpl.class); + + private final MonitoredSubscriptionsClient innerClient; + + private final com.azure.resourcemanager.elastic.ElasticManager serviceManager; + + public MonitoredSubscriptionsImpl(MonitoredSubscriptionsClient innerClient, + com.azure.resourcemanager.elastic.ElasticManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, monitorName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new MonitoredSubscriptionPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String monitorName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, monitorName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new MonitoredSubscriptionPropertiesImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String monitorName, + String configurationName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, monitorName, configurationName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MonitoredSubscriptionPropertiesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MonitoredSubscriptionProperties get(String resourceGroupName, String monitorName, String configurationName) { + MonitoredSubscriptionPropertiesInner inner + = this.serviceClient().get(resourceGroupName, monitorName, configurationName); + if (inner != null) { + return new MonitoredSubscriptionPropertiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String monitorName, String configurationName) { + this.serviceClient().delete(resourceGroupName, monitorName, configurationName); + } + + public void delete(String resourceGroupName, String monitorName, String configurationName, Context context) { + this.serviceClient().delete(resourceGroupName, monitorName, configurationName, context); + } + + public MonitoredSubscriptionProperties getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = ResourceManagerUtils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String configurationName = ResourceManagerUtils.getValueFromIdByName(id, "monitoredSubscriptions"); + if (configurationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'monitoredSubscriptions'.", id))); + } + return this.getWithResponse(resourceGroupName, monitorName, configurationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = ResourceManagerUtils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String configurationName = ResourceManagerUtils.getValueFromIdByName(id, "monitoredSubscriptions"); + if (configurationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'monitoredSubscriptions'.", id))); + } + return this.getWithResponse(resourceGroupName, monitorName, configurationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = ResourceManagerUtils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String configurationName = ResourceManagerUtils.getValueFromIdByName(id, "monitoredSubscriptions"); + if (configurationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'monitoredSubscriptions'.", id))); + } + this.delete(resourceGroupName, monitorName, configurationName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = ResourceManagerUtils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String configurationName = ResourceManagerUtils.getValueFromIdByName(id, "monitoredSubscriptions"); + if (configurationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'monitoredSubscriptions'.", id))); + } + this.delete(resourceGroupName, monitorName, configurationName, context); + } + + private MonitoredSubscriptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.elastic.ElasticManager manager() { + return this.serviceManager; + } + + public MonitoredSubscriptionPropertiesImpl define(String name) { + return new MonitoredSubscriptionPropertiesImpl(name, this.manager()); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorsClientImpl.java index aea506c60d6b..6d41d7a79c3c 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorsClientImpl.java @@ -28,8 +28,10 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.elastic.fluent.MonitorsClient; @@ -79,6 +81,14 @@ Mono> list(@HostParam("$host") Stri @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors") @ExpectedResponses({ 200 }) @@ -88,6 +98,15 @@ Mono> listByResourceGroup(@HostPara @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}") @ExpectedResponses({ 200 }) @@ -97,6 +116,15 @@ Mono> getByResourceGroup(@HostParam("$host @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}") @ExpectedResponses({ 200, 201 }) @@ -107,11 +135,31 @@ Mono>> create(@HostParam("$host") String endpoint, @BodyParam("application/json") ElasticMonitorResourceInner body, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @BodyParam("application/json") ElasticMonitorResourceInner body, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}") - @ExpectedResponses({ 200 }) + @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("$host") String endpoint, + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @BodyParam("application/json") ElasticMonitorResourceUpdateParameters body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @BodyParam("application/json") ElasticMonitorResourceUpdateParameters body, @@ -126,6 +174,15 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -134,6 +191,14 @@ Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -141,6 +206,14 @@ Mono> listNext( Mono> listByResourceGroupNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -172,29 +245,13 @@ private Mono> listSinglePageAsync() { /** * List all monitors under the specified subscription. * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -202,11 +259,25 @@ private Mono> listSinglePageAsync(Con * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -216,12 +287,25 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -233,7 +317,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -247,7 +331,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -287,34 +371,15 @@ public PagedIterable list(Context context) { * List all monitors under the specified resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupSinglePageAsync(String resourceGroupName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** @@ -324,12 +389,29 @@ public PagedIterable list(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -340,12 +422,30 @@ private PagedFlux listByResourceGroupAsync(String r * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -359,7 +459,8 @@ private PagedFlux listByResourceGroupAsync(String r */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); } /** @@ -374,7 +475,8 @@ public PagedIterable listByResourceGroup(String res */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); } /** @@ -413,42 +515,6 @@ private Mono> getByResourceGroupWithRespon .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get the properties of a specific monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of a specific monitor resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String monitorName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, monitorName, accept, context); - } - /** * Get the properties of a specific monitor resource. * @@ -479,7 +545,27 @@ private Mono getByResourceGroupAsync(String resourc @ServiceMethod(returns = ReturnType.SINGLE) public Response getByResourceGroupWithResponse(String resourceGroupName, String monitorName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, monitorName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, accept, context); } /** @@ -526,7 +612,9 @@ private Mono>> createWithResponseAsync(String resource if (monitorName == null) { return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } - if (body != null) { + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { body.validate(); } final String accept = "application/json"; @@ -542,37 +630,40 @@ private Mono>> createWithResponseAsync(String resource * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param body Elastic monitor resource model. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return monitor resource along with {@link Response} on successful completion of {@link Mono}. + * @return monitor resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync(String resourceGroupName, String monitorName, - ElasticMonitorResourceInner body, Context context) { + private Response createWithResponse(String resourceGroupName, String monitorName, + ElasticMonitorResourceInner body) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } - if (body != null) { + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { body.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, body, accept, context); + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, Context.NONE); } /** @@ -581,18 +672,41 @@ private Mono>> createWithResponseAsync(String resource * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param body Elastic monitor resource model. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of monitor resource. + * @return monitor resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ElasticMonitorResourceInner> - beginCreateAsync(String resourceGroupName, String monitorName, ElasticMonitorResourceInner body) { - Mono>> mono = createWithResponseAsync(resourceGroupName, monitorName, body); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String monitorName, + ElasticMonitorResourceInner body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, context); } /** @@ -600,6 +714,7 @@ private Mono>> createWithResponseAsync(String resource * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -607,8 +722,7 @@ private Mono>> createWithResponseAsync(String resource */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ElasticMonitorResourceInner> - beginCreateAsync(String resourceGroupName, String monitorName) { - final ElasticMonitorResourceInner body = null; + beginCreateAsync(String resourceGroupName, String monitorName, ElasticMonitorResourceInner body) { Mono>> mono = createWithResponseAsync(resourceGroupName, monitorName, body); return this.client.getLroResult(mono, this.client.getHttpPipeline(), ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, @@ -621,27 +735,6 @@ private Mono>> createWithResponseAsync(String resource * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param body Elastic monitor resource model. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of monitor resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ElasticMonitorResourceInner> beginCreateAsync( - String resourceGroupName, String monitorName, ElasticMonitorResourceInner body, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = createWithResponseAsync(resourceGroupName, monitorName, body, context); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, - context); - } - - /** - * Create a monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -649,9 +742,10 @@ private PollerFlux, ElasticMonitorResour */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ElasticMonitorResourceInner> - beginCreate(String resourceGroupName, String monitorName) { - final ElasticMonitorResourceInner body = null; - return this.beginCreateAsync(resourceGroupName, monitorName, body).getSyncPoller(); + beginCreate(String resourceGroupName, String monitorName, ElasticMonitorResourceInner body) { + Response response = createWithResponse(resourceGroupName, monitorName, body); + return this.client.getLroResult(response, + ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, Context.NONE); } /** @@ -669,7 +763,9 @@ private PollerFlux, ElasticMonitorResour @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ElasticMonitorResourceInner> beginCreate(String resourceGroupName, String monitorName, ElasticMonitorResourceInner body, Context context) { - return this.beginCreateAsync(resourceGroupName, monitorName, body, context).getSyncPoller(); + Response response = createWithResponse(resourceGroupName, monitorName, body, context); + return this.client.getLroResult(response, + ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, context); } /** @@ -690,56 +786,21 @@ private Mono createAsync(String resourceGroupName, .flatMap(this.client::getLroFinalResultOrError); } - /** - * Create a monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return monitor resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String resourceGroupName, String monitorName) { - final ElasticMonitorResourceInner body = null; - return beginCreateAsync(resourceGroupName, monitorName, body).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Create a monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param body Elastic monitor resource model. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return monitor resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String resourceGroupName, String monitorName, - ElasticMonitorResourceInner body, Context context) { - return beginCreateAsync(resourceGroupName, monitorName, body, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return monitor resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ElasticMonitorResourceInner create(String resourceGroupName, String monitorName) { - final ElasticMonitorResourceInner body = null; - return createAsync(resourceGroupName, monitorName, body).block(); + public ElasticMonitorResourceInner create(String resourceGroupName, String monitorName, + ElasticMonitorResourceInner body) { + return beginCreate(resourceGroupName, monitorName, body).getFinalResult(); } /** @@ -757,7 +818,7 @@ public ElasticMonitorResourceInner create(String resourceGroupName, String monit @ServiceMethod(returns = ReturnType.SINGLE) public ElasticMonitorResourceInner create(String resourceGroupName, String monitorName, ElasticMonitorResourceInner body, Context context) { - return createAsync(resourceGroupName, monitorName, body, context).block(); + return beginCreate(resourceGroupName, monitorName, body, context).getFinalResult(); } /** @@ -772,8 +833,8 @@ public ElasticMonitorResourceInner create(String resourceGroupName, String monit * @return monitor resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, - String monitorName, ElasticMonitorResourceUpdateParameters body) { + private Mono>> updateWithResponseAsync(String resourceGroupName, String monitorName, + ElasticMonitorResourceUpdateParameters body) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -789,7 +850,9 @@ private Mono> updateWithResponseAsync(Stri if (monitorName == null) { return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } - if (body != null) { + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { body.validate(); } final String accept = "application/json"; @@ -799,6 +862,48 @@ private Mono> updateWithResponseAsync(Stri .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String monitorName, + ElasticMonitorResourceUpdateParameters body) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, Context.NONE); + } + /** * Update a monitor resource. * @@ -809,33 +914,37 @@ private Mono> updateWithResponseAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return monitor resource along with {@link Response} on successful completion of {@link Mono}. + * @return monitor resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, - String monitorName, ElasticMonitorResourceUpdateParameters body, Context context) { + private Response updateWithResponse(String resourceGroupName, String monitorName, + ElasticMonitorResourceUpdateParameters body, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } - if (body != null) { + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { body.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, body, accept, context); + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, context); } /** @@ -843,16 +952,76 @@ private Mono> updateWithResponseAsync(Stri * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ElasticMonitorResourceInner> + beginUpdateAsync(String resourceGroupName, String monitorName, ElasticMonitorResourceUpdateParameters body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, monitorName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, + this.client.getContext()); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ElasticMonitorResourceInner> + beginUpdate(String resourceGroupName, String monitorName, ElasticMonitorResourceUpdateParameters body) { + Response response = updateWithResponse(resourceGroupName, monitorName, body); + return this.client.getLroResult(response, + ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, Context.NONE); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ElasticMonitorResourceInner> beginUpdate( + String resourceGroupName, String monitorName, ElasticMonitorResourceUpdateParameters body, Context context) { + Response response = updateWithResponse(resourceGroupName, monitorName, body, context); + return this.client.getLroResult(response, + ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, context); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return monitor resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String monitorName) { - final ElasticMonitorResourceUpdateParameters body = null; - return updateWithResponseAsync(resourceGroupName, monitorName, body) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono updateAsync(String resourceGroupName, String monitorName, + ElasticMonitorResourceUpdateParameters body) { + return beginUpdateAsync(resourceGroupName, monitorName, body).last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -861,16 +1030,15 @@ private Mono updateAsync(String resourceGroupName, * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param body Elastic resource model update parameters. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return monitor resource along with {@link Response}. + * @return monitor resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String resourceGroupName, String monitorName, - ElasticMonitorResourceUpdateParameters body, Context context) { - return updateWithResponseAsync(resourceGroupName, monitorName, body, context).block(); + public ElasticMonitorResourceInner update(String resourceGroupName, String monitorName, + ElasticMonitorResourceUpdateParameters body) { + return beginUpdate(resourceGroupName, monitorName, body).getFinalResult(); } /** @@ -878,15 +1046,17 @@ public Response updateWithResponse(String resourceG * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return monitor resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ElasticMonitorResourceInner update(String resourceGroupName, String monitorName) { - final ElasticMonitorResourceUpdateParameters body = null; - return updateWithResponse(resourceGroupName, monitorName, body, Context.NONE).getValue(); + public ElasticMonitorResourceInner update(String resourceGroupName, String monitorName, + ElasticMonitorResourceUpdateParameters body, Context context) { + return beginUpdate(resourceGroupName, monitorName, body, context).getFinalResult(); } /** @@ -928,34 +1098,34 @@ private Mono>> deleteWithResponseAsync(String resource * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String monitorName, - Context context) { + private Response deleteWithResponse(String resourceGroupName, String monitorName) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context); + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, accept, Context.NONE); } /** @@ -963,16 +1133,35 @@ private Mono>> deleteWithResponseAsync(String resource * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String monitorName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, accept, context); } /** @@ -980,19 +1169,16 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String monitorName, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName, context); + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String monitorName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -1007,7 +1193,8 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName) { - return this.beginDeleteAsync(resourceGroupName, monitorName).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, monitorName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -1024,7 +1211,8 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, Context context) { - return this.beginDeleteAsync(resourceGroupName, monitorName, context).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, monitorName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -1042,23 +1230,6 @@ private Mono deleteAsync(String resourceGroupName, String monitorName) { return beginDeleteAsync(resourceGroupName, monitorName).last().flatMap(this.client::getLroFinalResultOrError); } - /** - * Delete a monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String monitorName, Context context) { - return beginDeleteAsync(resourceGroupName, monitorName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Delete a monitor resource. * @@ -1070,7 +1241,7 @@ private Mono deleteAsync(String resourceGroupName, String monitorName, Con */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String monitorName) { - deleteAsync(resourceGroupName, monitorName).block(); + beginDelete(resourceGroupName, monitorName).getFinalResult(); } /** @@ -1085,7 +1256,7 @@ public void delete(String resourceGroupName, String monitorName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String monitorName, Context context) { - deleteAsync(resourceGroupName, monitorName, context).block(); + beginDelete(resourceGroupName, monitorName, context).getFinalResult(); } /** @@ -1113,6 +1284,33 @@ private Mono> listNextSinglePageAsync .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1121,22 +1319,24 @@ private Mono> listNextSinglePageAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1166,6 +1366,33 @@ private Mono> listByResourceGroupNext .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1174,22 +1401,26 @@ private Mono> listByResourceGroupNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(MonitorsClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OpenAIIntegrationRPModelImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OpenAIIntegrationRPModelImpl.java index 79f2f1e57e86..b6476f3f76d9 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OpenAIIntegrationRPModelImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OpenAIIntegrationRPModelImpl.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.elastic.implementation; import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.elastic.fluent.models.OpenAIIntegrationRPModelInner; import com.azure.resourcemanager.elastic.models.OpenAIIntegrationProperties; @@ -33,6 +34,10 @@ public OpenAIIntegrationProperties properties() { return this.innerModel().properties(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String resourceGroupName() { return resourceGroupName; } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OpenAIsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OpenAIsClientImpl.java index 8a0a9b779aca..8a85b03e4729 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OpenAIsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OpenAIsClientImpl.java @@ -29,6 +29,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.OpenAIsClient; import com.azure.resourcemanager.elastic.fluent.models.OpenAIIntegrationRPModelInner; import com.azure.resourcemanager.elastic.fluent.models.OpenAIIntegrationStatusResponseInner; @@ -75,6 +76,15 @@ Mono> list(@HostParam("$host") St @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}") @ExpectedResponses({ 200 }) @@ -85,6 +95,16 @@ Mono> get(@HostParam("$host") String end @PathParam("integrationName") String integrationName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("integrationName") String integrationName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}") @ExpectedResponses({ 200, 201 }) @@ -96,6 +116,17 @@ Mono> createOrUpdate(@HostParam("$host") @BodyParam("application/json") OpenAIIntegrationRPModelInner body, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("integrationName") String integrationName, + @BodyParam("application/json") OpenAIIntegrationRPModelInner body, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}") @ExpectedResponses({ 200, 204 }) @@ -106,6 +137,16 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("integrationName") String integrationName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("integrationName") String integrationName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}/getStatus") @ExpectedResponses({ 200 }) @@ -116,6 +157,16 @@ Mono> getStatus(@HostParam("$host @PathParam("integrationName") String integrationName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}/getStatus") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getStatusSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("integrationName") String integrationName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -123,6 +174,14 @@ Mono> getStatus(@HostParam("$host Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -167,37 +226,15 @@ private Mono> listSinglePageAsync(S * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, - String monitorName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -208,12 +245,34 @@ private Mono> listSinglePageAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String monitorName) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), - nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -225,13 +284,35 @@ private PagedFlux listAsync(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String monitorName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String monitorName, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -246,7 +327,8 @@ private PagedFlux listAsync(String resourceGroupN */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String monitorName) { - return new PagedIterable<>(listAsync(resourceGroupName, monitorName)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName), + nextLink -> listNextSinglePage(nextLink)); } /** @@ -263,7 +345,8 @@ public PagedIterable list(String resourceGroupNam @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String monitorName, Context context) { - return new PagedIterable<>(listAsync(resourceGroupName, monitorName, context)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -307,47 +390,6 @@ private Mono> getWithResponseAsync(Strin .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get OpenAI integration rule for a given monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param integrationName OpenAI Integration name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return openAI integration rule for a given monitor resource along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String monitorName, String integrationName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - if (integrationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter integrationName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, integrationName, accept, context); - } - /** * Get OpenAI integration rule for a given monitor resource. * @@ -381,7 +423,31 @@ private Mono getAsync(String resourceGroupName, S @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String monitorName, String integrationName, Context context) { - return getWithResponseAsync(resourceGroupName, monitorName, integrationName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (integrationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter integrationName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, integrationName, accept, context); } /** @@ -435,7 +501,9 @@ private Mono> createOrUpdateWithResponse return Mono .error(new IllegalArgumentException("Parameter integrationName is required and cannot be null.")); } - if (body != null) { + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { body.validate(); } final String accept = "application/json"; @@ -453,50 +521,6 @@ private Mono> createOrUpdateWithResponse * @param monitorName Monitor resource name. * @param integrationName OpenAI Integration name. * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return capture properties of Open AI resource Integration along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String monitorName, String integrationName, OpenAIIntegrationRPModelInner body, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - if (integrationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter integrationName is required and cannot be null.")); - } - if (body != null) { - body.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, monitorName, integrationName, body, accept, context); - } - - /** - * Create or update a OpenAI integration rule for a given monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param integrationName OpenAI Integration name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -504,8 +528,7 @@ private Mono> createOrUpdateWithResponse */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync(String resourceGroupName, String monitorName, - String integrationName) { - final OpenAIIntegrationRPModelInner body = null; + String integrationName, OpenAIIntegrationRPModelInner body) { return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, integrationName, body) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } @@ -526,7 +549,36 @@ private Mono createOrUpdateAsync(String resourceG @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String resourceGroupName, String monitorName, String integrationName, OpenAIIntegrationRPModelInner body, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, integrationName, body, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (integrationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter integrationName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, integrationName, body, accept, context); } /** @@ -535,6 +587,7 @@ public Response createOrUpdateWithResponse(String * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param integrationName OpenAI Integration name. + * @param body The body parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -542,8 +595,7 @@ public Response createOrUpdateWithResponse(String */ @ServiceMethod(returns = ReturnType.SINGLE) public OpenAIIntegrationRPModelInner createOrUpdate(String resourceGroupName, String monitorName, - String integrationName) { - final OpenAIIntegrationRPModelInner body = null; + String integrationName, OpenAIIntegrationRPModelInner body) { return createOrUpdateWithResponse(resourceGroupName, monitorName, integrationName, body, Context.NONE) .getValue(); } @@ -588,46 +640,6 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Delete OpenAI integration rule for a given monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param integrationName OpenAI Integration name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String monitorName, - String integrationName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - if (integrationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter integrationName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, integrationName, accept, context); - } - /** * Delete OpenAI integration rule for a given monitor resource. * @@ -660,7 +672,31 @@ private Mono deleteAsync(String resourceGroupName, String monitorName, Str @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceGroupName, String monitorName, String integrationName, Context context) { - return deleteWithResponseAsync(resourceGroupName, monitorName, integrationName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (integrationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter integrationName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, integrationName, accept, context); } /** @@ -719,47 +755,6 @@ private Mono> getStatusWithRespon .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get OpenAI integration status for a given integration. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param integrationName OpenAI Integration name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return openAI integration status for a given integration along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getStatusWithResponseAsync(String resourceGroupName, - String monitorName, String integrationName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - if (integrationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter integrationName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getStatus(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, monitorName, integrationName, accept, context); - } - /** * Get OpenAI integration status for a given integration. * @@ -793,7 +788,31 @@ private Mono getStatusAsync(String resourc @ServiceMethod(returns = ReturnType.SINGLE) public Response getStatusWithResponse(String resourceGroupName, String monitorName, String integrationName, Context context) { - return getStatusWithResponseAsync(resourceGroupName, monitorName, integrationName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (integrationName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter integrationName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getStatusSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, integrationName, accept, context); } /** @@ -838,6 +857,33 @@ private Mono> listNextSinglePageAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -846,22 +892,25 @@ private Mono> listNextSinglePageAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(OpenAIsClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationsClientImpl.java index b8b0283c5139..0e8c7bb76091 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationsClientImpl.java @@ -25,6 +25,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.OperationsClient; import com.azure.resourcemanager.elastic.fluent.models.OperationResultInner; import com.azure.resourcemanager.elastic.models.OperationListResult; @@ -69,21 +70,35 @@ public interface OperationsService { Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Elastic/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * List all operations provided by Microsoft.Elastic. + * List the operations for the provider. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return represents a paginated list of operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { @@ -101,83 +116,85 @@ private Mono> listSinglePageAsync() { } /** - * List all operations provided by Microsoft.Elastic. + * List the operations for the provider. * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return represents a paginated list of operations as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * List all operations provided by Microsoft.Elastic. + * List the operations for the provider. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations as paginated response with - * {@link PagedFlux}. + * @return represents a paginated list of operations along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * List all operations provided by Microsoft.Elastic. + * List the operations for the provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations as paginated response with - * {@link PagedFlux}. + * @return represents a paginated list of operations along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * List all operations provided by Microsoft.Elastic. + * List the operations for the provider. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations as paginated response with - * {@link PagedIterable}. + * @return represents a paginated list of operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** - * List all operations provided by Microsoft.Elastic. + * List the operations for the provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations as paginated response with - * {@link PagedIterable}. + * @return represents a paginated list of operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -187,8 +204,8 @@ public PagedIterable list(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return represents a paginated list of operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -206,6 +223,33 @@ private Mono> listNextSinglePageAsync(String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a paginated list of operations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -214,22 +258,24 @@ private Mono> listNextSinglePageAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @return represents a paginated list of operations along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(OperationsClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OrganizationsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OrganizationsClientImpl.java index a15f09e72560..245072586d55 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OrganizationsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OrganizationsClientImpl.java @@ -20,12 +20,21 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.elastic.fluent.OrganizationsClient; +import com.azure.resourcemanager.elastic.fluent.models.ElasticMonitorResourceInner; import com.azure.resourcemanager.elastic.fluent.models.ElasticOrganizationToAzureSubscriptionMappingResponseInner; import com.azure.resourcemanager.elastic.fluent.models.UserApiKeyResponseInner; +import com.azure.resourcemanager.elastic.models.ResubscribeProperties; import com.azure.resourcemanager.elastic.models.UserEmailId; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** @@ -60,6 +69,22 @@ public final class OrganizationsClientImpl implements OrganizationsClient { @Host("{$host}") @ServiceInterface(name = "ElasticManagementCli") public interface OrganizationsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getElasticOrganizationToAzureSubscriptionMapping") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getElasticToAzureSubscriptionMapping( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getElasticOrganizationToAzureSubscriptionMapping") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getElasticToAzureSubscriptionMappingSync( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getOrganizationApiKey") @ExpectedResponses({ 200 }) @@ -69,27 +94,49 @@ Mono> getApiKey(@HostParam("$host") String end @BodyParam("application/json") UserEmailId body, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getElasticOrganizationToAzureSubscriptionMapping") + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getOrganizationApiKey") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getElasticToAzureSubscriptionMapping( - @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + Response getApiKeySync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") UserEmailId body, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/resubscribe") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resubscribe(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @BodyParam("application/json") ResubscribeProperties body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/resubscribe") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response resubscribeSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @BodyParam("application/json") ResubscribeProperties body, @HeaderParam("Accept") String accept, + Context context); } /** - * Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch - * Organization. + * 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. * - * @param body Email Id parameter of the User Organization, of which the API Key must be returned. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the User Api Key created for the Organization associated with the User Email Id that was passed in the - * request along with {@link Response} on successful completion of {@link Mono}. + * @return the Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into + * along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getApiKeyWithResponseAsync(UserEmailId body) { + private Mono> + getElasticToAzureSubscriptionMappingWithResponseAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -98,22 +145,84 @@ private Mono> getApiKeyWithResponseAsync(UserE return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (body != null) { - body.validate(); - } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getApiKey(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), body, accept, context)) + .withContext(context -> service.getElasticToAzureSubscriptionMapping(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * 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. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + getElasticToAzureSubscriptionMappingAsync() { + return getElasticToAzureSubscriptionMappingWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + getElasticToAzureSubscriptionMappingWithResponse(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getElasticToAzureSubscriptionMappingSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + } + + /** + * 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. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticOrganizationToAzureSubscriptionMappingResponseInner getElasticToAzureSubscriptionMapping() { + return getElasticToAzureSubscriptionMappingWithResponse(Context.NONE).getValue(); + } + /** * Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch * Organization. * - * @param body Email Id parameter of the User Organization, of which the API Key must be returned. - * @param context The context to associate with this operation. + * @param body The request body. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -121,7 +230,7 @@ private Mono> getApiKeyWithResponseAsync(UserE * request along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getApiKeyWithResponseAsync(UserEmailId body, Context context) { + private Mono> getApiKeyWithResponseAsync(UserEmailId body) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -130,27 +239,31 @@ private Mono> getApiKeyWithResponseAsync(UserE return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (body != null) { + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { body.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getApiKey(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), body, accept, context); + return FluxUtil + .withContext(context -> service.getApiKey(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch * Organization. * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the User Api Key created for the Organization associated with the User Email Id that was passed in the * request on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getApiKeyAsync() { - final UserEmailId body = null; + private Mono getApiKeyAsync(UserEmailId body) { return getApiKeyWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); } @@ -158,7 +271,7 @@ private Mono getApiKeyAsync() { * Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch * Organization. * - * @param body Email Id parameter of the User Organization, of which the API Key must be returned. + * @param body The request body. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -168,35 +281,56 @@ private Mono getApiKeyAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getApiKeyWithResponse(UserEmailId body, Context context) { - return getApiKeyWithResponseAsync(body, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.getApiKeySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), body, accept, context); } /** * Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch * Organization. * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the User Api Key created for the Organization associated with the User Email Id that was passed in the * request. */ @ServiceMethod(returns = ReturnType.SINGLE) - public UserApiKeyResponseInner getApiKey() { - final UserEmailId body = null; + public UserApiKeyResponseInner getApiKey(UserEmailId body) { return getApiKeyWithResponse(body, Context.NONE).getValue(); } /** - * Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + * Resubscribe the Elasticsearch Organization. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return elastic Organization To Azure Subscription Mapping details for the logged-in user along with - * {@link Response} on successful completion of {@link Mono}. + * @return monitor resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - getElasticToAzureSubscriptionMappingWithResponseAsync() { + private Mono>> resubscribeWithResponseAsync(String resourceGroupName, String monitorName, + ResubscribeProperties body) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -205,79 +339,270 @@ public UserApiKeyResponseInner getApiKey() { return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getElasticToAzureSubscriptionMapping(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .withContext(context -> service.resubscribe(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + * Resubscribe the Elasticsearch Organization. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return elastic Organization To Azure Subscription Mapping details for the logged-in user along with - * {@link Response} on successful completion of {@link Mono}. + * @return monitor resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - getElasticToAzureSubscriptionMappingWithResponseAsync(Context context) { + private Response resubscribeWithResponse(String resourceGroupName, String monitorName, + ResubscribeProperties body) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getElasticToAzureSubscriptionMapping(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context); + return service.resubscribeSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, Context.NONE); } /** - * Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + * Resubscribe the Elasticsearch Organization. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return elastic Organization To Azure Subscription Mapping details for the logged-in user on successful - * completion of {@link Mono}. + * @return monitor resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono - getElasticToAzureSubscriptionMappingAsync() { - return getElasticToAzureSubscriptionMappingWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Response resubscribeWithResponse(String resourceGroupName, String monitorName, + ResubscribeProperties body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return service.resubscribeSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, context); } /** - * Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + * Resubscribe the Elasticsearch Organization. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ElasticMonitorResourceInner> + beginResubscribeAsync(String resourceGroupName, String monitorName, ResubscribeProperties body) { + Mono>> mono = resubscribeWithResponseAsync(resourceGroupName, monitorName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, + this.client.getContext()); + } + + /** + * Resubscribe the Elasticsearch Organization. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ElasticMonitorResourceInner> + beginResubscribeAsync(String resourceGroupName, String monitorName) { + final ResubscribeProperties body = null; + Mono>> mono = resubscribeWithResponseAsync(resourceGroupName, monitorName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, + this.client.getContext()); + } + + /** + * Resubscribe the Elasticsearch Organization. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ElasticMonitorResourceInner> + beginResubscribe(String resourceGroupName, String monitorName, ResubscribeProperties body) { + Response response = resubscribeWithResponse(resourceGroupName, monitorName, body); + return this.client.getLroResult(response, + ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, Context.NONE); + } + + /** + * Resubscribe the Elasticsearch Organization. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ElasticMonitorResourceInner> + beginResubscribe(String resourceGroupName, String monitorName) { + final ResubscribeProperties body = null; + Response response = resubscribeWithResponse(resourceGroupName, monitorName, body); + return this.client.getLroResult(response, + ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, Context.NONE); + } + + /** + * Resubscribe the Elasticsearch Organization. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return elastic Organization To Azure Subscription Mapping details for the logged-in user along with - * {@link Response}. + * @return the {@link SyncPoller} for polling of monitor resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ElasticMonitorResourceInner> + beginResubscribe(String resourceGroupName, String monitorName, ResubscribeProperties body, Context context) { + Response response = resubscribeWithResponse(resourceGroupName, monitorName, body, context); + return this.client.getLroResult(response, + ElasticMonitorResourceInner.class, ElasticMonitorResourceInner.class, context); + } + + /** + * Resubscribe the Elasticsearch Organization. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response - getElasticToAzureSubscriptionMappingWithResponse(Context context) { - return getElasticToAzureSubscriptionMappingWithResponseAsync(context).block(); + private Mono resubscribeAsync(String resourceGroupName, String monitorName, + ResubscribeProperties body) { + return beginResubscribeAsync(resourceGroupName, monitorName, body).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + * Resubscribe the Elasticsearch Organization. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return elastic Organization To Azure Subscription Mapping details for the logged-in user. + * @return monitor resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ElasticOrganizationToAzureSubscriptionMappingResponseInner getElasticToAzureSubscriptionMapping() { - return getElasticToAzureSubscriptionMappingWithResponse(Context.NONE).getValue(); + private Mono resubscribeAsync(String resourceGroupName, String monitorName) { + final ResubscribeProperties body = null; + return beginResubscribeAsync(resourceGroupName, monitorName, body).last() + .flatMap(this.client::getLroFinalResultOrError); } + + /** + * Resubscribe the Elasticsearch Organization. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticMonitorResourceInner resubscribe(String resourceGroupName, String monitorName) { + final ResubscribeProperties body = null; + return beginResubscribe(resourceGroupName, monitorName, body).getFinalResult(); + } + + /** + * Resubscribe the Elasticsearch Organization. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticMonitorResourceInner resubscribe(String resourceGroupName, String monitorName, + ResubscribeProperties body, Context context) { + return beginResubscribe(resourceGroupName, monitorName, body, context).getFinalResult(); + } + + private static final ClientLogger LOGGER = new ClientLogger(OrganizationsClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OrganizationsImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OrganizationsImpl.java index c705674dd071..416e90799b45 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OrganizationsImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OrganizationsImpl.java @@ -9,10 +9,13 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.OrganizationsClient; +import com.azure.resourcemanager.elastic.fluent.models.ElasticMonitorResourceInner; import com.azure.resourcemanager.elastic.fluent.models.ElasticOrganizationToAzureSubscriptionMappingResponseInner; import com.azure.resourcemanager.elastic.fluent.models.UserApiKeyResponseInner; +import com.azure.resourcemanager.elastic.models.ElasticMonitorResource; import com.azure.resourcemanager.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse; import com.azure.resourcemanager.elastic.models.Organizations; +import com.azure.resourcemanager.elastic.models.ResubscribeProperties; import com.azure.resourcemanager.elastic.models.UserApiKeyResponse; import com.azure.resourcemanager.elastic.models.UserEmailId; @@ -29,6 +32,28 @@ public OrganizationsImpl(OrganizationsClient innerClient, this.serviceManager = serviceManager; } + public Response + getElasticToAzureSubscriptionMappingWithResponse(Context context) { + Response inner + = this.serviceClient().getElasticToAzureSubscriptionMappingWithResponse(context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ElasticOrganizationToAzureSubscriptionMappingResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ElasticOrganizationToAzureSubscriptionMappingResponse getElasticToAzureSubscriptionMapping() { + ElasticOrganizationToAzureSubscriptionMappingResponseInner inner + = this.serviceClient().getElasticToAzureSubscriptionMapping(); + if (inner != null) { + return new ElasticOrganizationToAzureSubscriptionMappingResponseImpl(inner, this.manager()); + } else { + return null; + } + } + public Response getApiKeyWithResponse(UserEmailId body, Context context) { Response inner = this.serviceClient().getApiKeyWithResponse(body, context); if (inner != null) { @@ -39,8 +64,8 @@ public Response getApiKeyWithResponse(UserEmailId body, Cont } } - public UserApiKeyResponse getApiKey() { - UserApiKeyResponseInner inner = this.serviceClient().getApiKey(); + public UserApiKeyResponse getApiKey(UserEmailId body) { + UserApiKeyResponseInner inner = this.serviceClient().getApiKey(body); if (inner != null) { return new UserApiKeyResponseImpl(inner, this.manager()); } else { @@ -48,23 +73,21 @@ public UserApiKeyResponse getApiKey() { } } - public Response - getElasticToAzureSubscriptionMappingWithResponse(Context context) { - Response inner - = this.serviceClient().getElasticToAzureSubscriptionMappingWithResponse(context); + public ElasticMonitorResource resubscribe(String resourceGroupName, String monitorName) { + ElasticMonitorResourceInner inner = this.serviceClient().resubscribe(resourceGroupName, monitorName); if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ElasticOrganizationToAzureSubscriptionMappingResponseImpl(inner.getValue(), this.manager())); + return new ElasticMonitorResourceImpl(inner, this.manager()); } else { return null; } } - public ElasticOrganizationToAzureSubscriptionMappingResponse getElasticToAzureSubscriptionMapping() { - ElasticOrganizationToAzureSubscriptionMappingResponseInner inner - = this.serviceClient().getElasticToAzureSubscriptionMapping(); + public ElasticMonitorResource resubscribe(String resourceGroupName, String monitorName, ResubscribeProperties body, + Context context) { + ElasticMonitorResourceInner inner + = this.serviceClient().resubscribe(resourceGroupName, monitorName, body, context); if (inner != null) { - return new ElasticOrganizationToAzureSubscriptionMappingResponseImpl(inner, this.manager()); + return new ElasticMonitorResourceImpl(inner, this.manager()); } else { return null; } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TagRulesClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TagRulesClientImpl.java index 11cbc400806f..ea4ff772cbe7 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TagRulesClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TagRulesClientImpl.java @@ -27,8 +27,10 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.elastic.fluent.TagRulesClient; @@ -79,13 +81,12 @@ Mono> list(@HostParam("$host") String e @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, + Response listSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, - @PathParam("ruleSetName") String ruleSetName, @BodyParam("application/json") MonitoringTagRulesInner body, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -97,6 +98,35 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @PathParam("ruleSetName") String ruleSetName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, @BodyParam("application/json") MonitoringTagRulesInner body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, @BodyParam("application/json") MonitoringTagRulesInner body, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}") @ExpectedResponses({ 200, 202, 204 }) @@ -106,6 +136,15 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @PathParam("ruleSetName") String ruleSetName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -113,6 +152,14 @@ Mono>> delete(@HostParam("$host") String endpoint, Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -157,37 +204,15 @@ private Mono> listSinglePageAsync(String * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, - String monitorName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -198,12 +223,34 @@ private Mono> listSinglePageAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String monitorName) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), - nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -215,13 +262,35 @@ private PagedFlux listAsync(String resourceGroupName, S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String monitorName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String monitorName, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -236,7 +305,8 @@ private PagedFlux listAsync(String resourceGroupName, S */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String monitorName) { - return new PagedIterable<>(listAsync(resourceGroupName, monitorName)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName), + nextLink -> listNextSinglePage(nextLink)); } /** @@ -252,25 +322,25 @@ public PagedIterable list(String resourceGroupName, Str */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String monitorName, Context context) { - return new PagedIterable<>(listAsync(resourceGroupName, monitorName, context)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** - * Create or update a tag rule set for a given monitor resource. + * Get a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. - * @param body request body of MonitoringTagRules. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return capture logs and metrics of Azure resources based on ARM tags along with {@link Response} on successful - * completion of {@link Mono}. + * @return a tag rule set for a given monitor resource along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String monitorName, String ruleSetName, MonitoringTagRulesInner body) { + private Mono> getWithResponseAsync(String resourceGroupName, String monitorName, + String ruleSetName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -289,62 +359,15 @@ private Mono> createOrUpdateWithResponseAsync( if (ruleSetName == null) { return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); } - if (body != null) { - body.validate(); - } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, monitorName, ruleSetName, body, accept, context)) + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, ruleSetName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Create or update a tag rule set for a given monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param ruleSetName Tag Rule Set resource name. - * @param body request body of MonitoringTagRules. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return capture logs and metrics of Azure resources based on ARM tags along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String monitorName, String ruleSetName, MonitoringTagRulesInner body, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - if (ruleSetName == null) { - return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); - } - if (body != null) { - body.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, monitorName, ruleSetName, body, accept, context); - } - - /** - * Create or update a tag rule set for a given monitor resource. + * Get a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. @@ -352,37 +375,58 @@ private Mono> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return capture logs and metrics of Azure resources based on ARM tags on successful completion of {@link Mono}. + * @return a tag rule set for a given monitor resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String monitorName, - String ruleSetName) { - final MonitoringTagRulesInner body = null; - return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, body) + private Mono getAsync(String resourceGroupName, String monitorName, String ruleSetName) { + return getWithResponseAsync(resourceGroupName, monitorName, ruleSetName) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Create or update a tag rule set for a given monitor resource. + * Get a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. - * @param body request body of MonitoringTagRules. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return capture logs and metrics of Azure resources based on ARM tags along with {@link Response}. + * @return a tag rule set for a given monitor resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(String resourceGroupName, String monitorName, - String ruleSetName, MonitoringTagRulesInner body, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, body, context).block(); + public Response getWithResponse(String resourceGroupName, String monitorName, + String ruleSetName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, monitorName, ruleSetName, accept, context); } /** - * Create or update a tag rule set for a given monitor resource. + * Get a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. @@ -390,29 +434,29 @@ public Response createOrUpdateWithResponse(String resou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return capture logs and metrics of Azure resources based on ARM tags. + * @return a tag rule set for a given monitor resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public MonitoringTagRulesInner createOrUpdate(String resourceGroupName, String monitorName, String ruleSetName) { - final MonitoringTagRulesInner body = null; - return createOrUpdateWithResponse(resourceGroupName, monitorName, ruleSetName, body, Context.NONE).getValue(); + public MonitoringTagRulesInner get(String resourceGroupName, String monitorName, String ruleSetName) { + return getWithResponse(resourceGroupName, monitorName, ruleSetName, Context.NONE).getValue(); } /** - * Get a tag rule set for a given monitor resource. + * Create or update a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a tag rule set for a given monitor resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return capture logs and metrics of Azure resources based on ARM tags along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String monitorName, - String ruleSetName) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String monitorName, String ruleSetName, MonitoringTagRulesInner body) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -431,102 +475,101 @@ private Mono> getWithResponseAsync(String reso if (ruleSetName == null) { return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, monitorName, ruleSetName, accept, context)) + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, ruleSetName, body, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get a tag rule set for a given monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param ruleSetName Tag Rule Set resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a tag rule set for a given monitor resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String monitorName, - String ruleSetName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - if (ruleSetName == null) { - return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, ruleSetName, accept, context); - } - - /** - * Get a tag rule set for a given monitor resource. + * Create or update a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a tag rule set for a given monitor resource on successful completion of {@link Mono}. + * @return capture logs and metrics of Azure resources based on ARM tags on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String monitorName, String ruleSetName) { - return getWithResponseAsync(resourceGroupName, monitorName, ruleSetName) + private Mono createOrUpdateAsync(String resourceGroupName, String monitorName, + String ruleSetName, MonitoringTagRulesInner body) { + return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, body) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Get a tag rule set for a given monitor resource. + * Create or update a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a tag rule set for a given monitor resource along with {@link Response}. + * @return capture logs and metrics of Azure resources based on ARM tags along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String monitorName, - String ruleSetName, Context context) { - return getWithResponseAsync(resourceGroupName, monitorName, ruleSetName, context).block(); + public Response createOrUpdateWithResponse(String resourceGroupName, String monitorName, + String ruleSetName, MonitoringTagRulesInner body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, ruleSetName, body, accept, context); } /** - * Get a tag rule set for a given monitor resource. + * Create or update a tag rule set for a given monitor resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a tag rule set for a given monitor resource. + * @return capture logs and metrics of Azure resources based on ARM tags. */ @ServiceMethod(returns = ReturnType.SINGLE) - public MonitoringTagRulesInner get(String resourceGroupName, String monitorName, String ruleSetName) { - return getWithResponse(resourceGroupName, monitorName, ruleSetName, Context.NONE).getValue(); + public MonitoringTagRulesInner createOrUpdate(String resourceGroupName, String monitorName, String ruleSetName, + MonitoringTagRulesInner body) { + return createOrUpdateWithResponse(resourceGroupName, monitorName, ruleSetName, body, Context.NONE).getValue(); } /** @@ -574,37 +617,38 @@ private Mono>> deleteWithResponseAsync(String resource * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String monitorName, - String ruleSetName, Context context) { + private Response deleteWithResponse(String resourceGroupName, String monitorName, String ruleSetName) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); } if (ruleSetName == null) { - return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, ruleSetName, accept, context); + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, ruleSetName, accept, Context.NONE); } /** @@ -613,17 +657,40 @@ private Mono>> deleteWithResponseAsync(String resource * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String monitorName, - String ruleSetName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String monitorName, String ruleSetName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, ruleSetName, accept, context); } /** @@ -632,7 +699,6 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. * @param ruleSetName Tag Rule Set resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -640,12 +706,10 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String monitorName, - String ruleSetName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName, context); + String ruleSetName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -662,7 +726,8 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, String ruleSetName) { - return this.beginDeleteAsync(resourceGroupName, monitorName, ruleSetName).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, monitorName, ruleSetName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -680,7 +745,8 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, String ruleSetName, Context context) { - return this.beginDeleteAsync(resourceGroupName, monitorName, ruleSetName, context).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, monitorName, ruleSetName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -700,24 +766,6 @@ private Mono deleteAsync(String resourceGroupName, String monitorName, Str .flatMap(this.client::getLroFinalResultOrError); } - /** - * Delete a tag rule set for a given monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param ruleSetName Tag Rule Set resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String monitorName, String ruleSetName, Context context) { - return beginDeleteAsync(resourceGroupName, monitorName, ruleSetName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Delete a tag rule set for a given monitor resource. * @@ -730,7 +778,7 @@ private Mono deleteAsync(String resourceGroupName, String monitorName, Str */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String monitorName, String ruleSetName) { - deleteAsync(resourceGroupName, monitorName, ruleSetName).block(); + beginDelete(resourceGroupName, monitorName, ruleSetName).getFinalResult(); } /** @@ -746,7 +794,7 @@ public void delete(String resourceGroupName, String monitorName, String ruleSetN */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String monitorName, String ruleSetName, Context context) { - deleteAsync(resourceGroupName, monitorName, ruleSetName, context).block(); + beginDelete(resourceGroupName, monitorName, ruleSetName, context).getFinalResult(); } /** @@ -774,6 +822,33 @@ private Mono> listNextSinglePageAsync(Str .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -782,21 +857,25 @@ private Mono> listNextSinglePageAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(TagRulesClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TrafficFiltersClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TrafficFiltersClientImpl.java index b368eb32d561..5f597290dd60 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TrafficFiltersClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TrafficFiltersClientImpl.java @@ -21,6 +21,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.TrafficFiltersClient; import reactor.core.publisher.Mono; @@ -64,6 +65,15 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @QueryParam("rulesetId") String rulesetId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/deleteTrafficFilter") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @QueryParam("rulesetId") String rulesetId, @HeaderParam("Accept") String accept, Context context); } /** @@ -102,42 +112,6 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Delete traffic filter from the account. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param rulesetId Ruleset Id of the filter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String monitorName, String rulesetId, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, rulesetId, accept, context); - } - /** * Delete traffic filter from the account. * @@ -169,7 +143,27 @@ private Mono deleteAsync(String resourceGroupName, String monitorName) { @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceGroupName, String monitorName, String rulesetId, Context context) { - return deleteWithResponseAsync(resourceGroupName, monitorName, rulesetId, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, rulesetId, accept, context); } /** @@ -186,4 +180,6 @@ public void delete(String resourceGroupName, String monitorName) { final String rulesetId = null; deleteWithResponse(resourceGroupName, monitorName, rulesetId, Context.NONE); } + + private static final ClientLogger LOGGER = new ClientLogger(TrafficFiltersClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/UpgradableVersionsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/UpgradableVersionsClientImpl.java index 0f8924680d1d..7124bba17f61 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/UpgradableVersionsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/UpgradableVersionsClientImpl.java @@ -21,6 +21,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.UpgradableVersionsClient; import com.azure.resourcemanager.elastic.fluent.models.UpgradableVersionsListInner; import reactor.core.publisher.Mono; @@ -65,6 +66,15 @@ Mono> details(@HostParam("$host") String e @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listUpgradableVersions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response detailsSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); } /** @@ -103,42 +113,6 @@ private Mono> detailsWithResponseAsync(Str .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * List of upgradable versions for a given monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stack Versions that this version can upgrade to along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> detailsWithResponseAsync(String resourceGroupName, - String monitorName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.details(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context); - } - /** * List of upgradable versions for a given monitor resource. * @@ -169,7 +143,27 @@ private Mono detailsAsync(String resourceGroupName, @ServiceMethod(returns = ReturnType.SINGLE) public Response detailsWithResponse(String resourceGroupName, String monitorName, Context context) { - return detailsWithResponseAsync(resourceGroupName, monitorName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.detailsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, accept, context); } /** @@ -186,4 +180,6 @@ public Response detailsWithResponse(String resource public UpgradableVersionsListInner details(String resourceGroupName, String monitorName) { return detailsWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(UpgradableVersionsClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMCollectionsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMCollectionsClientImpl.java index 98be7af34521..637956386a50 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMCollectionsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMCollectionsClientImpl.java @@ -22,6 +22,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.VMCollectionsClient; import com.azure.resourcemanager.elastic.models.VMCollectionUpdate; import reactor.core.publisher.Mono; @@ -67,6 +68,16 @@ Mono> update(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @BodyParam("application/json") VMCollectionUpdate body, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmCollectionUpdate") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @BodyParam("application/json") VMCollectionUpdate body, @HeaderParam("Accept") String accept, + Context context); } /** @@ -108,45 +119,6 @@ private Mono> updateWithResponseAsync(String resourceGroupName, S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Update the vm details that will be monitored by the Elastic monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param body VM resource Id. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, String monitorName, - VMCollectionUpdate body, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - if (body != null) { - body.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, body, accept, context); - } - /** * Update the vm details that will be monitored by the Elastic monitor resource. * @@ -178,7 +150,30 @@ private Mono updateAsync(String resourceGroupName, String monitorName) { @ServiceMethod(returns = ReturnType.SINGLE) public Response updateWithResponse(String resourceGroupName, String monitorName, VMCollectionUpdate body, Context context) { - return updateWithResponseAsync(resourceGroupName, monitorName, body, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, body, accept, context); } /** @@ -195,4 +190,6 @@ public void update(String resourceGroupName, String monitorName) { final VMCollectionUpdate body = null; updateWithResponse(resourceGroupName, monitorName, body, Context.NONE); } + + private static final ClientLogger LOGGER = new ClientLogger(VMCollectionsClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMHostsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMHostsClientImpl.java index 36cfb6492cc2..01fb50da9202 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMHostsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMHostsClientImpl.java @@ -26,6 +26,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.VMHostsClient; import com.azure.resourcemanager.elastic.fluent.models.VMResourcesInner; import com.azure.resourcemanager.elastic.models.VMHostListResponse; @@ -71,12 +72,28 @@ Mono> list(@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listVMHost") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -120,37 +137,15 @@ private Mono> listSinglePageAsync(String resourc * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, String monitorName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -161,12 +156,33 @@ private Mono> listSinglePageAsync(String resourc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String monitorName) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName), - nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -178,12 +194,34 @@ private PagedFlux listAsync(String resourceGroupName, String m * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation as paginated response with {@link PagedFlux}. + * @return response of a list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String monitorName, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, monitorName, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String monitorName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -198,7 +236,8 @@ private PagedFlux listAsync(String resourceGroupName, String m */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String monitorName) { - return new PagedIterable<>(listAsync(resourceGroupName, monitorName)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName), + nextLink -> listNextSinglePage(nextLink)); } /** @@ -214,7 +253,8 @@ public PagedIterable list(String resourceGroupName, String mon */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String monitorName, Context context) { - return new PagedIterable<>(listAsync(resourceGroupName, monitorName, context)); + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, monitorName, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -242,6 +282,33 @@ private Mono> listNextSinglePageAsync(String nex .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -250,21 +317,24 @@ private Mono> listNextSinglePageAsync(String nex * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response of a list operation along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return response of a list operation along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(VMHostsClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMIngestionsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMIngestionsClientImpl.java index 49efdbc0ba8d..5a85403517ad 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMIngestionsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/VMIngestionsClientImpl.java @@ -21,6 +21,7 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.VMIngestionsClient; import com.azure.resourcemanager.elastic.fluent.models.VMIngestionDetailsResponseInner; import reactor.core.publisher.Mono; @@ -65,6 +66,15 @@ Mono> details(@HostParam("$host") Stri @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/vmIngestionDetails") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response detailsSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, Context context); } /** @@ -103,42 +113,6 @@ private Mono> detailsWithResponseAsync .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * List the vm ingestion details that will be monitored by the Elastic monitor resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param monitorName Monitor resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the vm ingestion details to install an agent along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> detailsWithResponseAsync(String resourceGroupName, - String monitorName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (monitorName == null) { - return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.details(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, monitorName, accept, context); - } - /** * List the vm ingestion details that will be monitored by the Elastic monitor resource. * @@ -169,7 +143,27 @@ private Mono detailsAsync(String resourceGroupN @ServiceMethod(returns = ReturnType.SINGLE) public Response detailsWithResponse(String resourceGroupName, String monitorName, Context context) { - return detailsWithResponseAsync(resourceGroupName, monitorName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.detailsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, monitorName, accept, context); } /** @@ -186,4 +180,6 @@ public Response detailsWithResponse(String reso public VMIngestionDetailsResponseInner details(String resourceGroupName, String monitorName) { return detailsWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(VMIngestionsClientImpl.class); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConfigurationType.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConfigurationType.java new file mode 100644 index 000000000000..df28c8b7f752 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConfigurationType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Configuration type of the Elasticsearch project. + */ +public final class ConfigurationType extends ExpandableStringEnum { + /** + * Static value GeneralPurpose for ConfigurationType. + */ + public static final ConfigurationType GENERAL_PURPOSE = fromString("GeneralPurpose"); + + /** + * Static value Vector for ConfigurationType. + */ + public static final ConfigurationType VECTOR = fromString("Vector"); + + /** + * Static value TimeSeries for ConfigurationType. + */ + public static final ConfigurationType TIME_SERIES = fromString("TimeSeries"); + + /** + * Static value NotApplicable for ConfigurationType. + */ + public static final ConfigurationType NOT_APPLICABLE = fromString("NotApplicable"); + + /** + * Creates a new instance of ConfigurationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConfigurationType() { + } + + /** + * Creates or finds a ConfigurationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConfigurationType. + */ + public static ConfigurationType fromString(String name) { + return fromString(name, ConfigurationType.class); + } + + /** + * Gets known ConfigurationType values. + * + * @return known ConfigurationType values. + */ + public static Collection values() { + return values(ConfigurationType.class); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConnectedPartnerResourceProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConnectedPartnerResourceProperties.java index 9d4b1f39dfec..4d5704b7c2da 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConnectedPartnerResourceProperties.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConnectedPartnerResourceProperties.java @@ -17,25 +17,30 @@ @Fluent public final class ConnectedPartnerResourceProperties implements JsonSerializable { /* - * Elastic deployment name + * Elastic resource name */ private String partnerDeploymentName; /* - * Deployment URL of the elasticsearch in Elastic cloud deployment. + * URL of the resource in Elastic cloud. */ private String partnerDeploymentUri; /* - * The azure resource Id of the deployment. + * The azure resource Id of the resource. */ private String azureResourceId; /* - * The location of the deployment. + * The location of the resource. */ private String location; + /* + * The hosting type of the resource. + */ + private String type; + /** * Creates an instance of ConnectedPartnerResourceProperties class. */ @@ -43,7 +48,7 @@ public ConnectedPartnerResourceProperties() { } /** - * Get the partnerDeploymentName property: Elastic deployment name. + * Get the partnerDeploymentName property: Elastic resource name. * * @return the partnerDeploymentName value. */ @@ -52,7 +57,7 @@ public String partnerDeploymentName() { } /** - * Set the partnerDeploymentName property: Elastic deployment name. + * Set the partnerDeploymentName property: Elastic resource name. * * @param partnerDeploymentName the partnerDeploymentName value to set. * @return the ConnectedPartnerResourceProperties object itself. @@ -63,7 +68,7 @@ public ConnectedPartnerResourceProperties withPartnerDeploymentName(String partn } /** - * Get the partnerDeploymentUri property: Deployment URL of the elasticsearch in Elastic cloud deployment. + * Get the partnerDeploymentUri property: URL of the resource in Elastic cloud. * * @return the partnerDeploymentUri value. */ @@ -72,7 +77,7 @@ public String partnerDeploymentUri() { } /** - * Set the partnerDeploymentUri property: Deployment URL of the elasticsearch in Elastic cloud deployment. + * Set the partnerDeploymentUri property: URL of the resource in Elastic cloud. * * @param partnerDeploymentUri the partnerDeploymentUri value to set. * @return the ConnectedPartnerResourceProperties object itself. @@ -83,7 +88,7 @@ public ConnectedPartnerResourceProperties withPartnerDeploymentUri(String partne } /** - * Get the azureResourceId property: The azure resource Id of the deployment. + * Get the azureResourceId property: The azure resource Id of the resource. * * @return the azureResourceId value. */ @@ -92,7 +97,7 @@ public String azureResourceId() { } /** - * Set the azureResourceId property: The azure resource Id of the deployment. + * Set the azureResourceId property: The azure resource Id of the resource. * * @param azureResourceId the azureResourceId value to set. * @return the ConnectedPartnerResourceProperties object itself. @@ -103,7 +108,7 @@ public ConnectedPartnerResourceProperties withAzureResourceId(String azureResour } /** - * Get the location property: The location of the deployment. + * Get the location property: The location of the resource. * * @return the location value. */ @@ -112,7 +117,7 @@ public String location() { } /** - * Set the location property: The location of the deployment. + * Set the location property: The location of the resource. * * @param location the location value to set. * @return the ConnectedPartnerResourceProperties object itself. @@ -122,6 +127,26 @@ public ConnectedPartnerResourceProperties withLocation(String location) { return this; } + /** + * Get the type property: The hosting type of the resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The hosting type of the resource. + * + * @param type the type value to set. + * @return the ConnectedPartnerResourceProperties object itself. + */ + public ConnectedPartnerResourceProperties withType(String type) { + this.type = type; + return this; + } + /** * Validates the instance. * @@ -140,6 +165,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("partnerDeploymentUri", this.partnerDeploymentUri); jsonWriter.writeStringField("azureResourceId", this.azureResourceId); jsonWriter.writeStringField("location", this.location); + jsonWriter.writeStringField("type", this.type); return jsonWriter.writeEndObject(); } @@ -167,6 +193,8 @@ public static ConnectedPartnerResourceProperties fromJson(JsonReader jsonReader) deserializedConnectedPartnerResourceProperties.azureResourceId = reader.getString(); } else if ("location".equals(fieldName)) { deserializedConnectedPartnerResourceProperties.location = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedConnectedPartnerResourceProperties.type = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConnectedPartnerResourcesListResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConnectedPartnerResourcesListResponse.java index 94ca34021c27..5d54eb171562 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConnectedPartnerResourcesListResponse.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ConnectedPartnerResourcesListResponse.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.elastic.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -20,12 +21,12 @@ public final class ConnectedPartnerResourcesListResponse implements JsonSerializable { /* - * Results of a list operation. + * The ConnectedPartnerResourcesListFormat items on this page */ private List value; /* - * Link to the next set of results, if any. + * The link to the next page of items */ private String nextLink; @@ -36,7 +37,7 @@ public ConnectedPartnerResourcesListResponse() { } /** - * Get the value property: Results of a list operation. + * Get the value property: The ConnectedPartnerResourcesListFormat items on this page. * * @return the value value. */ @@ -45,7 +46,7 @@ public List value() { } /** - * Set the value property: Results of a list operation. + * Set the value property: The ConnectedPartnerResourcesListFormat items on this page. * * @param value the value value to set. * @return the ConnectedPartnerResourcesListResponse object itself. @@ -56,7 +57,7 @@ public ConnectedPartnerResourcesListResponse withValue(List e.validate()); } } + private static final ClientLogger LOGGER = new ClientLogger(ConnectedPartnerResourcesListResponse.class); + /** * {@inheritDoc} */ @@ -103,6 +110,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of ConnectedPartnerResourcesListResponse if the JsonReader was pointing to an instance of it, * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the ConnectedPartnerResourcesListResponse. */ public static ConnectedPartnerResourcesListResponse fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/DeploymentInfoResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/DeploymentInfoResponse.java index f128b08ad037..8582dc5af2e3 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/DeploymentInfoResponse.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/DeploymentInfoResponse.java @@ -60,6 +60,20 @@ public interface DeploymentInfoResponse { */ MarketplaceSaaSInfo marketplaceSaasInfo(); + /** + * Gets the projectType property: Project Type - Applicable for Serverless only. + * + * @return the projectType value. + */ + String projectType(); + + /** + * Gets the configurationType property: ConfigurationType Type - Applicable for Serverless only. + * + * @return the configurationType value. + */ + String configurationType(); + /** * Gets the inner com.azure.resourcemanager.elastic.fluent.models.DeploymentInfoResponseInner object. * diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResource.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResource.java index fcdd0983c089..967996ccf6f4 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResource.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResource.java @@ -50,18 +50,25 @@ public interface ElasticMonitorResource { Map tags(); /** - * Gets the sku property: SKU of the monitor resource. + * Gets the properties property: Properties of the monitor resource. * - * @return the sku value. + * @return the properties value. */ - ResourceSku sku(); + MonitorProperties properties(); /** - * Gets the properties property: Properties of the monitor resource. + * Gets the kind property: The kind of the Elastic resource - observability, security, search etc. * - * @return the properties value. + * @return the kind value. */ - MonitorProperties properties(); + String kind(); + + /** + * Gets the sku property: SKU of the monitor resource. + * + * @return the sku value. + */ + ResourceSku sku(); /** * Gets the identity property: Identity properties of the monitor resource. @@ -71,7 +78,7 @@ public interface ElasticMonitorResource { IdentityProperties identity(); /** - * Gets the systemData property: The system metadata relating to this resource. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ @@ -160,8 +167,8 @@ interface WithResourceGroup { * The stage of the ElasticMonitorResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithSku, - DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties, + DefinitionStages.WithKind, DefinitionStages.WithSku, DefinitionStages.WithIdentity { /** * Executes the create request. * @@ -192,29 +199,42 @@ interface WithTags { } /** - * The stage of the ElasticMonitorResource definition allowing to specify sku. + * The stage of the ElasticMonitorResource definition allowing to specify properties. */ - interface WithSku { + interface WithProperties { /** - * Specifies the sku property: SKU of the monitor resource.. + * Specifies the properties property: Properties of the monitor resource.. * - * @param sku SKU of the monitor resource. + * @param properties Properties of the monitor resource. * @return the next definition stage. */ - WithCreate withSku(ResourceSku sku); + WithCreate withProperties(MonitorProperties properties); } /** - * The stage of the ElasticMonitorResource definition allowing to specify properties. + * The stage of the ElasticMonitorResource definition allowing to specify kind. */ - interface WithProperties { + interface WithKind { /** - * Specifies the properties property: Properties of the monitor resource.. + * Specifies the kind property: The kind of the Elastic resource - observability, security, search etc.. * - * @param properties Properties of the monitor resource. + * @param kind The kind of the Elastic resource - observability, security, search etc. * @return the next definition stage. */ - WithCreate withProperties(MonitorProperties properties); + WithCreate withKind(String kind); + } + + /** + * The stage of the ElasticMonitorResource definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: SKU of the monitor resource.. + * + * @param sku SKU of the monitor resource. + * @return the next definition stage. + */ + WithCreate withSku(ResourceSku sku); } /** diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResourceListResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResourceListResponse.java index f9c7b84e6a20..3aa49da3bacb 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResourceListResponse.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResourceListResponse.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.elastic.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -19,12 +20,12 @@ @Fluent public final class ElasticMonitorResourceListResponse implements JsonSerializable { /* - * Results of a list operation. + * The ElasticMonitorResource items on this page */ private List value; /* - * Link to the next set of results, if any. + * The link to the next page of items */ private String nextLink; @@ -35,7 +36,7 @@ public ElasticMonitorResourceListResponse() { } /** - * Get the value property: Results of a list operation. + * Get the value property: The ElasticMonitorResource items on this page. * * @return the value value. */ @@ -44,7 +45,7 @@ public List value() { } /** - * Set the value property: Results of a list operation. + * Set the value property: The ElasticMonitorResource items on this page. * * @param value the value value to set. * @return the ElasticMonitorResourceListResponse object itself. @@ -55,7 +56,7 @@ public ElasticMonitorResourceListResponse withValue(List e.validate()); } } + private static final ClientLogger LOGGER = new ClientLogger(ElasticMonitorResourceListResponse.class); + /** * {@inheritDoc} */ @@ -102,6 +109,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of ElasticMonitorResourceListResponse if the JsonReader was pointing to an instance of it, or * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the ElasticMonitorResourceListResponse. */ public static ElasticMonitorResourceListResponse fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionsListResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionsListResponse.java index edb46a4cc1fc..c53425d92204 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionsListResponse.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionsListResponse.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.elastic.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -19,12 +20,12 @@ @Fluent public final class ElasticVersionsListResponse implements JsonSerializable { /* - * Results of a list operation. + * The ElasticVersionListFormat items on this page */ private List value; /* - * Link to the next set of results, if any. + * The link to the next page of items */ private String nextLink; @@ -35,7 +36,7 @@ public ElasticVersionsListResponse() { } /** - * Get the value property: Results of a list operation. + * Get the value property: The ElasticVersionListFormat items on this page. * * @return the value value. */ @@ -44,7 +45,7 @@ public List value() { } /** - * Set the value property: Results of a list operation. + * Set the value property: The ElasticVersionListFormat items on this page. * * @param value the value value to set. * @return the ElasticVersionsListResponse object itself. @@ -55,7 +56,7 @@ public ElasticVersionsListResponse withValue(List } /** - * Get the nextLink property: Link to the next set of results, if any. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -64,7 +65,7 @@ public String nextLink() { } /** - * Set the nextLink property: Link to the next set of results, if any. + * Set the nextLink property: The link to the next page of items. * * @param nextLink the nextLink value to set. * @return the ElasticVersionsListResponse object itself. @@ -80,11 +81,17 @@ public ElasticVersionsListResponse withNextLink(String nextLink) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model ElasticVersionsListResponse")); + } else { value().forEach(e -> e.validate()); } } + private static final ClientLogger LOGGER = new ClientLogger(ElasticVersionsListResponse.class); + /** * {@inheritDoc} */ @@ -102,6 +109,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of ElasticVersionsListResponse if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the ElasticVersionsListResponse. */ public static ElasticVersionsListResponse fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/HostingType.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/HostingType.java new file mode 100644 index 000000000000..e080e266d456 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/HostingType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Hosting type of the monitor resource - either Hosted deployments or Serverless Projects. + */ +public final class HostingType extends ExpandableStringEnum { + /** + * Static value Hosted for HostingType. + */ + public static final HostingType HOSTED = fromString("Hosted"); + + /** + * Static value Serverless for HostingType. + */ + public static final HostingType SERVERLESS = fromString("Serverless"); + + /** + * Creates a new instance of HostingType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HostingType() { + } + + /** + * Creates or finds a HostingType from its string representation. + * + * @param name a name to look for. + * @return the corresponding HostingType. + */ + public static HostingType fromString(String name) { + return fromString(name, HostingType.class); + } + + /** + * Gets known HostingType values. + * + * @return known HostingType values. + */ + public static Collection values() { + return values(HostingType.class); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MarketplaceSaaSInfoMarketplaceSubscription.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MarketplaceSaaSInfoMarketplaceSubscription.java index 29a02908ecd4..2819c77f06f4 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MarketplaceSaaSInfoMarketplaceSubscription.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MarketplaceSaaSInfoMarketplaceSubscription.java @@ -22,6 +22,16 @@ public final class MarketplaceSaaSInfoMarketplaceSubscription */ private String id; + /* + * Publisher Id of the Marketplace offer. + */ + private String publisherId; + + /* + * Offer Id of the Marketplace offer, + */ + private String offerId; + /** * Creates an instance of MarketplaceSaaSInfoMarketplaceSubscription class. */ @@ -48,6 +58,46 @@ public MarketplaceSaaSInfoMarketplaceSubscription withId(String id) { return this; } + /** + * Get the publisherId property: Publisher Id of the Marketplace offer. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Set the publisherId property: Publisher Id of the Marketplace offer. + * + * @param publisherId the publisherId value to set. + * @return the MarketplaceSaaSInfoMarketplaceSubscription object itself. + */ + public MarketplaceSaaSInfoMarketplaceSubscription withPublisherId(String publisherId) { + this.publisherId = publisherId; + return this; + } + + /** + * Get the offerId property: Offer Id of the Marketplace offer,. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Set the offerId property: Offer Id of the Marketplace offer,. + * + * @param offerId the offerId value to set. + * @return the MarketplaceSaaSInfoMarketplaceSubscription object itself. + */ + public MarketplaceSaaSInfoMarketplaceSubscription withOfferId(String offerId) { + this.offerId = offerId; + return this; + } + /** * Validates the instance. * @@ -63,6 +113,8 @@ public void validate() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("publisherId", this.publisherId); + jsonWriter.writeStringField("offerId", this.offerId); return jsonWriter.writeEndObject(); } @@ -84,6 +136,10 @@ public static MarketplaceSaaSInfoMarketplaceSubscription fromJson(JsonReader jso if ("id".equals(fieldName)) { deserializedMarketplaceSaaSInfoMarketplaceSubscription.id = reader.getString(); + } else if ("publisherId".equals(fieldName)) { + deserializedMarketplaceSaaSInfoMarketplaceSubscription.publisherId = reader.getString(); + } else if ("offerId".equals(fieldName)) { + deserializedMarketplaceSaaSInfoMarketplaceSubscription.offerId = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitorProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitorProperties.java index ee57888d192f..e0de8c7dff48 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitorProperties.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitorProperties.java @@ -81,6 +81,16 @@ public final class MonitorProperties implements JsonSerializable { /* - * Results of a list operation. + * The MonitoredResource items on this page */ private List value; /* - * Link to the next set of results, if any. + * The link to the next page of items */ private String nextLink; @@ -35,7 +36,7 @@ public MonitoredResourceListResponse() { } /** - * Get the value property: Results of a list operation. + * Get the value property: The MonitoredResource items on this page. * * @return the value value. */ @@ -44,7 +45,7 @@ public List value() { } /** - * Set the value property: Results of a list operation. + * Set the value property: The MonitoredResource items on this page. * * @param value the value value to set. * @return the MonitoredResourceListResponse object itself. @@ -55,7 +56,7 @@ public MonitoredResourceListResponse withValue(List valu } /** - * Get the nextLink property: Link to the next set of results, if any. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -64,7 +65,7 @@ public String nextLink() { } /** - * Set the nextLink property: Link to the next set of results, if any. + * Set the nextLink property: The link to the next page of items. * * @param nextLink the nextLink value to set. * @return the MonitoredResourceListResponse object itself. @@ -80,11 +81,17 @@ public MonitoredResourceListResponse withNextLink(String nextLink) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model MonitoredResourceListResponse")); + } else { value().forEach(e -> e.validate()); } } + private static final ClientLogger LOGGER = new ClientLogger(MonitoredResourceListResponse.class); + /** * {@inheritDoc} */ @@ -102,6 +109,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of MonitoredResourceListResponse if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the MonitoredResourceListResponse. */ public static MonitoredResourceListResponse fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscription.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscription.java new file mode 100644 index 000000000000..97d03816e6f5 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscription.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The list of subscriptions and it's monitoring status by current Elastic monitor. + */ +@Fluent +public final class MonitoredSubscription implements JsonSerializable { + /* + * The subscriptionId to be monitored. + */ + private String subscriptionId; + + /* + * The state of monitoring. + */ + private Status status; + + /* + * The reason of not monitoring the subscription. + */ + private String error; + + /* + * Definition of the properties for a TagRules resource. + */ + private MonitoringTagRulesProperties tagRules; + + /** + * Creates an instance of MonitoredSubscription class. + */ + public MonitoredSubscription() { + } + + /** + * Get the subscriptionId property: The subscriptionId to be monitored. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscriptionId to be monitored. + * + * @param subscriptionId the subscriptionId value to set. + * @return the MonitoredSubscription object itself. + */ + public MonitoredSubscription withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the status property: The state of monitoring. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Set the status property: The state of monitoring. + * + * @param status the status value to set. + * @return the MonitoredSubscription object itself. + */ + public MonitoredSubscription withStatus(Status status) { + this.status = status; + return this; + } + + /** + * Get the error property: The reason of not monitoring the subscription. + * + * @return the error value. + */ + public String error() { + return this.error; + } + + /** + * Set the error property: The reason of not monitoring the subscription. + * + * @param error the error value to set. + * @return the MonitoredSubscription object itself. + */ + public MonitoredSubscription withError(String error) { + this.error = error; + return this; + } + + /** + * Get the tagRules property: Definition of the properties for a TagRules resource. + * + * @return the tagRules value. + */ + public MonitoringTagRulesProperties tagRules() { + return this.tagRules; + } + + /** + * Set the tagRules property: Definition of the properties for a TagRules resource. + * + * @param tagRules the tagRules value to set. + * @return the MonitoredSubscription object itself. + */ + public MonitoredSubscription withTagRules(MonitoringTagRulesProperties tagRules) { + this.tagRules = tagRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property subscriptionId in model MonitoredSubscription")); + } + if (tagRules() != null) { + tagRules().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MonitoredSubscription.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("error", this.error); + jsonWriter.writeJsonField("tagRules", this.tagRules); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MonitoredSubscription from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MonitoredSubscription if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MonitoredSubscription. + */ + public static MonitoredSubscription fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MonitoredSubscription deserializedMonitoredSubscription = new MonitoredSubscription(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subscriptionId".equals(fieldName)) { + deserializedMonitoredSubscription.subscriptionId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedMonitoredSubscription.status = Status.fromString(reader.getString()); + } else if ("error".equals(fieldName)) { + deserializedMonitoredSubscription.error = reader.getString(); + } else if ("tagRules".equals(fieldName)) { + deserializedMonitoredSubscription.tagRules = MonitoringTagRulesProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMonitoredSubscription; + }); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscriptionProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscriptionProperties.java new file mode 100644 index 000000000000..30aec19c9b91 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscriptionProperties.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.elastic.fluent.models.MonitoredSubscriptionPropertiesInner; + +/** + * An immutable client-side representation of MonitoredSubscriptionProperties. + */ +public interface MonitoredSubscriptionProperties { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The request to update subscriptions needed to be monitored by the Elastic monitor + * resource. + * + * @return the properties value. + */ + SubscriptionList properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.elastic.fluent.models.MonitoredSubscriptionPropertiesInner object. + * + * @return the inner object. + */ + MonitoredSubscriptionPropertiesInner innerModel(); + + /** + * The entirety of the MonitoredSubscriptionProperties definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The MonitoredSubscriptionProperties definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the MonitoredSubscriptionProperties definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the MonitoredSubscriptionProperties definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, monitorName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @return the next definition stage. + */ + WithCreate withExistingMonitor(String resourceGroupName, String monitorName); + } + + /** + * The stage of the MonitoredSubscriptionProperties definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + MonitoredSubscriptionProperties create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MonitoredSubscriptionProperties create(Context context); + } + + /** + * The stage of the MonitoredSubscriptionProperties definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The request to update subscriptions needed to be monitored by the + * Elastic monitor resource.. + * + * @param properties The request to update subscriptions needed to be monitored by the Elastic monitor + * resource. + * @return the next definition stage. + */ + WithCreate withProperties(SubscriptionList properties); + } + } + + /** + * Begins update for the MonitoredSubscriptionProperties resource. + * + * @return the stage of resource update. + */ + MonitoredSubscriptionProperties.Update update(); + + /** + * The template for MonitoredSubscriptionProperties update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MonitoredSubscriptionProperties apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MonitoredSubscriptionProperties apply(Context context); + } + + /** + * The MonitoredSubscriptionProperties update stages. + */ + interface UpdateStages { + /** + * The stage of the MonitoredSubscriptionProperties update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The request to update subscriptions needed to be monitored by the + * Elastic monitor resource.. + * + * @param properties The request to update subscriptions needed to be monitored by the Elastic monitor + * resource. + * @return the next definition stage. + */ + Update withProperties(SubscriptionList properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MonitoredSubscriptionProperties refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MonitoredSubscriptionProperties refresh(Context context); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscriptionPropertiesList.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscriptionPropertiesList.java new file mode 100644 index 000000000000..1a0927ff4426 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscriptionPropertiesList.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.elastic.fluent.models.MonitoredSubscriptionPropertiesInner; +import java.io.IOException; +import java.util.List; + +/** + * Paged collection of MonitoredSubscriptionProperties items. + */ +@Fluent +public final class MonitoredSubscriptionPropertiesList + implements JsonSerializable { + /* + * The MonitoredSubscriptionProperties items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of MonitoredSubscriptionPropertiesList class. + */ + public MonitoredSubscriptionPropertiesList() { + } + + /** + * Get the value property: The MonitoredSubscriptionProperties items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The MonitoredSubscriptionProperties items on this page. + * + * @param value the value value to set. + * @return the MonitoredSubscriptionPropertiesList object itself. + */ + public MonitoredSubscriptionPropertiesList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the MonitoredSubscriptionPropertiesList object itself. + */ + public MonitoredSubscriptionPropertiesList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model MonitoredSubscriptionPropertiesList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MonitoredSubscriptionPropertiesList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MonitoredSubscriptionPropertiesList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MonitoredSubscriptionPropertiesList if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MonitoredSubscriptionPropertiesList. + */ + public static MonitoredSubscriptionPropertiesList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MonitoredSubscriptionPropertiesList deserializedMonitoredSubscriptionPropertiesList + = new MonitoredSubscriptionPropertiesList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MonitoredSubscriptionPropertiesInner.fromJson(reader1)); + deserializedMonitoredSubscriptionPropertiesList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedMonitoredSubscriptionPropertiesList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMonitoredSubscriptionPropertiesList; + }); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscriptions.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscriptions.java new file mode 100644 index 000000000000..f7ddf9930f94 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredSubscriptions.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of MonitoredSubscriptions. + */ +public interface MonitoredSubscriptions { + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String monitorName); + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of MonitoredSubscriptionProperties items as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String monitorName, Context context); + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String monitorName, + String configurationName, Context context); + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ + MonitoredSubscriptionProperties get(String resourceGroupName, String monitorName, String configurationName); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String monitorName, String configurationName); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configuration name. Only 'default' value is supported. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String monitorName, String configurationName, Context context); + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response}. + */ + MonitoredSubscriptionProperties getById(String id); + + /** + * List all the subscriptions currently being monitored by the Elastic monitor resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the request to update subscriptions needed to be monitored by the Elastic monitor resource along with + * {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Updates the subscriptions that are being monitored by the Elastic monitor resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MonitoredSubscriptionProperties resource. + * + * @param name resource name. + * @return the first stage of the new MonitoredSubscriptionProperties definition. + */ + MonitoredSubscriptionProperties.DefinitionStages.Blank define(String name); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRules.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRules.java index 6222a1e70b1e..5ffed47b2bfb 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRules.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRules.java @@ -41,7 +41,7 @@ public interface MonitoringTagRules { MonitoringTagRulesProperties properties(); /** - * Gets the systemData property: The system metadata relating to this resource. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesListResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesListResponse.java index a9cc5d33b5fc..4472bff8bb4a 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesListResponse.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesListResponse.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.elastic.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -19,12 +20,12 @@ @Fluent public final class MonitoringTagRulesListResponse implements JsonSerializable { /* - * Results of a list operation. + * The MonitoringTagRules items on this page */ private List value; /* - * Link to the next set of results, if any. + * The link to the next page of items */ private String nextLink; @@ -35,7 +36,7 @@ public MonitoringTagRulesListResponse() { } /** - * Get the value property: Results of a list operation. + * Get the value property: The MonitoringTagRules items on this page. * * @return the value value. */ @@ -44,7 +45,7 @@ public List value() { } /** - * Set the value property: Results of a list operation. + * Set the value property: The MonitoringTagRules items on this page. * * @param value the value value to set. * @return the MonitoringTagRulesListResponse object itself. @@ -55,7 +56,7 @@ public MonitoringTagRulesListResponse withValue(List va } /** - * Get the nextLink property: Link to the next set of results, if any. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -64,7 +65,7 @@ public String nextLink() { } /** - * Set the nextLink property: Link to the next set of results, if any. + * Set the nextLink property: The link to the next page of items. * * @param nextLink the nextLink value to set. * @return the MonitoringTagRulesListResponse object itself. @@ -80,11 +81,17 @@ public MonitoringTagRulesListResponse withNextLink(String nextLink) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model MonitoringTagRulesListResponse")); + } else { value().forEach(e -> e.validate()); } } + private static final ClientLogger LOGGER = new ClientLogger(MonitoringTagRulesListResponse.class); + /** * {@inheritDoc} */ @@ -102,6 +109,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of MonitoringTagRulesListResponse if the JsonReader was pointing to an instance of it, or * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the MonitoringTagRulesListResponse. */ public static MonitoringTagRulesListResponse fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesProperties.java index 4d1c09c6972b..15c4e640d863 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesProperties.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesProperties.java @@ -41,17 +41,6 @@ public ProvisioningState provisioningState() { return this.provisioningState; } - /** - * Set the provisioningState property: Provisioning state of the monitoring tag rules. - * - * @param provisioningState the provisioningState value to set. - * @return the MonitoringTagRulesProperties object itself. - */ - public MonitoringTagRulesProperties withProvisioningState(ProvisioningState provisioningState) { - this.provisioningState = provisioningState; - return this; - } - /** * Get the logRules property: Rules for sending logs. * @@ -89,8 +78,6 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("provisioningState", - this.provisioningState == null ? null : this.provisioningState.toString()); jsonWriter.writeJsonField("logRules", this.logRules); return jsonWriter.writeEndObject(); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OpenAIIntegrationProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OpenAIIntegrationProperties.java index b31a95b95e93..9cfca4a1d0d8 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OpenAIIntegrationProperties.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OpenAIIntegrationProperties.java @@ -28,6 +28,11 @@ public final class OpenAIIntegrationProperties implements JsonSerializable { /* - * Results of a list operation. + * The OpenAIIntegrationRPModel items on this page */ private List value; /* - * Link to the next set of results, if any. + * The link to the next page of items */ private String nextLink; @@ -36,7 +37,7 @@ public OpenAIIntegrationRPModelListResponse() { } /** - * Get the value property: Results of a list operation. + * Get the value property: The OpenAIIntegrationRPModel items on this page. * * @return the value value. */ @@ -45,7 +46,7 @@ public List value() { } /** - * Set the value property: Results of a list operation. + * Set the value property: The OpenAIIntegrationRPModel items on this page. * * @param value the value value to set. * @return the OpenAIIntegrationRPModelListResponse object itself. @@ -56,7 +57,7 @@ public OpenAIIntegrationRPModelListResponse withValue(List e.validate()); } } + private static final ClientLogger LOGGER = new ClientLogger(OpenAIIntegrationRPModelListResponse.class); + /** * {@inheritDoc} */ @@ -103,6 +110,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of OpenAIIntegrationRPModelListResponse if the JsonReader was pointing to an instance of it, * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the OpenAIIntegrationRPModelListResponse. */ public static OpenAIIntegrationRPModelListResponse fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Operation.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Operation.java new file mode 100644 index 000000000000..224194999a23 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Operation.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The operation for the patch on the resource. + */ +public final class Operation extends ExpandableStringEnum { + /** + * Static value AddBegin for Operation. + */ + public static final Operation ADD_BEGIN = fromString("AddBegin"); + + /** + * Static value AddComplete for Operation. + */ + public static final Operation ADD_COMPLETE = fromString("AddComplete"); + + /** + * Static value DeleteBegin for Operation. + */ + public static final Operation DELETE_BEGIN = fromString("DeleteBegin"); + + /** + * Static value DeleteComplete for Operation. + */ + public static final Operation DELETE_COMPLETE = fromString("DeleteComplete"); + + /** + * Static value Active for Operation. + */ + public static final Operation ACTIVE = fromString("Active"); + + /** + * Creates a new instance of Operation value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Operation() { + } + + /** + * Creates or finds a Operation from its string representation. + * + * @param name a name to look for. + * @return the corresponding Operation. + */ + public static Operation fromString(String name) { + return fromString(name, Operation.class); + } + + /** + * Gets known Operation values. + * + * @return known Operation values. + */ + public static Collection values() { + return values(Operation.class); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationDisplay.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationDisplay.java index 01e6ffd26330..2ca870ed6d16 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationDisplay.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationDisplay.java @@ -12,27 +12,27 @@ import java.io.IOException; /** - * The object that represents the operation. + * Represents the display information for an operation. */ @Fluent public final class OperationDisplay implements JsonSerializable { /* - * Service provider, i.e., Microsoft.Elastic. + * The service provider of the operation. */ private String provider; /* - * Type on which the operation is performed, e.g., 'monitors'. + * The resource type of the operation. */ private String resource; /* - * Operation type, e.g., read, write, delete, etc. + * The name of the operation. */ private String operation; /* - * Description of the operation, e.g., 'Write monitors'. + * A description of the operation. */ private String description; @@ -43,7 +43,7 @@ public OperationDisplay() { } /** - * Get the provider property: Service provider, i.e., Microsoft.Elastic. + * Get the provider property: The service provider of the operation. * * @return the provider value. */ @@ -52,7 +52,7 @@ public String provider() { } /** - * Set the provider property: Service provider, i.e., Microsoft.Elastic. + * Set the provider property: The service provider of the operation. * * @param provider the provider value to set. * @return the OperationDisplay object itself. @@ -63,7 +63,7 @@ public OperationDisplay withProvider(String provider) { } /** - * Get the resource property: Type on which the operation is performed, e.g., 'monitors'. + * Get the resource property: The resource type of the operation. * * @return the resource value. */ @@ -72,7 +72,7 @@ public String resource() { } /** - * Set the resource property: Type on which the operation is performed, e.g., 'monitors'. + * Set the resource property: The resource type of the operation. * * @param resource the resource value to set. * @return the OperationDisplay object itself. @@ -83,7 +83,7 @@ public OperationDisplay withResource(String resource) { } /** - * Get the operation property: Operation type, e.g., read, write, delete, etc. + * Get the operation property: The name of the operation. * * @return the operation value. */ @@ -92,7 +92,7 @@ public String operation() { } /** - * Set the operation property: Operation type, e.g., read, write, delete, etc. + * Set the operation property: The name of the operation. * * @param operation the operation value to set. * @return the OperationDisplay object itself. @@ -103,7 +103,7 @@ public OperationDisplay withOperation(String operation) { } /** - * Get the description property: Description of the operation, e.g., 'Write monitors'. + * Get the description property: A description of the operation. * * @return the description value. */ @@ -112,7 +112,7 @@ public String description() { } /** - * Set the description property: Description of the operation, e.g., 'Write monitors'. + * Set the description property: A description of the operation. * * @param description the description value to set. * @return the OperationDisplay object itself. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationListResult.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationListResult.java index 28bf672c8742..60b14ff78a0f 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationListResult.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationListResult.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.elastic.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,17 +15,17 @@ import java.util.List; /** - * Result of GET request to list the Microsoft.Elastic operations. + * Represents a paginated list of operations. */ @Fluent public final class OperationListResult implements JsonSerializable { /* - * List of operations supported by the Microsoft.Elastic provider. + * The list of operations. */ private List value; /* - * URL to get the next set of operation list results if there are any. + * The URL to get the next set of results, if any. */ private String nextLink; @@ -35,7 +36,7 @@ public OperationListResult() { } /** - * Get the value property: List of operations supported by the Microsoft.Elastic provider. + * Get the value property: The list of operations. * * @return the value value. */ @@ -44,7 +45,7 @@ public List value() { } /** - * Set the value property: List of operations supported by the Microsoft.Elastic provider. + * Set the value property: The list of operations. * * @param value the value value to set. * @return the OperationListResult object itself. @@ -55,7 +56,7 @@ public OperationListResult withValue(List value) { } /** - * Get the nextLink property: URL to get the next set of operation list results if there are any. + * Get the nextLink property: The URL to get the next set of results, if any. * * @return the nextLink value. */ @@ -64,7 +65,7 @@ public String nextLink() { } /** - * Set the nextLink property: URL to get the next set of operation list results if there are any. + * Set the nextLink property: The URL to get the next set of results, if any. * * @param nextLink the nextLink value to set. * @return the OperationListResult object itself. @@ -80,11 +81,16 @@ public OperationListResult withNextLink(String nextLink) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); + } else { value().forEach(e -> e.validate()); } } + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.class); + /** * {@inheritDoc} */ @@ -102,6 +108,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the OperationListResult. */ public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationName.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationName.java index 0146fd081a71..e496da17b6e5 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationName.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationName.java @@ -8,8 +8,6 @@ import java.util.Collection; /** - * OperationName - * * Operation to be performed on the given vm resource id. */ public final class OperationName extends ExpandableStringEnum { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Operations.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Operations.java index a17a242ece12..55b8a62a8fc8 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Operations.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Operations.java @@ -12,24 +12,22 @@ */ public interface Operations { /** - * List all operations provided by Microsoft.Elastic. + * List the operations for the provider. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations as paginated response with - * {@link PagedIterable}. + * @return represents a paginated list of operations as paginated response with {@link PagedIterable}. */ PagedIterable list(); /** - * List all operations provided by Microsoft.Elastic. + * List the operations for the provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of GET request to list the Microsoft.Elastic operations as paginated response with - * {@link PagedIterable}. + * @return represents a paginated list of operations as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Organizations.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Organizations.java index b0b85990acca..e99e258f785d 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Organizations.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Organizations.java @@ -11,11 +11,41 @@ * Resource collection API of Organizations. */ public interface Organizations { + /** + * 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. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into + * along with {@link Response}. + */ + Response + getElasticToAzureSubscriptionMappingWithResponse(Context context); + + /** + * 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. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into. + */ + ElasticOrganizationToAzureSubscriptionMappingResponse getElasticToAzureSubscriptionMapping(); + /** * Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch * Organization. * - * @param body Email Id parameter of the User Organization, of which the API Key must be returned. + * @param body The request body. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -29,32 +59,39 @@ public interface Organizations { * Fetch User API Key from internal database, if it was generated and stored while creating the Elasticsearch * Organization. * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the User Api Key created for the Organization associated with the User Email Id that was passed in the * request. */ - UserApiKeyResponse getApiKey(); + UserApiKeyResponse getApiKey(UserEmailId body); /** - * Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + * Resubscribe the Elasticsearch Organization. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return elastic Organization To Azure Subscription Mapping details for the logged-in user along with - * {@link Response}. + * @return monitor resource. */ - Response - getElasticToAzureSubscriptionMappingWithResponse(Context context); + ElasticMonitorResource resubscribe(String resourceGroupName, String monitorName); /** - * Get Elastic Organization To Azure Subscription Mapping details for the logged-in user. + * Resubscribe the Elasticsearch Organization. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body Resubscribe Properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return elastic Organization To Azure Subscription Mapping details for the logged-in user. + * @return monitor resource. */ - ElasticOrganizationToAzureSubscriptionMappingResponse getElasticToAzureSubscriptionMapping(); + ElasticMonitorResource resubscribe(String resourceGroupName, String monitorName, ResubscribeProperties body, + Context context); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProjectDetails.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProjectDetails.java new file mode 100644 index 000000000000..de70024582c2 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProjectDetails.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Project details of the monitor resource IF it belongs to Serverless offer kind. + */ +@Fluent +public final class ProjectDetails implements JsonSerializable { + /* + * Project type; ex: Elasticsearch / Observability / Security + */ + private ProjectType projectType; + + /* + * Configuration type of the Elasticsearch project + */ + private ConfigurationType configurationType; + + /** + * Creates an instance of ProjectDetails class. + */ + public ProjectDetails() { + } + + /** + * Get the projectType property: Project type; ex: Elasticsearch / Observability / Security. + * + * @return the projectType value. + */ + public ProjectType projectType() { + return this.projectType; + } + + /** + * Set the projectType property: Project type; ex: Elasticsearch / Observability / Security. + * + * @param projectType the projectType value to set. + * @return the ProjectDetails object itself. + */ + public ProjectDetails withProjectType(ProjectType projectType) { + this.projectType = projectType; + return this; + } + + /** + * Get the configurationType property: Configuration type of the Elasticsearch project. + * + * @return the configurationType value. + */ + public ConfigurationType configurationType() { + return this.configurationType; + } + + /** + * Set the configurationType property: Configuration type of the Elasticsearch project. + * + * @param configurationType the configurationType value to set. + * @return the ProjectDetails object itself. + */ + public ProjectDetails withConfigurationType(ConfigurationType configurationType) { + this.configurationType = configurationType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("projectType", this.projectType == null ? null : this.projectType.toString()); + jsonWriter.writeStringField("configurationType", + this.configurationType == null ? null : this.configurationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProjectDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProjectDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ProjectDetails. + */ + public static ProjectDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProjectDetails deserializedProjectDetails = new ProjectDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("projectType".equals(fieldName)) { + deserializedProjectDetails.projectType = ProjectType.fromString(reader.getString()); + } else if ("configurationType".equals(fieldName)) { + deserializedProjectDetails.configurationType = ConfigurationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedProjectDetails; + }); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProjectType.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProjectType.java new file mode 100644 index 000000000000..b5fb5b65acf9 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProjectType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Project type; ex: Elasticsearch / Observability / Security. + */ +public final class ProjectType extends ExpandableStringEnum { + /** + * Static value Elasticsearch for ProjectType. + */ + public static final ProjectType ELASTICSEARCH = fromString("Elasticsearch"); + + /** + * Static value Observability for ProjectType. + */ + public static final ProjectType OBSERVABILITY = fromString("Observability"); + + /** + * Static value Security for ProjectType. + */ + public static final ProjectType SECURITY = fromString("Security"); + + /** + * Static value NotApplicable for ProjectType. + */ + public static final ProjectType NOT_APPLICABLE = fromString("NotApplicable"); + + /** + * Creates a new instance of ProjectType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProjectType() { + } + + /** + * Creates or finds a ProjectType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProjectType. + */ + public static ProjectType fromString(String name) { + return fromString(name, ProjectType.class); + } + + /** + * Gets known ProjectType values. + * + * @return known ProjectType values. + */ + public static Collection values() { + return values(ProjectType.class); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProvisioningState.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProvisioningState.java index 71fe8a55a48a..88ad7906ba8f 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProvisioningState.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProvisioningState.java @@ -8,8 +8,6 @@ import java.util.Collection; /** - * ProvisioningState - * * Provisioning state of Elastic resource. */ public final class ProvisioningState extends ExpandableStringEnum { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ResourceSku.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ResourceSku.java index 752e3ea090e7..9ab469dc94e4 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ResourceSku.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ResourceSku.java @@ -13,12 +13,12 @@ import java.io.IOException; /** - * Microsoft.Elastic SKU. + * Represents the SKU of a resource. */ @Fluent public final class ResourceSku implements JsonSerializable { /* - * Name of the SKU. + * The name of the SKU. */ private String name; @@ -29,7 +29,7 @@ public ResourceSku() { } /** - * Get the name property: Name of the SKU. + * Get the name property: The name of the SKU. * * @return the name value. */ @@ -38,7 +38,7 @@ public String name() { } /** - * Set the name property: Name of the SKU. + * Set the name property: The name of the SKU. * * @param name the name value to set. * @return the ResourceSku object itself. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ResubscribeProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ResubscribeProperties.java new file mode 100644 index 000000000000..352d23594c0c --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ResubscribeProperties.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Resubscribe Properties. + */ +@Fluent +public final class ResubscribeProperties implements JsonSerializable { + /* + * Newly selected plan Id to create the new Marketplace subscription for Resubscribe + */ + private String planId; + + /* + * Newly selected term to create the new Marketplace subscription for Resubscribe + */ + private String term; + + /* + * Newly selected Azure Subscription Id in which the new Marketplace subscription will be created for Resubscribe + */ + private String subscriptionId; + + /* + * Newly selected Azure resource group in which the new Marketplace subscription will be created for Resubscribe + */ + private String resourceGroup; + + /* + * Organization Id of the Elastic Organization that needs to be resubscribed + */ + private String organizationId; + + /** + * Creates an instance of ResubscribeProperties class. + */ + public ResubscribeProperties() { + } + + /** + * Get the planId property: Newly selected plan Id to create the new Marketplace subscription for Resubscribe. + * + * @return the planId value. + */ + public String planId() { + return this.planId; + } + + /** + * Set the planId property: Newly selected plan Id to create the new Marketplace subscription for Resubscribe. + * + * @param planId the planId value to set. + * @return the ResubscribeProperties object itself. + */ + public ResubscribeProperties withPlanId(String planId) { + this.planId = planId; + return this; + } + + /** + * Get the term property: Newly selected term to create the new Marketplace subscription for Resubscribe. + * + * @return the term value. + */ + public String term() { + return this.term; + } + + /** + * Set the term property: Newly selected term to create the new Marketplace subscription for Resubscribe. + * + * @param term the term value to set. + * @return the ResubscribeProperties object itself. + */ + public ResubscribeProperties withTerm(String term) { + this.term = term; + return this; + } + + /** + * Get the subscriptionId property: Newly selected Azure Subscription Id in which the new Marketplace subscription + * will be created for Resubscribe. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Newly selected Azure Subscription Id in which the new Marketplace subscription + * will be created for Resubscribe. + * + * @param subscriptionId the subscriptionId value to set. + * @return the ResubscribeProperties object itself. + */ + public ResubscribeProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroup property: Newly selected Azure resource group in which the new Marketplace subscription + * will be created for Resubscribe. + * + * @return the resourceGroup value. + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Set the resourceGroup property: Newly selected Azure resource group in which the new Marketplace subscription + * will be created for Resubscribe. + * + * @param resourceGroup the resourceGroup value to set. + * @return the ResubscribeProperties object itself. + */ + public ResubscribeProperties withResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + /** + * Get the organizationId property: Organization Id of the Elastic Organization that needs to be resubscribed. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: Organization Id of the Elastic Organization that needs to be resubscribed. + * + * @param organizationId the organizationId value to set. + * @return the ResubscribeProperties object itself. + */ + public ResubscribeProperties withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("planId", this.planId); + jsonWriter.writeStringField("term", this.term); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeStringField("resourceGroup", this.resourceGroup); + jsonWriter.writeStringField("organizationId", this.organizationId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResubscribeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResubscribeProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResubscribeProperties. + */ + public static ResubscribeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResubscribeProperties deserializedResubscribeProperties = new ResubscribeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("planId".equals(fieldName)) { + deserializedResubscribeProperties.planId = reader.getString(); + } else if ("term".equals(fieldName)) { + deserializedResubscribeProperties.term = reader.getString(); + } else if ("subscriptionId".equals(fieldName)) { + deserializedResubscribeProperties.subscriptionId = reader.getString(); + } else if ("resourceGroup".equals(fieldName)) { + deserializedResubscribeProperties.resourceGroup = reader.getString(); + } else if ("organizationId".equals(fieldName)) { + deserializedResubscribeProperties.organizationId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResubscribeProperties; + }); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/SendingLogs.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/SendingLogs.java index c4ab9879e9fe..cf1cc7dbed99 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/SendingLogs.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/SendingLogs.java @@ -8,8 +8,6 @@ import java.util.Collection; /** - * SendingLogs - * * Flag indicating the status of the resource for sending logs operation to Elastic. */ public final class SendingLogs extends ExpandableStringEnum { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Status.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Status.java new file mode 100644 index 000000000000..c372f29cbd86 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Status.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The state of monitoring. + */ +public final class Status extends ExpandableStringEnum { + /** + * Static value InProgress for Status. + */ + public static final Status IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Active for Status. + */ + public static final Status ACTIVE = fromString("Active"); + + /** + * Static value Failed for Status. + */ + public static final Status FAILED = fromString("Failed"); + + /** + * Static value Deleting for Status. + */ + public static final Status DELETING = fromString("Deleting"); + + /** + * Creates a new instance of Status value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Status() { + } + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * Gets known Status values. + * + * @return known Status values. + */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/SubscriptionList.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/SubscriptionList.java new file mode 100644 index 000000000000..9409247fff26 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/SubscriptionList.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The request to update subscriptions needed to be monitored by the Elastic monitor resource. + */ +@Fluent +public final class SubscriptionList implements JsonSerializable { + /* + * The operation for the patch on the resource. + */ + private Operation operation; + + /* + * List of subscriptions and the state of the monitoring. + */ + private List monitoredSubscriptionList; + + /* + * Provisioning State of the resource + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of SubscriptionList class. + */ + public SubscriptionList() { + } + + /** + * Get the operation property: The operation for the patch on the resource. + * + * @return the operation value. + */ + public Operation operation() { + return this.operation; + } + + /** + * Set the operation property: The operation for the patch on the resource. + * + * @param operation the operation value to set. + * @return the SubscriptionList object itself. + */ + public SubscriptionList withOperation(Operation operation) { + this.operation = operation; + return this; + } + + /** + * Get the monitoredSubscriptionList property: List of subscriptions and the state of the monitoring. + * + * @return the monitoredSubscriptionList value. + */ + public List monitoredSubscriptionList() { + return this.monitoredSubscriptionList; + } + + /** + * Set the monitoredSubscriptionList property: List of subscriptions and the state of the monitoring. + * + * @param monitoredSubscriptionList the monitoredSubscriptionList value to set. + * @return the SubscriptionList object itself. + */ + public SubscriptionList withMonitoredSubscriptionList(List monitoredSubscriptionList) { + this.monitoredSubscriptionList = monitoredSubscriptionList; + return this; + } + + /** + * Get the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (monitoredSubscriptionList() != null) { + monitoredSubscriptionList().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operation", this.operation == null ? null : this.operation.toString()); + jsonWriter.writeArrayField("monitoredSubscriptionList", this.monitoredSubscriptionList, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubscriptionList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubscriptionList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SubscriptionList. + */ + public static SubscriptionList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubscriptionList deserializedSubscriptionList = new SubscriptionList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operation".equals(fieldName)) { + deserializedSubscriptionList.operation = Operation.fromString(reader.getString()); + } else if ("monitoredSubscriptionList".equals(fieldName)) { + List monitoredSubscriptionList + = reader.readArray(reader1 -> MonitoredSubscription.fromJson(reader1)); + deserializedSubscriptionList.monitoredSubscriptionList = monitoredSubscriptionList; + } else if ("provisioningState".equals(fieldName)) { + deserializedSubscriptionList.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSubscriptionList; + }); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/VMHostListResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/VMHostListResponse.java index 4e2c340b3c90..742eda4b9355 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/VMHostListResponse.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/VMHostListResponse.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.elastic.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -19,12 +20,12 @@ @Fluent public final class VMHostListResponse implements JsonSerializable { /* - * Results of a list operation. + * The VMResources items on this page */ private List value; /* - * Link to the next Vm resource Id, if any. + * The link to the next page of items */ private String nextLink; @@ -35,7 +36,7 @@ public VMHostListResponse() { } /** - * Get the value property: Results of a list operation. + * Get the value property: The VMResources items on this page. * * @return the value value. */ @@ -44,7 +45,7 @@ public List value() { } /** - * Set the value property: Results of a list operation. + * Set the value property: The VMResources items on this page. * * @param value the value value to set. * @return the VMHostListResponse object itself. @@ -55,7 +56,7 @@ public VMHostListResponse withValue(List value) { } /** - * Get the nextLink property: Link to the next Vm resource Id, if any. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -64,7 +65,7 @@ public String nextLink() { } /** - * Set the nextLink property: Link to the next Vm resource Id, if any. + * Set the nextLink property: The link to the next page of items. * * @param nextLink the nextLink value to set. * @return the VMHostListResponse object itself. @@ -80,11 +81,16 @@ public VMHostListResponse withNextLink(String nextLink) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model VMHostListResponse")); + } else { value().forEach(e -> e.validate()); } } + private static final ClientLogger LOGGER = new ClientLogger(VMHostListResponse.class); + /** * {@inheritDoc} */ @@ -102,6 +108,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of VMHostListResponse if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the VMHostListResponse. */ public static VMHostListResponse fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-elastic/proxy-config.json b/sdk/elastic/azure-resourcemanager-elastic/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-elastic/proxy-config.json index 844b1ea73a5e..924b1bde90d8 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-elastic/proxy-config.json +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-elastic/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.elastic.implementation.AllTrafficFiltersClientImpl$AllTrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.AssociateTrafficFiltersClientImpl$AssociateTrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.BillingInfoesClientImpl$BillingInfoesService"],["com.azure.resourcemanager.elastic.implementation.ConnectedPartnerResourcesClientImpl$ConnectedPartnerResourcesService"],["com.azure.resourcemanager.elastic.implementation.CreateAndAssociateIpFiltersClientImpl$CreateAndAssociateIpFiltersService"],["com.azure.resourcemanager.elastic.implementation.CreateAndAssociatePLFiltersClientImpl$CreateAndAssociatePLFiltersService"],["com.azure.resourcemanager.elastic.implementation.DeploymentInfoesClientImpl$DeploymentInfoesService"],["com.azure.resourcemanager.elastic.implementation.DetachAndDeleteTrafficFiltersClientImpl$DetachAndDeleteTrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.DetachTrafficFiltersClientImpl$DetachTrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.ElasticVersionsClientImpl$ElasticVersionsService"],["com.azure.resourcemanager.elastic.implementation.ExternalUsersClientImpl$ExternalUsersService"],["com.azure.resourcemanager.elastic.implementation.ListAssociatedTrafficFiltersClientImpl$ListAssociatedTrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.MonitorOperationsClientImpl$MonitorOperationsService"],["com.azure.resourcemanager.elastic.implementation.MonitoredResourcesClientImpl$MonitoredResourcesService"],["com.azure.resourcemanager.elastic.implementation.MonitorsClientImpl$MonitorsService"],["com.azure.resourcemanager.elastic.implementation.OpenAIsClientImpl$OpenAIsService"],["com.azure.resourcemanager.elastic.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.elastic.implementation.OrganizationsClientImpl$OrganizationsService"],["com.azure.resourcemanager.elastic.implementation.TagRulesClientImpl$TagRulesService"],["com.azure.resourcemanager.elastic.implementation.TrafficFiltersClientImpl$TrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.UpgradableVersionsClientImpl$UpgradableVersionsService"],["com.azure.resourcemanager.elastic.implementation.VMCollectionsClientImpl$VMCollectionsService"],["com.azure.resourcemanager.elastic.implementation.VMHostsClientImpl$VMHostsService"],["com.azure.resourcemanager.elastic.implementation.VMIngestionsClientImpl$VMIngestionsService"]] \ No newline at end of file +[["com.azure.resourcemanager.elastic.implementation.AllTrafficFiltersClientImpl$AllTrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.AssociateTrafficFiltersClientImpl$AssociateTrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.BillingInfoesClientImpl$BillingInfoesService"],["com.azure.resourcemanager.elastic.implementation.ConnectedPartnerResourcesClientImpl$ConnectedPartnerResourcesService"],["com.azure.resourcemanager.elastic.implementation.CreateAndAssociateIpFiltersClientImpl$CreateAndAssociateIpFiltersService"],["com.azure.resourcemanager.elastic.implementation.CreateAndAssociatePLFiltersClientImpl$CreateAndAssociatePLFiltersService"],["com.azure.resourcemanager.elastic.implementation.DeploymentInfoesClientImpl$DeploymentInfoesService"],["com.azure.resourcemanager.elastic.implementation.DetachAndDeleteTrafficFiltersClientImpl$DetachAndDeleteTrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.DetachTrafficFiltersClientImpl$DetachTrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.ElasticVersionsClientImpl$ElasticVersionsService"],["com.azure.resourcemanager.elastic.implementation.ExternalUsersClientImpl$ExternalUsersService"],["com.azure.resourcemanager.elastic.implementation.ListAssociatedTrafficFiltersClientImpl$ListAssociatedTrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.MonitorOperationsClientImpl$MonitorOperationsService"],["com.azure.resourcemanager.elastic.implementation.MonitoredResourcesClientImpl$MonitoredResourcesService"],["com.azure.resourcemanager.elastic.implementation.MonitoredSubscriptionsClientImpl$MonitoredSubscriptionsService"],["com.azure.resourcemanager.elastic.implementation.MonitorsClientImpl$MonitorsService"],["com.azure.resourcemanager.elastic.implementation.OpenAIsClientImpl$OpenAIsService"],["com.azure.resourcemanager.elastic.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.elastic.implementation.OrganizationsClientImpl$OrganizationsService"],["com.azure.resourcemanager.elastic.implementation.TagRulesClientImpl$TagRulesService"],["com.azure.resourcemanager.elastic.implementation.TrafficFiltersClientImpl$TrafficFiltersService"],["com.azure.resourcemanager.elastic.implementation.UpgradableVersionsClientImpl$UpgradableVersionsService"],["com.azure.resourcemanager.elastic.implementation.VMCollectionsClientImpl$VMCollectionsService"],["com.azure.resourcemanager.elastic.implementation.VMHostsClientImpl$VMHostsService"],["com.azure.resourcemanager.elastic.implementation.VMIngestionsClientImpl$VMIngestionsService"]] \ No newline at end of file diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/resources/azure-resourcemanager-elastic.properties b/sdk/elastic/azure-resourcemanager-elastic/src/main/resources/azure-resourcemanager-elastic.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/resources/azure-resourcemanager-elastic.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/AllTrafficFiltersListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/AllTrafficFiltersListSamples.java index d1666edc9daf..1ec898045295 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/AllTrafficFiltersListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/AllTrafficFiltersListSamples.java @@ -9,8 +9,8 @@ */ public final class AllTrafficFiltersListSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/AllTrafficFilters_list.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * AllTrafficFilters_list.json */ /** * Sample code: AllTrafficFilters_list. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/AssociateTrafficFilterAssociateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/AssociateTrafficFilterAssociateSamples.java index 65ac4992f9d7..964cb1464490 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/AssociateTrafficFilterAssociateSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/AssociateTrafficFilterAssociateSamples.java @@ -9,9 +9,8 @@ */ public final class AssociateTrafficFilterAssociateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/AssociateTrafficFilter_Update - * .json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * AssociateTrafficFilter_Update.json */ /** * Sample code: AssociateTrafficFilter_Associate. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/BillingInfoGetSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/BillingInfoGetSamples.java index a9be06b0bade..dd94d6ab1b85 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/BillingInfoGetSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/BillingInfoGetSamples.java @@ -10,7 +10,7 @@ public final class BillingInfoGetSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/BillingInfo_Get.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/BillingInfo_Get.json */ /** * Sample code: BillingInfo_Get. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListSamples.java index f27b49b0ea10..817f5904dbe3 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListSamples.java @@ -9,7 +9,7 @@ */ public final class ConnectedPartnerResourcesListSamples { /* - * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ * ConnectedPartnerResources_List.json */ /** diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociateIpFilterCreateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociateIpFilterCreateSamples.java index d00cecd40066..2c4344be63e1 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociateIpFilterCreateSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociateIpFilterCreateSamples.java @@ -9,8 +9,8 @@ */ public final class CreateAndAssociateIpFilterCreateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/IPTrafficFilter_Create.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * IPTrafficFilter_Create.json */ /** * Sample code: createAndAssociateIPFilter_Create. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociatePLFilterCreateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociatePLFilterCreateSamples.java index 0288c1fd87de..3f2ba8455858 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociatePLFilterCreateSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociatePLFilterCreateSamples.java @@ -9,7 +9,7 @@ */ public final class CreateAndAssociatePLFilterCreateSamples { /* - * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ * PrivateLinkTrafficFilters_Create.json */ /** diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoListSamples.java index 17511dfa31a3..8bc934ba2fde 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoListSamples.java @@ -10,7 +10,8 @@ public final class DeploymentInfoListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/DeploymentInfo_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/DeploymentInfo_List. + * json */ /** * Sample code: DeploymentInfo_List. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DetachAndDeleteTrafficFilterDeleteSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DetachAndDeleteTrafficFilterDeleteSamples.java index 0549fbf9201a..9b1e4ea429b1 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DetachAndDeleteTrafficFilterDeleteSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DetachAndDeleteTrafficFilterDeleteSamples.java @@ -9,7 +9,7 @@ */ public final class DetachAndDeleteTrafficFilterDeleteSamples { /* - * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ * DetachAndDeleteTrafficFilter_Delete.json */ /** diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DetachTrafficFilterUpdateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DetachTrafficFilterUpdateSamples.java index abdf1a20e026..45413dacaa4c 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DetachTrafficFilterUpdateSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/DetachTrafficFilterUpdateSamples.java @@ -9,9 +9,8 @@ */ public final class DetachTrafficFilterUpdateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/DetachTrafficFilters_Update. - * json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * DetachTrafficFilters_Update.json */ /** * Sample code: DetachTrafficFilter_Update. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListSamples.java index 9cf3e2c11c16..0431a41e5805 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListSamples.java @@ -10,7 +10,8 @@ public final class ElasticVersionsListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ElasticVersions_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ElasticVersions_List + * .json */ /** * Sample code: ElasticVersions_List. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ExternalUserCreateOrUpdateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ExternalUserCreateOrUpdateSamples.java index 90f672583229..6121fdffb8f2 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ExternalUserCreateOrUpdateSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ExternalUserCreateOrUpdateSamples.java @@ -10,7 +10,8 @@ public final class ExternalUserCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ExternalUserInfo.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ExternalUserInfo. + * json */ /** * Sample code: ExternalUser_CreateOrUpdate. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ListAssociatedTrafficFiltersListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ListAssociatedTrafficFiltersListSamples.java index 1d8fe80868f4..139d7d335344 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ListAssociatedTrafficFiltersListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ListAssociatedTrafficFiltersListSamples.java @@ -9,7 +9,7 @@ */ public final class ListAssociatedTrafficFiltersListSamples { /* - * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ * AssociatedFiltersForDeployment_list.json */ /** diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorOperationUpgradeSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorOperationUpgradeSamples.java index 906c79080122..f42e6b45dc15 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorOperationUpgradeSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorOperationUpgradeSamples.java @@ -10,7 +10,7 @@ public final class MonitorOperationUpgradeSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitor_Upgrade.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitor_Upgrade.json */ /** * Sample code: Monitor_Upgrade. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredResourcesListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredResourcesListSamples.java index 622929a26d9a..c145ea17f588 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredResourcesListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredResourcesListSamples.java @@ -9,8 +9,8 @@ */ public final class MonitoredResourcesListSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/MonitoredResources_List.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredResources_List.json */ /** * Sample code: MonitoredResources_List. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsCreateorUpdateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsCreateorUpdateSamples.java new file mode 100644 index 000000000000..505f5ab41596 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsCreateorUpdateSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.generated; + +/** + * Samples for MonitoredSubscriptions CreateorUpdate. + */ +public final class MonitoredSubscriptionsCreateorUpdateSamples { + /* + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredSubscriptions_CreateorUpdate.json + */ + /** + * Sample code: Monitors_AddMonitoredSubscriptions. + * + * @param manager Entry point to ElasticManager. + */ + public static void monitorsAddMonitoredSubscriptions(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitoredSubscriptions().define("default").withExistingMonitor("myResourceGroup", "myMonitor").create(); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsDeleteSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsDeleteSamples.java new file mode 100644 index 000000000000..61d271ff9cb9 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.generated; + +/** + * Samples for MonitoredSubscriptions Delete. + */ +public final class MonitoredSubscriptionsDeleteSamples { + /* + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredSubscriptions_Delete.json + */ + /** + * Sample code: Monitors_DeleteMonitoredSubscriptions. + * + * @param manager Entry point to ElasticManager. + */ + public static void monitorsDeleteMonitoredSubscriptions(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitoredSubscriptions() + .delete("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsGetSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsGetSamples.java new file mode 100644 index 000000000000..9e337d579346 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.generated; + +/** + * Samples for MonitoredSubscriptions Get. + */ +public final class MonitoredSubscriptionsGetSamples { + /* + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredSubscriptions_Get.json + */ + /** + * Sample code: Monitors_GetMonitoredSubscriptions. + * + * @param manager Entry point to ElasticManager. + */ + public static void monitorsGetMonitoredSubscriptions(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitoredSubscriptions() + .getWithResponse("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsListSamples.java new file mode 100644 index 000000000000..4296fd456bb1 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.generated; + +/** + * Samples for MonitoredSubscriptions List. + */ +public final class MonitoredSubscriptionsListSamples { + /* + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredSubscriptions_List.json + */ + /** + * Sample code: Monitors_GetMonitoredSubscriptions. + * + * @param manager Entry point to ElasticManager. + */ + public static void monitorsGetMonitoredSubscriptions(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.monitoredSubscriptions().list("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsUpdateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsUpdateSamples.java new file mode 100644 index 000000000000..2957d30bac46 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitoredSubscriptionsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.generated; + +import com.azure.resourcemanager.elastic.models.MonitoredSubscriptionProperties; + +/** + * Samples for MonitoredSubscriptions Update. + */ +public final class MonitoredSubscriptionsUpdateSamples { + /* + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * MonitoredSubscriptions_Update.json + */ + /** + * Sample code: Monitors_UpdateMonitoredSubscriptions. + * + * @param manager Entry point to ElasticManager. + */ + public static void monitorsUpdateMonitoredSubscriptions(com.azure.resourcemanager.elastic.ElasticManager manager) { + MonitoredSubscriptionProperties resource = manager.monitoredSubscriptions() + .getWithResponse("myResourceGroup", "myMonitor", "default", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsCreateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsCreateSamples.java index fb70396052d9..5c649f5390fd 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsCreateSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsCreateSamples.java @@ -10,7 +10,7 @@ public final class MonitorsCreateSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Create.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitors_Create.json */ /** * Sample code: Monitors_Create. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsDeleteSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsDeleteSamples.java index ac22755d84bf..5f15f4098235 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsDeleteSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsDeleteSamples.java @@ -10,7 +10,7 @@ public final class MonitorsDeleteSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Delete.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitors_Delete.json */ /** * Sample code: Monitors_Delete. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsGetByResourceGroupSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsGetByResourceGroupSamples.java index 861669bf9899..6b67ffc5ce41 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsGetByResourceGroupSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsGetByResourceGroupSamples.java @@ -10,7 +10,7 @@ public final class MonitorsGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Get.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitors_Get.json */ /** * Sample code: Monitors_Get. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsListByResourceGroupSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsListByResourceGroupSamples.java index 8427bfb6637f..d615b5ac1424 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsListByResourceGroupSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsListByResourceGroupSamples.java @@ -9,9 +9,8 @@ */ public final class MonitorsListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_ListByResourceGroup. - * json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * Monitors_ListByResourceGroup.json */ /** * Sample code: Monitors_ListByResourceGroup. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsListSamples.java index bd47f0989aef..da36d1295977 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsListSamples.java @@ -10,7 +10,7 @@ public final class MonitorsListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitors_List.json */ /** * Sample code: Monitors_List. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsUpdateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsUpdateSamples.java index 678de02bf389..1c45ed1f3b4c 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsUpdateSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/MonitorsUpdateSamples.java @@ -12,7 +12,7 @@ public final class MonitorsUpdateSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Update.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Monitors_Update.json */ /** * Sample code: Monitors_Update. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAICreateOrUpdateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAICreateOrUpdateSamples.java index d6c4c7243828..50fd6748e96e 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAICreateOrUpdateSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAICreateOrUpdateSamples.java @@ -9,8 +9,8 @@ */ public final class OpenAICreateOrUpdateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_CreateOrUpdate.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * OpenAI_CreateOrUpdate.json */ /** * Sample code: OpenAI_CreateOrUpdate. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIDeleteSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIDeleteSamples.java index 273d1cf451d8..119245267481 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIDeleteSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIDeleteSamples.java @@ -10,7 +10,7 @@ public final class OpenAIDeleteSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_Delete.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/OpenAI_Delete.json */ /** * Sample code: OpenAI_Delete. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIGetSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIGetSamples.java index 1f869d435a67..09e0ac44d632 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIGetSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIGetSamples.java @@ -10,7 +10,7 @@ public final class OpenAIGetSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_Get.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/OpenAI_Get.json */ /** * Sample code: OpenAI_Get. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIGetStatusSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIGetStatusSamples.java index 7bd1f1f9e041..fb4eeacf38d0 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIGetStatusSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIGetStatusSamples.java @@ -10,7 +10,8 @@ public final class OpenAIGetStatusSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_GetStatus.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/OpenAI_GetStatus. + * json */ /** * Sample code: OpenAI_GetStatus. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIListSamples.java index b9dca30d5b8c..7754dd6914cb 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OpenAIListSamples.java @@ -10,7 +10,7 @@ public final class OpenAIListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/OpenAI_List.json */ /** * Sample code: OpenAI_List. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OperationsListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OperationsListSamples.java index 9c3d80d5db17..4366b31fc42f 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OperationsListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OperationsListSamples.java @@ -10,7 +10,7 @@ public final class OperationsListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Operations_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/Operations_List.json */ /** * Sample code: Operations_List. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetApiKeySamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetApiKeySamples.java index 926012ea9a58..f470bc17db5c 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetApiKeySamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetApiKeySamples.java @@ -9,8 +9,8 @@ */ public final class OrganizationsGetApiKeySamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Organizations_GetApiKey.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * Organizations_GetApiKey.json */ /** * Sample code: Organizations_GetApiKey. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetElasticToAzureSubscriptionMappingSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetElasticToAzureSubscriptionMappingSamples.java index 5b74a0686b9c..ccf6b96309ef 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetElasticToAzureSubscriptionMappingSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetElasticToAzureSubscriptionMappingSamples.java @@ -9,7 +9,7 @@ */ public final class OrganizationsGetElasticToAzureSubscriptionMappingSamples { /* - * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ * Organizations_GetElasticToAzureSubscriptionMapping.json */ /** diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsResubscribeSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsResubscribeSamples.java new file mode 100644 index 000000000000..ede9ecc14956 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/OrganizationsResubscribeSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.generated; + +/** + * Samples for Organizations Resubscribe. + */ +public final class OrganizationsResubscribeSamples { + /* + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * Organizations_Resubscribe.json + */ + /** + * Sample code: Organizations_Resubscribe. + * + * @param manager Entry point to ElasticManager. + */ + public static void organizationsResubscribe(com.azure.resourcemanager.elastic.ElasticManager manager) { + manager.organizations().resubscribe("myResourceGroup", "myMonitor", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesCreateOrUpdateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesCreateOrUpdateSamples.java index bc79ae956baf..7719c892b570 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesCreateOrUpdateSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesCreateOrUpdateSamples.java @@ -9,8 +9,8 @@ */ public final class TagRulesCreateOrUpdateSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_CreateOrUpdate.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * TagRules_CreateOrUpdate.json */ /** * Sample code: TagRules_CreateOrUpdate. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesDeleteSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesDeleteSamples.java index 1953d27ebc2a..85485b5c477a 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesDeleteSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesDeleteSamples.java @@ -10,7 +10,7 @@ public final class TagRulesDeleteSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_Delete.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/TagRules_Delete.json */ /** * Sample code: TagRules_Delete. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesGetSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesGetSamples.java index 63557a9d1225..fba02021712f 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesGetSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesGetSamples.java @@ -10,7 +10,7 @@ public final class TagRulesGetSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_Get.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/TagRules_Get.json */ /** * Sample code: TagRules_Get. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesListSamples.java index 2916b2eb8ad5..16979fb0956f 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TagRulesListSamples.java @@ -10,7 +10,7 @@ public final class TagRulesListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/TagRules_List.json */ /** * Sample code: TagRules_List. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TrafficFiltersDeleteSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TrafficFiltersDeleteSamples.java index 487c7b2f2121..8ae648575a60 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TrafficFiltersDeleteSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/TrafficFiltersDeleteSamples.java @@ -9,8 +9,8 @@ */ public final class TrafficFiltersDeleteSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TrafficFilters_Delete.json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * TrafficFilters_Delete.json */ /** * Sample code: TrafficFilters_Delete. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsDetailsSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsDetailsSamples.java index c7870e337201..7cebf627b5bd 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsDetailsSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsDetailsSamples.java @@ -9,9 +9,8 @@ */ public final class UpgradableVersionsDetailsSamples { /* - * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/UpgradableVersions_Details. - * json + * x-ms-original-file: specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/ + * UpgradableVersions_Details.json */ /** * Sample code: UpgradableVersions_Details. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMCollectionUpdateSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMCollectionUpdateSamples.java index 0c7fc19c0f41..7423b8b9c50f 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMCollectionUpdateSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMCollectionUpdateSamples.java @@ -10,7 +10,8 @@ public final class VMCollectionUpdateSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMCollection_Update.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/VMCollection_Update. + * json */ /** * Sample code: VMCollection_Update. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMHostListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMHostListSamples.java index 31c3d59db13c..0d19ade14489 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMHostListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMHostListSamples.java @@ -10,7 +10,7 @@ public final class VMHostListSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMHost_List.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/VMHost_List.json */ /** * Sample code: VMHost_List. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMIngestionDetailsSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMIngestionDetailsSamples.java index 921277a0dbdc..b0106480f9c9 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMIngestionDetailsSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/VMIngestionDetailsSamples.java @@ -10,7 +10,8 @@ public final class VMIngestionDetailsSamples { /* * x-ms-original-file: - * specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMIngestion_Details.json + * specification/elastic/resource-manager/Microsoft.Elastic/preview/2025-01-15-preview/examples/VMIngestion_Details. + * json */ /** * Sample code: VMIngestion_Details. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/AllTrafficFiltersListWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/AllTrafficFiltersListWithResponseMockTests.java deleted file mode 100644 index 7abf8c898ac9..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/AllTrafficFiltersListWithResponseMockTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilterResponse; -import com.azure.resourcemanager.elastic.models.Type; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AllTrafficFiltersListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - String responseStr - = "{\"rulesets\":[{\"id\":\"nwxuqlcvydyp\",\"name\":\"dooaojkniodko\",\"description\":\"bw\",\"region\":\"jhemms\",\"type\":\"ip\",\"includeByDefault\":false,\"rules\":[{\"source\":\"tjinf\",\"description\":\"lfltka\",\"azureEndpointGuid\":\"vefkdlfoakggk\",\"azureEndpointName\":\"agaowpulpqblylsy\",\"id\":\"qjnsjervtia\"},{\"source\":\"sdszue\",\"description\":\"sbzkf\",\"azureEndpointGuid\":\"eyvpnqicvinvkj\",\"azureEndpointName\":\"dxrbuukzcle\",\"id\":\"hmlwpaztzpo\"}]},{\"id\":\"cckwyfzqwhxxbu\",\"name\":\"a\",\"description\":\"feqztppriol\",\"region\":\"rjaltolmncw\",\"type\":\"azure_private_endpoint\",\"includeByDefault\":true,\"rules\":[{\"source\":\"bnwdcfh\",\"description\":\"qdpfuvglsbjjca\",\"azureEndpointGuid\":\"xbvtvudu\",\"azureEndpointName\":\"cormr\",\"id\":\"qtvcofudflvkgj\"},{\"source\":\"gdknnqv\",\"description\":\"znqntoru\",\"azureEndpointGuid\":\"gsahmkycgrauw\",\"azureEndpointName\":\"etaebu\",\"id\":\"vdmovsmzlxwabm\"},{\"source\":\"efkifr\",\"description\":\"puqujmqlgkfbtn\",\"azureEndpointGuid\":\"aongbj\",\"azureEndpointName\":\"tujitcjedft\",\"id\":\"ae\"},{\"source\":\"ojvdcpzfoqo\",\"description\":\"cybxa\",\"azureEndpointGuid\":\"gszufoxciqopid\",\"azureEndpointName\":\"mciodhkhazxkhn\",\"id\":\"onlwntoeg\"}]},{\"id\":\"dwbwhkszzcmrvexz\",\"name\":\"bt\",\"description\":\"sfraoyzko\",\"region\":\"tlmngu\",\"type\":\"ip\",\"includeByDefault\":false,\"rules\":[{\"source\":\"yuuximerqfobwyzn\",\"description\":\"ykutwpf\",\"azureEndpointGuid\":\"a\",\"azureEndpointName\":\"hrskdsnfd\",\"id\":\"oakgtdlmkkzev\"},{\"source\":\"hewpusdsttwv\",\"description\":\"vbbejdcng\",\"azureEndpointGuid\":\"m\",\"azureEndpointName\":\"kufgmj\",\"id\":\"wr\"},{\"source\":\"rtwaenuuzko\",\"description\":\"minrfdw\",\"azureEndpointGuid\":\"uhhziuiefozbhdm\",\"azureEndpointName\":\"l\",\"id\":\"qhoftrmaequiah\"},{\"source\":\"cslfaoqzpiyylha\",\"description\":\"swhccsphk\",\"azureEndpointGuid\":\"vwitqscyw\",\"azureEndpointName\":\"gwol\",\"id\":\"czbwemhairsbr\"}]},{\"id\":\"dwmsweypqwd\",\"name\":\"gicccnxqhuex\",\"description\":\"ttlstvlzywemhz\",\"region\":\"csdtclusiypbs\",\"type\":\"ip\",\"includeByDefault\":false,\"rules\":[{\"source\":\"feadcygq\",\"description\":\"yhejhzisxgfp\",\"azureEndpointGuid\":\"olppvksrpqvujz\",\"azureEndpointName\":\"ehtwdwrft\",\"id\":\"iby\"}]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ElasticTrafficFilterResponse response - = manager.allTrafficFilters().listWithResponse("eptra", "xje", com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("nwxuqlcvydyp", response.rulesets().get(0).id()); - Assertions.assertEquals("dooaojkniodko", response.rulesets().get(0).name()); - Assertions.assertEquals("bw", response.rulesets().get(0).description()); - Assertions.assertEquals("jhemms", response.rulesets().get(0).region()); - Assertions.assertEquals(Type.IP, response.rulesets().get(0).type()); - Assertions.assertEquals(false, response.rulesets().get(0).includeByDefault()); - Assertions.assertEquals("tjinf", response.rulesets().get(0).rules().get(0).source()); - Assertions.assertEquals("lfltka", response.rulesets().get(0).rules().get(0).description()); - Assertions.assertEquals("vefkdlfoakggk", response.rulesets().get(0).rules().get(0).azureEndpointGuid()); - Assertions.assertEquals("agaowpulpqblylsy", response.rulesets().get(0).rules().get(0).azureEndpointName()); - Assertions.assertEquals("qjnsjervtia", response.rulesets().get(0).rules().get(0).id()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/BillingInfoResponseInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/BillingInfoResponseInnerTests.java deleted file mode 100644 index 05a17f129d2a..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/BillingInfoResponseInnerTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.BillingInfoResponseInner; -import com.azure.resourcemanager.elastic.models.MarketplaceSaaSInfo; -import com.azure.resourcemanager.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription; -import com.azure.resourcemanager.elastic.models.PartnerBillingEntity; -import org.junit.jupiter.api.Assertions; - -public final class BillingInfoResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingInfoResponseInner model = BinaryData.fromString( - "{\"marketplaceSaasInfo\":{\"marketplaceSubscription\":{\"id\":\"lwtgrhpdj\"},\"marketplaceName\":\"umasxazjpq\",\"marketplaceResourceId\":\"gual\",\"marketplaceStatus\":\"xxhejjzzvd\",\"billedAzureSubscriptionId\":\"gwdslfhotwm\",\"subscribed\":true},\"partnerBillingEntity\":{\"id\":\"lbjnpgacftadehx\",\"name\":\"tyfsoppusuesn\",\"partnerEntityUri\":\"dejbavo\"}}") - .toObject(BillingInfoResponseInner.class); - Assertions.assertEquals("lwtgrhpdj", model.marketplaceSaasInfo().marketplaceSubscription().id()); - Assertions.assertEquals("umasxazjpq", model.marketplaceSaasInfo().marketplaceName()); - Assertions.assertEquals("gual", model.marketplaceSaasInfo().marketplaceResourceId()); - Assertions.assertEquals("xxhejjzzvd", model.marketplaceSaasInfo().marketplaceStatus()); - Assertions.assertEquals("gwdslfhotwm", model.marketplaceSaasInfo().billedAzureSubscriptionId()); - Assertions.assertEquals(true, model.marketplaceSaasInfo().subscribed()); - Assertions.assertEquals("lbjnpgacftadehx", model.partnerBillingEntity().id()); - Assertions.assertEquals("tyfsoppusuesn", model.partnerBillingEntity().name()); - Assertions.assertEquals("dejbavo", model.partnerBillingEntity().partnerEntityUri()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingInfoResponseInner model = new BillingInfoResponseInner() - .withMarketplaceSaasInfo(new MarketplaceSaaSInfo() - .withMarketplaceSubscription(new MarketplaceSaaSInfoMarketplaceSubscription().withId("lwtgrhpdj")) - .withMarketplaceName("umasxazjpq") - .withMarketplaceResourceId("gual") - .withMarketplaceStatus("xxhejjzzvd") - .withBilledAzureSubscriptionId("gwdslfhotwm") - .withSubscribed(true)) - .withPartnerBillingEntity(new PartnerBillingEntity().withId("lbjnpgacftadehx") - .withName("tyfsoppusuesn") - .withPartnerEntityUri("dejbavo")); - model = BinaryData.fromObject(model).toObject(BillingInfoResponseInner.class); - Assertions.assertEquals("lwtgrhpdj", model.marketplaceSaasInfo().marketplaceSubscription().id()); - Assertions.assertEquals("umasxazjpq", model.marketplaceSaasInfo().marketplaceName()); - Assertions.assertEquals("gual", model.marketplaceSaasInfo().marketplaceResourceId()); - Assertions.assertEquals("xxhejjzzvd", model.marketplaceSaasInfo().marketplaceStatus()); - Assertions.assertEquals("gwdslfhotwm", model.marketplaceSaasInfo().billedAzureSubscriptionId()); - Assertions.assertEquals(true, model.marketplaceSaasInfo().subscribed()); - Assertions.assertEquals("lbjnpgacftadehx", model.partnerBillingEntity().id()); - Assertions.assertEquals("tyfsoppusuesn", model.partnerBillingEntity().name()); - Assertions.assertEquals("dejbavo", model.partnerBillingEntity().partnerEntityUri()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/BillingInfoesGetWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/BillingInfoesGetWithResponseMockTests.java deleted file mode 100644 index be7629ea1787..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/BillingInfoesGetWithResponseMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.BillingInfoResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingInfoesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"marketplaceSaasInfo\":{\"marketplaceSubscription\":{\"id\":\"ondjmq\"},\"marketplaceName\":\"vypomgkopkwho\",\"marketplaceResourceId\":\"pajqgxysm\",\"marketplaceStatus\":\"mbqfqvmk\",\"billedAzureSubscriptionId\":\"oz\",\"subscribed\":true},\"partnerBillingEntity\":{\"id\":\"lxprglyatddckcbc\",\"name\":\"jrjxgciqibrhosx\",\"partnerEntityUri\":\"qrhzoymibmrqyib\"}}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingInfoResponse response = manager.billingInfoes() - .getWithResponse("aakc", "wiyzvqtmnubexkp", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("ondjmq", response.marketplaceSaasInfo().marketplaceSubscription().id()); - Assertions.assertEquals("vypomgkopkwho", response.marketplaceSaasInfo().marketplaceName()); - Assertions.assertEquals("pajqgxysm", response.marketplaceSaasInfo().marketplaceResourceId()); - Assertions.assertEquals("mbqfqvmk", response.marketplaceSaasInfo().marketplaceStatus()); - Assertions.assertEquals("oz", response.marketplaceSaasInfo().billedAzureSubscriptionId()); - Assertions.assertEquals(true, response.marketplaceSaasInfo().subscribed()); - Assertions.assertEquals("lxprglyatddckcbc", response.partnerBillingEntity().id()); - Assertions.assertEquals("jrjxgciqibrhosx", response.partnerBillingEntity().name()); - Assertions.assertEquals("qrhzoymibmrqyib", response.partnerBillingEntity().partnerEntityUri()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CompanyInfoTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CompanyInfoTests.java deleted file mode 100644 index cda57caa8d12..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CompanyInfoTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.CompanyInfo; -import org.junit.jupiter.api.Assertions; - -public final class CompanyInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CompanyInfo model = BinaryData.fromString( - "{\"domain\":\"u\",\"business\":\"krlkhbzhfepg\",\"employeesNumber\":\"qex\",\"state\":\"ocxscpaierhhbcs\",\"country\":\"ummajtjaod\"}") - .toObject(CompanyInfo.class); - Assertions.assertEquals("u", model.domain()); - Assertions.assertEquals("krlkhbzhfepg", model.business()); - Assertions.assertEquals("qex", model.employeesNumber()); - Assertions.assertEquals("ocxscpaierhhbcs", model.state()); - Assertions.assertEquals("ummajtjaod", model.country()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CompanyInfo model = new CompanyInfo().withDomain("u") - .withBusiness("krlkhbzhfepg") - .withEmployeesNumber("qex") - .withState("ocxscpaierhhbcs") - .withCountry("ummajtjaod"); - model = BinaryData.fromObject(model).toObject(CompanyInfo.class); - Assertions.assertEquals("u", model.domain()); - Assertions.assertEquals("krlkhbzhfepg", model.business()); - Assertions.assertEquals("qex", model.employeesNumber()); - Assertions.assertEquals("ocxscpaierhhbcs", model.state()); - Assertions.assertEquals("ummajtjaod", model.country()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcePropertiesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcePropertiesTests.java deleted file mode 100644 index dfa89e940631..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcePropertiesTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ConnectedPartnerResourceProperties; -import org.junit.jupiter.api.Assertions; - -public final class ConnectedPartnerResourcePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ConnectedPartnerResourceProperties model = BinaryData.fromString( - "{\"partnerDeploymentName\":\"mcmatuokthfuiu\",\"partnerDeploymentUri\":\"dsfcpkvxodpuoz\",\"azureResourceId\":\"zydagfuaxbezyiuo\",\"location\":\"twhrdxwzywqsm\"}") - .toObject(ConnectedPartnerResourceProperties.class); - Assertions.assertEquals("mcmatuokthfuiu", model.partnerDeploymentName()); - Assertions.assertEquals("dsfcpkvxodpuoz", model.partnerDeploymentUri()); - Assertions.assertEquals("zydagfuaxbezyiuo", model.azureResourceId()); - Assertions.assertEquals("twhrdxwzywqsm", model.location()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ConnectedPartnerResourceProperties model - = new ConnectedPartnerResourceProperties().withPartnerDeploymentName("mcmatuokthfuiu") - .withPartnerDeploymentUri("dsfcpkvxodpuoz") - .withAzureResourceId("zydagfuaxbezyiuo") - .withLocation("twhrdxwzywqsm"); - model = BinaryData.fromObject(model).toObject(ConnectedPartnerResourceProperties.class); - Assertions.assertEquals("mcmatuokthfuiu", model.partnerDeploymentName()); - Assertions.assertEquals("dsfcpkvxodpuoz", model.partnerDeploymentUri()); - Assertions.assertEquals("zydagfuaxbezyiuo", model.azureResourceId()); - Assertions.assertEquals("twhrdxwzywqsm", model.location()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListFormatInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListFormatInnerTests.java deleted file mode 100644 index da15b2972400..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListFormatInnerTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.ConnectedPartnerResourcesListFormatInner; -import com.azure.resourcemanager.elastic.models.ConnectedPartnerResourceProperties; -import org.junit.jupiter.api.Assertions; - -public final class ConnectedPartnerResourcesListFormatInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ConnectedPartnerResourcesListFormatInner model = BinaryData.fromString( - "{\"properties\":{\"partnerDeploymentName\":\"v\",\"partnerDeploymentUri\":\"sounqecanoaeu\",\"azureResourceId\":\"hy\",\"location\":\"trpmo\"}}") - .toObject(ConnectedPartnerResourcesListFormatInner.class); - Assertions.assertEquals("v", model.properties().partnerDeploymentName()); - Assertions.assertEquals("sounqecanoaeu", model.properties().partnerDeploymentUri()); - Assertions.assertEquals("hy", model.properties().azureResourceId()); - Assertions.assertEquals("trpmo", model.properties().location()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ConnectedPartnerResourcesListFormatInner model = new ConnectedPartnerResourcesListFormatInner() - .withProperties(new ConnectedPartnerResourceProperties().withPartnerDeploymentName("v") - .withPartnerDeploymentUri("sounqecanoaeu") - .withAzureResourceId("hy") - .withLocation("trpmo")); - model = BinaryData.fromObject(model).toObject(ConnectedPartnerResourcesListFormatInner.class); - Assertions.assertEquals("v", model.properties().partnerDeploymentName()); - Assertions.assertEquals("sounqecanoaeu", model.properties().partnerDeploymentUri()); - Assertions.assertEquals("hy", model.properties().azureResourceId()); - Assertions.assertEquals("trpmo", model.properties().location()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListMockTests.java deleted file mode 100644 index 343e97db57d8..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.ConnectedPartnerResourcesListFormat; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ConnectedPartnerResourcesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"partnerDeploymentName\":\"qacpiex\",\"partnerDeploymentUri\":\"tg\",\"azureResourceId\":\"bwoenwashrt\",\"location\":\"kcnqxwbpo\"}}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.connectedPartnerResources().list("hwflu", "zdtmhrkwofy", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("qacpiex", response.iterator().next().properties().partnerDeploymentName()); - Assertions.assertEquals("tg", response.iterator().next().properties().partnerDeploymentUri()); - Assertions.assertEquals("bwoenwashrt", response.iterator().next().properties().azureResourceId()); - Assertions.assertEquals("kcnqxwbpo", response.iterator().next().properties().location()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListResponseTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListResponseTests.java deleted file mode 100644 index 6277e27af5e2..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ConnectedPartnerResourcesListResponseTests.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.ConnectedPartnerResourcesListFormatInner; -import com.azure.resourcemanager.elastic.models.ConnectedPartnerResourceProperties; -import com.azure.resourcemanager.elastic.models.ConnectedPartnerResourcesListResponse; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ConnectedPartnerResourcesListResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ConnectedPartnerResourcesListResponse model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"partnerDeploymentName\":\"ugw\",\"partnerDeploymentUri\":\"cglhslazjdyggdt\",\"azureResourceId\":\"xhbkuofq\",\"location\":\"yk\"}},{\"properties\":{\"partnerDeploymentName\":\"n\",\"partnerDeploymentUri\":\"fyexfwhy\",\"azureResourceId\":\"i\",\"location\":\"yvdcsitynnaa\"}},{\"properties\":{\"partnerDeploymentName\":\"ctehfiqscjey\",\"partnerDeploymentUri\":\"hezrkgq\",\"azureResourceId\":\"jrefovgmkqsle\",\"location\":\"vxyqjpkcattpngjc\"}}],\"nextLink\":\"czsqpjhvm\"}") - .toObject(ConnectedPartnerResourcesListResponse.class); - Assertions.assertEquals("ugw", model.value().get(0).properties().partnerDeploymentName()); - Assertions.assertEquals("cglhslazjdyggdt", model.value().get(0).properties().partnerDeploymentUri()); - Assertions.assertEquals("xhbkuofq", model.value().get(0).properties().azureResourceId()); - Assertions.assertEquals("yk", model.value().get(0).properties().location()); - Assertions.assertEquals("czsqpjhvm", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ConnectedPartnerResourcesListResponse model - = new ConnectedPartnerResourcesListResponse().withValue(Arrays.asList( - new ConnectedPartnerResourcesListFormatInner() - .withProperties(new ConnectedPartnerResourceProperties().withPartnerDeploymentName("ugw") - .withPartnerDeploymentUri("cglhslazjdyggdt") - .withAzureResourceId("xhbkuofq") - .withLocation("yk")), - new ConnectedPartnerResourcesListFormatInner() - .withProperties(new ConnectedPartnerResourceProperties().withPartnerDeploymentName("n") - .withPartnerDeploymentUri("fyexfwhy") - .withAzureResourceId("i") - .withLocation("yvdcsitynnaa")), - new ConnectedPartnerResourcesListFormatInner() - .withProperties(new ConnectedPartnerResourceProperties().withPartnerDeploymentName("ctehfiqscjey") - .withPartnerDeploymentUri("hezrkgq") - .withAzureResourceId("jrefovgmkqsle") - .withLocation("vxyqjpkcattpngjc")))) - .withNextLink("czsqpjhvm"); - model = BinaryData.fromObject(model).toObject(ConnectedPartnerResourcesListResponse.class); - Assertions.assertEquals("ugw", model.value().get(0).properties().partnerDeploymentName()); - Assertions.assertEquals("cglhslazjdyggdt", model.value().get(0).properties().partnerDeploymentUri()); - Assertions.assertEquals("xhbkuofq", model.value().get(0).properties().azureResourceId()); - Assertions.assertEquals("yk", model.value().get(0).properties().location()); - Assertions.assertEquals("czsqpjhvm", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociateIpFiltersCreateMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociateIpFiltersCreateMockTests.java deleted file mode 100644 index 8f16b35c240b..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociateIpFiltersCreateMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class CreateAndAssociateIpFiltersCreateMockTests { - @Test - public void testCreate() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.createAndAssociateIpFilters() - .create("yhmtnvyqiat", "zwpcnpwzcjaesg", "v", "ccyajg", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociatePLFiltersCreateMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociatePLFiltersCreateMockTests.java deleted file mode 100644 index 5ea0dff9ca84..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociatePLFiltersCreateMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class CreateAndAssociatePLFiltersCreateMockTests { - @Test - public void testCreate() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.createAndAssociatePLFilters() - .create("qfhwyg", "lvdnkfx", "semdwzrmu", "apfcqdpsq", "qvpsvuoymg", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoResponseInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoResponseInnerTests.java deleted file mode 100644 index 7d1597660c89..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoResponseInnerTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.DeploymentInfoResponseInner; - -public final class DeploymentInfoResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DeploymentInfoResponseInner model = BinaryData.fromString( - "{\"status\":\"Healthy\",\"version\":\"ayvvtpgvdf\",\"memoryCapacity\":\"otkftutqxlngx\",\"diskCapacity\":\"fgugnxkrxdqmid\",\"elasticsearchEndPoint\":\"hzrvqd\",\"deploymentUrl\":\"bhj\",\"marketplaceSaasInfo\":{\"marketplaceSubscription\":{\"id\":\"ehoqfbowskan\"},\"marketplaceName\":\"tzlcuiywgqywgn\",\"marketplaceResourceId\":\"vynhzgpphrcg\",\"marketplaceStatus\":\"cocpecfvmmcoofsx\",\"billedAzureSubscriptionId\":\"evgbmqjq\",\"subscribed\":false}}") - .toObject(DeploymentInfoResponseInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DeploymentInfoResponseInner model = new DeploymentInfoResponseInner(); - model = BinaryData.fromObject(model).toObject(DeploymentInfoResponseInner.class); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoesListWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoesListWithResponseMockTests.java deleted file mode 100644 index 5902751f2ef2..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoesListWithResponseMockTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.DeploymentInfoResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DeploymentInfoesListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - String responseStr - = "{\"status\":\"Healthy\",\"version\":\"uflrwd\",\"memoryCapacity\":\"dlxyjrxs\",\"diskCapacity\":\"afcnih\",\"elasticsearchEndPoint\":\"qapnedgfbcv\",\"deploymentUrl\":\"vq\",\"marketplaceSaasInfo\":{\"marketplaceSubscription\":{\"id\":\"qdcvdrhvoo\"},\"marketplaceName\":\"otbobzdopcj\",\"marketplaceResourceId\":\"nhdldwmgxcx\",\"marketplaceStatus\":\"lpmutwuoegrpkhj\",\"billedAzureSubscriptionId\":\"iyq\",\"subscribed\":false}}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DeploymentInfoResponse response = manager.deploymentInfoes() - .listWithResponse("swacffgdkzz", "wkfvhqcrailvp", com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DetachAndDeleteTrafficFiltersDeleteWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DetachAndDeleteTrafficFiltersDeleteWithResponseMockTests.java deleted file mode 100644 index 4a1dc26552f4..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DetachAndDeleteTrafficFiltersDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DetachAndDeleteTrafficFiltersDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.detachAndDeleteTrafficFilters() - .deleteWithResponse("celve", "rypqlmfeo", "erqwkyhkobopg", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudDeploymentTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudDeploymentTests.java deleted file mode 100644 index cd66cb2bcb94..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudDeploymentTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticCloudDeployment; - -public final class ElasticCloudDeploymentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticCloudDeployment model = BinaryData.fromString( - "{\"name\":\"sezcxtb\",\"deploymentId\":\"gfycc\",\"azureSubscriptionId\":\"ewmdw\",\"elasticsearchRegion\":\"eiachboosflnr\",\"elasticsearchServiceUrl\":\"fqpte\",\"kibanaServiceUrl\":\"zzvypyqrimzinp\",\"kibanaSsoUrl\":\"wjdk\"}") - .toObject(ElasticCloudDeployment.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticCloudDeployment model = new ElasticCloudDeployment(); - model = BinaryData.fromObject(model).toObject(ElasticCloudDeployment.class); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudUserTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudUserTests.java deleted file mode 100644 index 705bf37bfe25..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudUserTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticCloudUser; - -public final class ElasticCloudUserTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticCloudUser model = BinaryData.fromString( - "{\"emailAddress\":\"dkfthwxmnt\",\"id\":\"waopvkmijcmmxd\",\"elasticCloudSsoDefaultUrl\":\"fufsrpymzi\"}") - .toObject(ElasticCloudUser.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticCloudUser model = new ElasticCloudUser(); - model = BinaryData.fromObject(model).toObject(ElasticCloudUser.class); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorResourceUpdateParametersTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorResourceUpdateParametersTests.java deleted file mode 100644 index de2a7c0bd6d2..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorResourceUpdateParametersTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticMonitorResourceUpdateParameters; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ElasticMonitorResourceUpdateParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticMonitorResourceUpdateParameters model = BinaryData.fromString("{\"tags\":{\"mjthjqkwp\":\"fcyddg\"}}") - .toObject(ElasticMonitorResourceUpdateParameters.class); - Assertions.assertEquals("fcyddg", model.tags().get("mjthjqkwp")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticMonitorResourceUpdateParameters model - = new ElasticMonitorResourceUpdateParameters().withTags(mapOf("mjthjqkwp", "fcyddg")); - model = BinaryData.fromObject(model).toObject(ElasticMonitorResourceUpdateParameters.class); - Assertions.assertEquals("fcyddg", model.tags().get("mjthjqkwp")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorUpgradeTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorUpgradeTests.java deleted file mode 100644 index 3e803667f4c9..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorUpgradeTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticMonitorUpgrade; -import org.junit.jupiter.api.Assertions; - -public final class ElasticMonitorUpgradeTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticMonitorUpgrade model - = BinaryData.fromString("{\"version\":\"fbebrjcxer\"}").toObject(ElasticMonitorUpgrade.class); - Assertions.assertEquals("fbebrjcxer", model.version()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticMonitorUpgrade model = new ElasticMonitorUpgrade().withVersion("fbebrjcxer"); - model = BinaryData.fromObject(model).toObject(ElasticMonitorUpgrade.class); - Assertions.assertEquals("fbebrjcxer", model.version()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticOrganizationToAzureSubscriptionMappingResponseInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticOrganizationToAzureSubscriptionMappingResponseInnerTests.java deleted file mode 100644 index 059a627b9dad..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticOrganizationToAzureSubscriptionMappingResponseInnerTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.ElasticOrganizationToAzureSubscriptionMappingResponseInner; -import com.azure.resourcemanager.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties; -import org.junit.jupiter.api.Assertions; - -public final class ElasticOrganizationToAzureSubscriptionMappingResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticOrganizationToAzureSubscriptionMappingResponseInner model = BinaryData.fromString( - "{\"properties\":{\"billedAzureSubscriptionId\":\"i\",\"marketplaceSaasInfo\":{\"marketplaceSubscription\":{\"id\":\"ceoveilovno\"},\"marketplaceName\":\"fj\",\"marketplaceResourceId\":\"njbkcnxdhbttkph\",\"marketplaceStatus\":\"pnvjtoqnermclf\",\"billedAzureSubscriptionId\":\"phoxus\",\"subscribed\":false},\"elasticOrganizationId\":\"bgyepsbj\",\"elasticOrganizationName\":\"zq\"}}") - .toObject(ElasticOrganizationToAzureSubscriptionMappingResponseInner.class); - Assertions.assertEquals("i", model.properties().billedAzureSubscriptionId()); - Assertions.assertEquals("bgyepsbj", model.properties().elasticOrganizationId()); - Assertions.assertEquals("zq", model.properties().elasticOrganizationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticOrganizationToAzureSubscriptionMappingResponseInner model - = new ElasticOrganizationToAzureSubscriptionMappingResponseInner().withProperties( - new ElasticOrganizationToAzureSubscriptionMappingResponseProperties().withBilledAzureSubscriptionId("i") - .withElasticOrganizationId("bgyepsbj") - .withElasticOrganizationName("zq")); - model = BinaryData.fromObject(model).toObject(ElasticOrganizationToAzureSubscriptionMappingResponseInner.class); - Assertions.assertEquals("i", model.properties().billedAzureSubscriptionId()); - Assertions.assertEquals("bgyepsbj", model.properties().elasticOrganizationId()); - Assertions.assertEquals("zq", model.properties().elasticOrganizationName()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticOrganizationToAzureSubscriptionMappingResponsePropertiesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticOrganizationToAzureSubscriptionMappingResponsePropertiesTests.java deleted file mode 100644 index 614f04ab2028..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticOrganizationToAzureSubscriptionMappingResponsePropertiesTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponseProperties; -import org.junit.jupiter.api.Assertions; - -public final class ElasticOrganizationToAzureSubscriptionMappingResponsePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticOrganizationToAzureSubscriptionMappingResponseProperties model = BinaryData.fromString( - "{\"billedAzureSubscriptionId\":\"xywpmueefjzwfqkq\",\"marketplaceSaasInfo\":{\"marketplaceSubscription\":{\"id\":\"suyonobglaocq\"},\"marketplaceName\":\"ccm\",\"marketplaceResourceId\":\"udxytlmoyrx\",\"marketplaceStatus\":\"fudwpznt\",\"billedAzureSubscriptionId\":\"dzhlrq\",\"subscribed\":true},\"elasticOrganizationId\":\"kfrlhrxsbky\",\"elasticOrganizationName\":\"ycanuzbpzkafku\"}") - .toObject(ElasticOrganizationToAzureSubscriptionMappingResponseProperties.class); - Assertions.assertEquals("xywpmueefjzwfqkq", model.billedAzureSubscriptionId()); - Assertions.assertEquals("kfrlhrxsbky", model.elasticOrganizationId()); - Assertions.assertEquals("ycanuzbpzkafku", model.elasticOrganizationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticOrganizationToAzureSubscriptionMappingResponseProperties model - = new ElasticOrganizationToAzureSubscriptionMappingResponseProperties() - .withBilledAzureSubscriptionId("xywpmueefjzwfqkq") - .withElasticOrganizationId("kfrlhrxsbky") - .withElasticOrganizationName("ycanuzbpzkafku"); - model = BinaryData.fromObject(model) - .toObject(ElasticOrganizationToAzureSubscriptionMappingResponseProperties.class); - Assertions.assertEquals("xywpmueefjzwfqkq", model.billedAzureSubscriptionId()); - Assertions.assertEquals("kfrlhrxsbky", model.elasticOrganizationId()); - Assertions.assertEquals("ycanuzbpzkafku", model.elasticOrganizationName()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticPropertiesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticPropertiesTests.java deleted file mode 100644 index 14196b9e2cee..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticPropertiesTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticCloudDeployment; -import com.azure.resourcemanager.elastic.models.ElasticCloudUser; -import com.azure.resourcemanager.elastic.models.ElasticProperties; - -public final class ElasticPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticProperties model = BinaryData.fromString( - "{\"elasticCloudUser\":{\"emailAddress\":\"szdnr\",\"id\":\"qguhmuo\",\"elasticCloudSsoDefaultUrl\":\"f\"},\"elasticCloudDeployment\":{\"name\":\"zw\",\"deploymentId\":\"g\",\"azureSubscriptionId\":\"tnwu\",\"elasticsearchRegion\":\"gazxuf\",\"elasticsearchServiceUrl\":\"uckyf\",\"kibanaServiceUrl\":\"rfidfvzwdz\",\"kibanaSsoUrl\":\"tymw\"}}") - .toObject(ElasticProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticProperties model = new ElasticProperties().withElasticCloudUser(new ElasticCloudUser()) - .withElasticCloudDeployment(new ElasticCloudDeployment()); - model = BinaryData.fromObject(model).toObject(ElasticProperties.class); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterResponseInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterResponseInnerTests.java deleted file mode 100644 index 4057e21d4e95..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterResponseInnerTests.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.ElasticTrafficFilterResponseInner; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilter; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilterRule; -import com.azure.resourcemanager.elastic.models.Type; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ElasticTrafficFilterResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticTrafficFilterResponseInner model = BinaryData.fromString( - "{\"rulesets\":[{\"id\":\"tttxfvjrb\",\"name\":\"phxepcyvahf\",\"description\":\"jky\",\"region\":\"j\",\"type\":\"ip\",\"includeByDefault\":true,\"rules\":[{\"source\":\"ok\",\"description\":\"ljyoxgvcltb\",\"azureEndpointGuid\":\"ncghkje\",\"azureEndpointName\":\"zhbijhtxfv\",\"id\":\"bfs\"},{\"source\":\"nehmpvecx\",\"description\":\"debfqkkrbmpukgri\",\"azureEndpointGuid\":\"lzlfbxzpuz\",\"azureEndpointName\":\"ispnqzahmgkbrp\",\"id\":\"dhibnuq\"}]},{\"id\":\"pikad\",\"name\":\"vtq\",\"description\":\"n\",\"region\":\"ynhijggme\",\"type\":\"azure_private_endpoint\",\"includeByDefault\":false,\"rules\":[{\"source\":\"trcvpnazzmh\",\"description\":\"unmpxttd\",\"azureEndpointGuid\":\"rbnlankxmyskp\",\"azureEndpointName\":\"enbtkcxywny\",\"id\":\"rsyn\"}]},{\"id\":\"idybyxczf\",\"name\":\"haaxdbabphl\",\"description\":\"qlfktsths\",\"region\":\"ocmnyyazttbtwwrq\",\"type\":\"azure_private_endpoint\",\"includeByDefault\":true,\"rules\":[{\"source\":\"wbiexzfey\",\"description\":\"axibxujw\",\"azureEndpointGuid\":\"qwalmuzyoxaepd\",\"azureEndpointName\":\"jancu\",\"id\":\"hdwbavxbniwdjs\"},{\"source\":\"tsdbpgn\",\"description\":\"txhp\",\"azureEndpointGuid\":\"bzpfzab\",\"azureEndpointName\":\"cuh\",\"id\":\"tcty\"}]}]}") - .toObject(ElasticTrafficFilterResponseInner.class); - Assertions.assertEquals("tttxfvjrb", model.rulesets().get(0).id()); - Assertions.assertEquals("phxepcyvahf", model.rulesets().get(0).name()); - Assertions.assertEquals("jky", model.rulesets().get(0).description()); - Assertions.assertEquals("j", model.rulesets().get(0).region()); - Assertions.assertEquals(Type.IP, model.rulesets().get(0).type()); - Assertions.assertEquals(true, model.rulesets().get(0).includeByDefault()); - Assertions.assertEquals("ok", model.rulesets().get(0).rules().get(0).source()); - Assertions.assertEquals("ljyoxgvcltb", model.rulesets().get(0).rules().get(0).description()); - Assertions.assertEquals("ncghkje", model.rulesets().get(0).rules().get(0).azureEndpointGuid()); - Assertions.assertEquals("zhbijhtxfv", model.rulesets().get(0).rules().get(0).azureEndpointName()); - Assertions.assertEquals("bfs", model.rulesets().get(0).rules().get(0).id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticTrafficFilterResponseInner model = new ElasticTrafficFilterResponseInner().withRulesets(Arrays.asList( - new ElasticTrafficFilter().withId("tttxfvjrb") - .withName("phxepcyvahf") - .withDescription("jky") - .withRegion("j") - .withType(Type.IP) - .withIncludeByDefault(true) - .withRules(Arrays.asList( - new ElasticTrafficFilterRule().withSource("ok") - .withDescription("ljyoxgvcltb") - .withAzureEndpointGuid("ncghkje") - .withAzureEndpointName("zhbijhtxfv") - .withId("bfs"), - new ElasticTrafficFilterRule().withSource("nehmpvecx") - .withDescription("debfqkkrbmpukgri") - .withAzureEndpointGuid("lzlfbxzpuz") - .withAzureEndpointName("ispnqzahmgkbrp") - .withId("dhibnuq"))), - new ElasticTrafficFilter().withId("pikad") - .withName("vtq") - .withDescription("n") - .withRegion("ynhijggme") - .withType(Type.AZURE_PRIVATE_ENDPOINT) - .withIncludeByDefault(false) - .withRules(Arrays.asList(new ElasticTrafficFilterRule().withSource("trcvpnazzmh") - .withDescription("unmpxttd") - .withAzureEndpointGuid("rbnlankxmyskp") - .withAzureEndpointName("enbtkcxywny") - .withId("rsyn"))), - new ElasticTrafficFilter().withId("idybyxczf") - .withName("haaxdbabphl") - .withDescription("qlfktsths") - .withRegion("ocmnyyazttbtwwrq") - .withType(Type.AZURE_PRIVATE_ENDPOINT) - .withIncludeByDefault(true) - .withRules(Arrays.asList( - new ElasticTrafficFilterRule().withSource("wbiexzfey") - .withDescription("axibxujw") - .withAzureEndpointGuid("qwalmuzyoxaepd") - .withAzureEndpointName("jancu") - .withId("hdwbavxbniwdjs"), - new ElasticTrafficFilterRule().withSource("tsdbpgn") - .withDescription("txhp") - .withAzureEndpointGuid("bzpfzab") - .withAzureEndpointName("cuh") - .withId("tcty"))))); - model = BinaryData.fromObject(model).toObject(ElasticTrafficFilterResponseInner.class); - Assertions.assertEquals("tttxfvjrb", model.rulesets().get(0).id()); - Assertions.assertEquals("phxepcyvahf", model.rulesets().get(0).name()); - Assertions.assertEquals("jky", model.rulesets().get(0).description()); - Assertions.assertEquals("j", model.rulesets().get(0).region()); - Assertions.assertEquals(Type.IP, model.rulesets().get(0).type()); - Assertions.assertEquals(true, model.rulesets().get(0).includeByDefault()); - Assertions.assertEquals("ok", model.rulesets().get(0).rules().get(0).source()); - Assertions.assertEquals("ljyoxgvcltb", model.rulesets().get(0).rules().get(0).description()); - Assertions.assertEquals("ncghkje", model.rulesets().get(0).rules().get(0).azureEndpointGuid()); - Assertions.assertEquals("zhbijhtxfv", model.rulesets().get(0).rules().get(0).azureEndpointName()); - Assertions.assertEquals("bfs", model.rulesets().get(0).rules().get(0).id()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterRuleTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterRuleTests.java deleted file mode 100644 index b4dc1f636315..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterRuleTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilterRule; -import org.junit.jupiter.api.Assertions; - -public final class ElasticTrafficFilterRuleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticTrafficFilterRule model = BinaryData.fromString( - "{\"source\":\"eojnabc\",\"description\":\"smtxpsieb\",\"azureEndpointGuid\":\"hvpesapskrdqm\",\"azureEndpointName\":\"jdhtldwkyzxu\",\"id\":\"kn\"}") - .toObject(ElasticTrafficFilterRule.class); - Assertions.assertEquals("eojnabc", model.source()); - Assertions.assertEquals("smtxpsieb", model.description()); - Assertions.assertEquals("hvpesapskrdqm", model.azureEndpointGuid()); - Assertions.assertEquals("jdhtldwkyzxu", model.azureEndpointName()); - Assertions.assertEquals("kn", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticTrafficFilterRule model = new ElasticTrafficFilterRule().withSource("eojnabc") - .withDescription("smtxpsieb") - .withAzureEndpointGuid("hvpesapskrdqm") - .withAzureEndpointName("jdhtldwkyzxu") - .withId("kn"); - model = BinaryData.fromObject(model).toObject(ElasticTrafficFilterRule.class); - Assertions.assertEquals("eojnabc", model.source()); - Assertions.assertEquals("smtxpsieb", model.description()); - Assertions.assertEquals("hvpesapskrdqm", model.azureEndpointGuid()); - Assertions.assertEquals("jdhtldwkyzxu", model.azureEndpointName()); - Assertions.assertEquals("kn", model.id()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterTests.java deleted file mode 100644 index 752a7d7b908d..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterTests.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilter; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilterRule; -import com.azure.resourcemanager.elastic.models.Type; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ElasticTrafficFilterTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticTrafficFilter model = BinaryData.fromString( - "{\"id\":\"klbb\",\"name\":\"plwzbhvgyugu\",\"description\":\"vmkfssxqu\",\"region\":\"fpl\",\"type\":\"azure_private_endpoint\",\"includeByDefault\":true,\"rules\":[{\"source\":\"zkd\",\"description\":\"lpvlopw\",\"azureEndpointGuid\":\"ighxpk\",\"azureEndpointName\":\"zb\",\"id\":\"uebbaumnyqup\"}]}") - .toObject(ElasticTrafficFilter.class); - Assertions.assertEquals("klbb", model.id()); - Assertions.assertEquals("plwzbhvgyugu", model.name()); - Assertions.assertEquals("vmkfssxqu", model.description()); - Assertions.assertEquals("fpl", model.region()); - Assertions.assertEquals(Type.AZURE_PRIVATE_ENDPOINT, model.type()); - Assertions.assertEquals(true, model.includeByDefault()); - Assertions.assertEquals("zkd", model.rules().get(0).source()); - Assertions.assertEquals("lpvlopw", model.rules().get(0).description()); - Assertions.assertEquals("ighxpk", model.rules().get(0).azureEndpointGuid()); - Assertions.assertEquals("zb", model.rules().get(0).azureEndpointName()); - Assertions.assertEquals("uebbaumnyqup", model.rules().get(0).id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticTrafficFilter model = new ElasticTrafficFilter().withId("klbb") - .withName("plwzbhvgyugu") - .withDescription("vmkfssxqu") - .withRegion("fpl") - .withType(Type.AZURE_PRIVATE_ENDPOINT) - .withIncludeByDefault(true) - .withRules(Arrays.asList(new ElasticTrafficFilterRule().withSource("zkd") - .withDescription("lpvlopw") - .withAzureEndpointGuid("ighxpk") - .withAzureEndpointName("zb") - .withId("uebbaumnyqup"))); - model = BinaryData.fromObject(model).toObject(ElasticTrafficFilter.class); - Assertions.assertEquals("klbb", model.id()); - Assertions.assertEquals("plwzbhvgyugu", model.name()); - Assertions.assertEquals("vmkfssxqu", model.description()); - Assertions.assertEquals("fpl", model.region()); - Assertions.assertEquals(Type.AZURE_PRIVATE_ENDPOINT, model.type()); - Assertions.assertEquals(true, model.includeByDefault()); - Assertions.assertEquals("zkd", model.rules().get(0).source()); - Assertions.assertEquals("lpvlopw", model.rules().get(0).description()); - Assertions.assertEquals("ighxpk", model.rules().get(0).azureEndpointGuid()); - Assertions.assertEquals("zb", model.rules().get(0).azureEndpointName()); - Assertions.assertEquals("uebbaumnyqup", model.rules().get(0).id()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionListFormatInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionListFormatInnerTests.java deleted file mode 100644 index 7841adaff611..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionListFormatInnerTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner; -import com.azure.resourcemanager.elastic.models.ElasticVersionListProperties; -import org.junit.jupiter.api.Assertions; - -public final class ElasticVersionListFormatInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticVersionListFormatInner model = BinaryData.fromString("{\"properties\":{\"version\":\"wndeicbtwnp\"}}") - .toObject(ElasticVersionListFormatInner.class); - Assertions.assertEquals("wndeicbtwnp", model.properties().version()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticVersionListFormatInner model = new ElasticVersionListFormatInner() - .withProperties(new ElasticVersionListProperties().withVersion("wndeicbtwnp")); - model = BinaryData.fromObject(model).toObject(ElasticVersionListFormatInner.class); - Assertions.assertEquals("wndeicbtwnp", model.properties().version()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionListPropertiesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionListPropertiesTests.java deleted file mode 100644 index 339c50d9556e..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionListPropertiesTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticVersionListProperties; -import org.junit.jupiter.api.Assertions; - -public final class ElasticVersionListPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticVersionListProperties model - = BinaryData.fromString("{\"version\":\"oqvuhr\"}").toObject(ElasticVersionListProperties.class); - Assertions.assertEquals("oqvuhr", model.version()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticVersionListProperties model = new ElasticVersionListProperties().withVersion("oqvuhr"); - model = BinaryData.fromObject(model).toObject(ElasticVersionListProperties.class); - Assertions.assertEquals("oqvuhr", model.version()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListMockTests.java deleted file mode 100644 index bdc726113553..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListMockTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.ElasticVersionListFormat; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ElasticVersionsListMockTests { - @Test - public void testList() throws Exception { - String responseStr = "{\"value\":[{\"properties\":{\"version\":\"htozfikdow\"}}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.elasticVersions().list("hdneuelfph", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("htozfikdow", response.iterator().next().properties().version()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListResponseTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListResponseTests.java deleted file mode 100644 index 9341769a20cf..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListResponseTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner; -import com.azure.resourcemanager.elastic.models.ElasticVersionListProperties; -import com.azure.resourcemanager.elastic.models.ElasticVersionsListResponse; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ElasticVersionsListResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticVersionsListResponse model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"version\":\"ukdkexxppofmxa\"}},{\"properties\":{\"version\":\"jpgd\"}},{\"properties\":{\"version\":\"c\"}},{\"properties\":{\"version\":\"hvpmoue\"}}],\"nextLink\":\"dzxibqeojnxqbzvd\"}") - .toObject(ElasticVersionsListResponse.class); - Assertions.assertEquals("ukdkexxppofmxa", model.value().get(0).properties().version()); - Assertions.assertEquals("dzxibqeojnxqbzvd", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticVersionsListResponse model = new ElasticVersionsListResponse().withValue(Arrays.asList( - new ElasticVersionListFormatInner() - .withProperties(new ElasticVersionListProperties().withVersion("ukdkexxppofmxa")), - new ElasticVersionListFormatInner().withProperties(new ElasticVersionListProperties().withVersion("jpgd")), - new ElasticVersionListFormatInner().withProperties(new ElasticVersionListProperties().withVersion("c")), - new ElasticVersionListFormatInner() - .withProperties(new ElasticVersionListProperties().withVersion("hvpmoue")))) - .withNextLink("dzxibqeojnxqbzvd"); - model = BinaryData.fromObject(model).toObject(ElasticVersionsListResponse.class); - Assertions.assertEquals("ukdkexxppofmxa", model.value().get(0).properties().version()); - Assertions.assertEquals("dzxibqeojnxqbzvd", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ExternalUserCreationResponseInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ExternalUserCreationResponseInnerTests.java deleted file mode 100644 index 1a5312de0b6a..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ExternalUserCreationResponseInnerTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.ExternalUserCreationResponseInner; - -public final class ExternalUserCreationResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExternalUserCreationResponseInner model - = BinaryData.fromString("{\"created\":false}").toObject(ExternalUserCreationResponseInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExternalUserCreationResponseInner model = new ExternalUserCreationResponseInner(); - model = BinaryData.fromObject(model).toObject(ExternalUserCreationResponseInner.class); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/FilteringTagTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/FilteringTagTests.java deleted file mode 100644 index c6a170bc424e..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/FilteringTagTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.FilteringTag; -import com.azure.resourcemanager.elastic.models.TagAction; -import org.junit.jupiter.api.Assertions; - -public final class FilteringTagTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FilteringTag model - = BinaryData.fromString("{\"name\":\"icohoqqnwvl\",\"value\":\"avwhheunm\",\"action\":\"Exclude\"}") - .toObject(FilteringTag.class); - Assertions.assertEquals("icohoqqnwvl", model.name()); - Assertions.assertEquals("avwhheunm", model.value()); - Assertions.assertEquals(TagAction.EXCLUDE, model.action()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FilteringTag model - = new FilteringTag().withName("icohoqqnwvl").withValue("avwhheunm").withAction(TagAction.EXCLUDE); - model = BinaryData.fromObject(model).toObject(FilteringTag.class); - Assertions.assertEquals("icohoqqnwvl", model.name()); - Assertions.assertEquals("avwhheunm", model.value()); - Assertions.assertEquals(TagAction.EXCLUDE, model.action()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/IdentityPropertiesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/IdentityPropertiesTests.java deleted file mode 100644 index c692a41d6413..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/IdentityPropertiesTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.IdentityProperties; -import com.azure.resourcemanager.elastic.models.ManagedIdentityTypes; -import org.junit.jupiter.api.Assertions; - -public final class IdentityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IdentityProperties model = BinaryData - .fromString("{\"principalId\":\"ijcoejctb\",\"tenantId\":\"qsqsy\",\"type\":\"SystemAssigned\"}") - .toObject(IdentityProperties.class); - Assertions.assertEquals(ManagedIdentityTypes.SYSTEM_ASSIGNED, model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IdentityProperties model = new IdentityProperties().withType(ManagedIdentityTypes.SYSTEM_ASSIGNED); - model = BinaryData.fromObject(model).toObject(IdentityProperties.class); - Assertions.assertEquals(ManagedIdentityTypes.SYSTEM_ASSIGNED, model.type()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ListAssociatedTrafficFiltersListWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ListAssociatedTrafficFiltersListWithResponseMockTests.java deleted file mode 100644 index d1d19e81b5e5..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ListAssociatedTrafficFiltersListWithResponseMockTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilterResponse; -import com.azure.resourcemanager.elastic.models.Type; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ListAssociatedTrafficFiltersListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - String responseStr - = "{\"rulesets\":[{\"id\":\"p\",\"name\":\"cstwity\",\"description\":\"evxccedcp\",\"region\":\"dyodnwzxltj\",\"type\":\"azure_private_endpoint\",\"includeByDefault\":true,\"rules\":[{\"source\":\"gcxn\",\"description\":\"vwxqibyqunyo\",\"azureEndpointGuid\":\"wlmdjrkv\",\"azureEndpointName\":\"bvfvpdbod\",\"id\":\"izsjqlhkrr\"},{\"source\":\"deibqip\",\"description\":\"ghvxndzwmkrefa\",\"azureEndpointGuid\":\"jorwkqnyhgbij\",\"azureEndpointName\":\"ivfxzsjabibsyst\",\"id\":\"fsdjpvkvp\"},{\"source\":\"xbkzbzkdvncj\",\"description\":\"udurgkakmokz\",\"azureEndpointGuid\":\"jk\",\"azureEndpointName\":\"fhmouwq\",\"id\":\"zrfze\"}]},{\"id\":\"ebizikayuh\",\"name\":\"bjbsybb\",\"description\":\"r\",\"region\":\"ldgmfpgvmpip\",\"type\":\"ip\",\"includeByDefault\":false,\"rules\":[{\"source\":\"x\",\"description\":\"mwutwbdsre\",\"azureEndpointGuid\":\"drhneuyow\",\"azureEndpointName\":\"d\",\"id\":\"t\"},{\"source\":\"ib\",\"description\":\"cgpik\",\"azureEndpointGuid\":\"imejzanl\",\"azureEndpointName\":\"xi\",\"id\":\"rmbzo\"},{\"source\":\"kixrj\",\"description\":\"irgzp\",\"azureEndpointGuid\":\"lazszrn\",\"azureEndpointName\":\"iin\",\"id\":\"pwp\"}]},{\"id\":\"lwbtlhf\",\"name\":\"jcdh\",\"description\":\"fjvfbgofeljagr\",\"region\":\"qhl\",\"type\":\"azure_private_endpoint\",\"includeByDefault\":false,\"rules\":[{\"source\":\"nalghfkvtvsexso\",\"description\":\"el\",\"azureEndpointGuid\":\"hhahhxvrhmzkwpjg\",\"azureEndpointName\":\"spughftqsxhq\",\"id\":\"j\"},{\"source\":\"kndxdigrjgu\",\"description\":\"zdmsyqtfi\",\"azureEndpointGuid\":\"hbotzingamvppho\",\"azureEndpointName\":\"qzudphq\",\"id\":\"vdkfwynwcvtbvk\"}]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ElasticTrafficFilterResponse response = manager.listAssociatedTrafficFilters() - .listWithResponse("cdl", "h", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("p", response.rulesets().get(0).id()); - Assertions.assertEquals("cstwity", response.rulesets().get(0).name()); - Assertions.assertEquals("evxccedcp", response.rulesets().get(0).description()); - Assertions.assertEquals("dyodnwzxltj", response.rulesets().get(0).region()); - Assertions.assertEquals(Type.AZURE_PRIVATE_ENDPOINT, response.rulesets().get(0).type()); - Assertions.assertEquals(true, response.rulesets().get(0).includeByDefault()); - Assertions.assertEquals("gcxn", response.rulesets().get(0).rules().get(0).source()); - Assertions.assertEquals("vwxqibyqunyo", response.rulesets().get(0).rules().get(0).description()); - Assertions.assertEquals("wlmdjrkv", response.rulesets().get(0).rules().get(0).azureEndpointGuid()); - Assertions.assertEquals("bvfvpdbod", response.rulesets().get(0).rules().get(0).azureEndpointName()); - Assertions.assertEquals("izsjqlhkrr", response.rulesets().get(0).rules().get(0).id()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/LogRulesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/LogRulesTests.java deleted file mode 100644 index 9f1c53875133..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/LogRulesTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.FilteringTag; -import com.azure.resourcemanager.elastic.models.LogRules; -import com.azure.resourcemanager.elastic.models.TagAction; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class LogRulesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LogRules model = BinaryData.fromString( - "{\"sendAadLogs\":true,\"sendSubscriptionLogs\":false,\"sendActivityLogs\":true,\"filteringTags\":[{\"name\":\"ttmrywnuzoqf\",\"value\":\"yqzrnkcqvyxlw\",\"action\":\"Exclude\"}]}") - .toObject(LogRules.class); - Assertions.assertEquals(true, model.sendAadLogs()); - Assertions.assertEquals(false, model.sendSubscriptionLogs()); - Assertions.assertEquals(true, model.sendActivityLogs()); - Assertions.assertEquals("ttmrywnuzoqf", model.filteringTags().get(0).name()); - Assertions.assertEquals("yqzrnkcqvyxlw", model.filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.EXCLUDE, model.filteringTags().get(0).action()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LogRules model = new LogRules().withSendAadLogs(true) - .withSendSubscriptionLogs(false) - .withSendActivityLogs(true) - .withFilteringTags(Arrays.asList( - new FilteringTag().withName("ttmrywnuzoqf").withValue("yqzrnkcqvyxlw").withAction(TagAction.EXCLUDE))); - model = BinaryData.fromObject(model).toObject(LogRules.class); - Assertions.assertEquals(true, model.sendAadLogs()); - Assertions.assertEquals(false, model.sendSubscriptionLogs()); - Assertions.assertEquals(true, model.sendActivityLogs()); - Assertions.assertEquals("ttmrywnuzoqf", model.filteringTags().get(0).name()); - Assertions.assertEquals("yqzrnkcqvyxlw", model.filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.EXCLUDE, model.filteringTags().get(0).action()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoMarketplaceSubscriptionTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoMarketplaceSubscriptionTests.java deleted file mode 100644 index 795168ff1532..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoMarketplaceSubscriptionTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription; -import org.junit.jupiter.api.Assertions; - -public final class MarketplaceSaaSInfoMarketplaceSubscriptionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MarketplaceSaaSInfoMarketplaceSubscription model = BinaryData.fromString("{\"id\":\"jampmngnzscxaqw\"}") - .toObject(MarketplaceSaaSInfoMarketplaceSubscription.class); - Assertions.assertEquals("jampmngnzscxaqw", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MarketplaceSaaSInfoMarketplaceSubscription model - = new MarketplaceSaaSInfoMarketplaceSubscription().withId("jampmngnzscxaqw"); - model = BinaryData.fromObject(model).toObject(MarketplaceSaaSInfoMarketplaceSubscription.class); - Assertions.assertEquals("jampmngnzscxaqw", model.id()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoTests.java deleted file mode 100644 index 32b21c5e2267..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.MarketplaceSaaSInfo; -import com.azure.resourcemanager.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription; -import org.junit.jupiter.api.Assertions; - -public final class MarketplaceSaaSInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MarketplaceSaaSInfo model = BinaryData.fromString( - "{\"marketplaceSubscription\":{\"id\":\"mivkwlzuvcc\"},\"marketplaceName\":\"nfnbacfionlebxe\",\"marketplaceResourceId\":\"gtzxdpn\",\"marketplaceStatus\":\"qqwx\",\"billedAzureSubscriptionId\":\"feallnwsu\",\"subscribed\":true}") - .toObject(MarketplaceSaaSInfo.class); - Assertions.assertEquals("mivkwlzuvcc", model.marketplaceSubscription().id()); - Assertions.assertEquals("nfnbacfionlebxe", model.marketplaceName()); - Assertions.assertEquals("gtzxdpn", model.marketplaceResourceId()); - Assertions.assertEquals("qqwx", model.marketplaceStatus()); - Assertions.assertEquals("feallnwsu", model.billedAzureSubscriptionId()); - Assertions.assertEquals(true, model.subscribed()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MarketplaceSaaSInfo model = new MarketplaceSaaSInfo() - .withMarketplaceSubscription(new MarketplaceSaaSInfoMarketplaceSubscription().withId("mivkwlzuvcc")) - .withMarketplaceName("nfnbacfionlebxe") - .withMarketplaceResourceId("gtzxdpn") - .withMarketplaceStatus("qqwx") - .withBilledAzureSubscriptionId("feallnwsu") - .withSubscribed(true); - model = BinaryData.fromObject(model).toObject(MarketplaceSaaSInfo.class); - Assertions.assertEquals("mivkwlzuvcc", model.marketplaceSubscription().id()); - Assertions.assertEquals("nfnbacfionlebxe", model.marketplaceName()); - Assertions.assertEquals("gtzxdpn", model.marketplaceResourceId()); - Assertions.assertEquals("qqwx", model.marketplaceStatus()); - Assertions.assertEquals("feallnwsu", model.billedAzureSubscriptionId()); - Assertions.assertEquals(true, model.subscribed()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceInnerTests.java deleted file mode 100644 index 513a9afd831b..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceInnerTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.MonitoredResourceInner; -import com.azure.resourcemanager.elastic.models.SendingLogs; -import org.junit.jupiter.api.Assertions; - -public final class MonitoredResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonitoredResourceInner model - = BinaryData.fromString("{\"id\":\"e\",\"sendingLogs\":\"True\",\"reasonForLogsStatus\":\"a\"}") - .toObject(MonitoredResourceInner.class); - Assertions.assertEquals("e", model.id()); - Assertions.assertEquals(SendingLogs.TRUE, model.sendingLogs()); - Assertions.assertEquals("a", model.reasonForLogsStatus()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonitoredResourceInner model - = new MonitoredResourceInner().withId("e").withSendingLogs(SendingLogs.TRUE).withReasonForLogsStatus("a"); - model = BinaryData.fromObject(model).toObject(MonitoredResourceInner.class); - Assertions.assertEquals("e", model.id()); - Assertions.assertEquals(SendingLogs.TRUE, model.sendingLogs()); - Assertions.assertEquals("a", model.reasonForLogsStatus()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceListResponseTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceListResponseTests.java deleted file mode 100644 index 0c3b05e696fe..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceListResponseTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.MonitoredResourceInner; -import com.azure.resourcemanager.elastic.models.MonitoredResourceListResponse; -import com.azure.resourcemanager.elastic.models.SendingLogs; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MonitoredResourceListResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonitoredResourceListResponse model = BinaryData.fromString( - "{\"value\":[{\"id\":\"xmqci\",\"sendingLogs\":\"True\",\"reasonForLogsStatus\":\"khixuigdtopbo\"}],\"nextLink\":\"og\"}") - .toObject(MonitoredResourceListResponse.class); - Assertions.assertEquals("xmqci", model.value().get(0).id()); - Assertions.assertEquals(SendingLogs.TRUE, model.value().get(0).sendingLogs()); - Assertions.assertEquals("khixuigdtopbo", model.value().get(0).reasonForLogsStatus()); - Assertions.assertEquals("og", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonitoredResourceListResponse model - = new MonitoredResourceListResponse().withValue(Arrays.asList(new MonitoredResourceInner().withId("xmqci") - .withSendingLogs(SendingLogs.TRUE) - .withReasonForLogsStatus("khixuigdtopbo"))).withNextLink("og"); - model = BinaryData.fromObject(model).toObject(MonitoredResourceListResponse.class); - Assertions.assertEquals("xmqci", model.value().get(0).id()); - Assertions.assertEquals(SendingLogs.TRUE, model.value().get(0).sendingLogs()); - Assertions.assertEquals("khixuigdtopbo", model.value().get(0).reasonForLogsStatus()); - Assertions.assertEquals("og", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourcesListMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourcesListMockTests.java deleted file mode 100644 index 06d1cee96158..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourcesListMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.MonitoredResource; -import com.azure.resourcemanager.elastic.models.SendingLogs; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class MonitoredResourcesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"id\":\"ggbhcohfwds\",\"sendingLogs\":\"True\",\"reasonForLogsStatus\":\"ljuti\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.monitoredResources().list("quuvxzxcl", "ithhqzon", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ggbhcohfwds", response.iterator().next().id()); - Assertions.assertEquals(SendingLogs.TRUE, response.iterator().next().sendingLogs()); - Assertions.assertEquals("ljuti", response.iterator().next().reasonForLogsStatus()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesInnerTests.java deleted file mode 100644 index 2062b56cf235..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesInnerTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.MonitoringTagRulesInner; -import com.azure.resourcemanager.elastic.models.FilteringTag; -import com.azure.resourcemanager.elastic.models.LogRules; -import com.azure.resourcemanager.elastic.models.MonitoringTagRulesProperties; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import com.azure.resourcemanager.elastic.models.TagAction; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MonitoringTagRulesInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonitoringTagRulesInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Failed\",\"logRules\":{\"sendAadLogs\":false,\"sendSubscriptionLogs\":false,\"sendActivityLogs\":false,\"filteringTags\":[{\"name\":\"mzsb\",\"value\":\"oggigrxwburv\",\"action\":\"Include\"},{\"name\":\"nspydptkoenkoukn\",\"value\":\"dwtiukbldngkp\",\"action\":\"Exclude\"},{\"name\":\"azyxoegukg\",\"value\":\"piu\",\"action\":\"Exclude\"},{\"name\":\"evqzntypmrbp\",\"value\":\"c\",\"action\":\"Exclude\"}]}},\"id\":\"sdpydnfyhxdeoejz\",\"name\":\"cwif\",\"type\":\"jttgzf\"}") - .toObject(MonitoringTagRulesInner.class); - Assertions.assertEquals(ProvisioningState.FAILED, model.properties().provisioningState()); - Assertions.assertEquals(false, model.properties().logRules().sendAadLogs()); - Assertions.assertEquals(false, model.properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(false, model.properties().logRules().sendActivityLogs()); - Assertions.assertEquals("mzsb", model.properties().logRules().filteringTags().get(0).name()); - Assertions.assertEquals("oggigrxwburv", model.properties().logRules().filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.INCLUDE, model.properties().logRules().filteringTags().get(0).action()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonitoringTagRulesInner model = new MonitoringTagRulesInner() - .withProperties(new MonitoringTagRulesProperties().withProvisioningState(ProvisioningState.FAILED) - .withLogRules(new LogRules().withSendAadLogs(false) - .withSendSubscriptionLogs(false) - .withSendActivityLogs(false) - .withFilteringTags(Arrays.asList( - new FilteringTag().withName("mzsb").withValue("oggigrxwburv").withAction(TagAction.INCLUDE), - new FilteringTag().withName("nspydptkoenkoukn") - .withValue("dwtiukbldngkp") - .withAction(TagAction.EXCLUDE), - new FilteringTag().withName("azyxoegukg").withValue("piu").withAction(TagAction.EXCLUDE), - new FilteringTag().withName("evqzntypmrbp").withValue("c").withAction(TagAction.EXCLUDE))))); - model = BinaryData.fromObject(model).toObject(MonitoringTagRulesInner.class); - Assertions.assertEquals(ProvisioningState.FAILED, model.properties().provisioningState()); - Assertions.assertEquals(false, model.properties().logRules().sendAadLogs()); - Assertions.assertEquals(false, model.properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(false, model.properties().logRules().sendActivityLogs()); - Assertions.assertEquals("mzsb", model.properties().logRules().filteringTags().get(0).name()); - Assertions.assertEquals("oggigrxwburv", model.properties().logRules().filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.INCLUDE, model.properties().logRules().filteringTags().get(0).action()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesListResponseTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesListResponseTests.java deleted file mode 100644 index 1e74b111362b..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesListResponseTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.MonitoringTagRulesInner; -import com.azure.resourcemanager.elastic.models.FilteringTag; -import com.azure.resourcemanager.elastic.models.LogRules; -import com.azure.resourcemanager.elastic.models.MonitoringTagRulesListResponse; -import com.azure.resourcemanager.elastic.models.MonitoringTagRulesProperties; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MonitoringTagRulesListResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonitoringTagRulesListResponse model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Creating\",\"logRules\":{\"sendAadLogs\":true,\"sendSubscriptionLogs\":true,\"sendActivityLogs\":false,\"filteringTags\":[{},{},{},{}]}},\"id\":\"ciwwzjuqkhr\",\"name\":\"ajiwkuo\",\"type\":\"oskg\"},{\"properties\":{\"provisioningState\":\"Failed\",\"logRules\":{\"sendAadLogs\":true,\"sendSubscriptionLogs\":false,\"sendActivityLogs\":true,\"filteringTags\":[{},{}]}},\"id\":\"uugidyjrrfby\",\"name\":\"osvexcsonpclhoc\",\"type\":\"hslkevleggzf\"}],\"nextLink\":\"hfmvfaxkffe\"}") - .toObject(MonitoringTagRulesListResponse.class); - Assertions.assertEquals(ProvisioningState.CREATING, model.value().get(0).properties().provisioningState()); - Assertions.assertEquals(true, model.value().get(0).properties().logRules().sendAadLogs()); - Assertions.assertEquals(true, model.value().get(0).properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(false, model.value().get(0).properties().logRules().sendActivityLogs()); - Assertions.assertEquals("hfmvfaxkffe", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonitoringTagRulesListResponse model = new MonitoringTagRulesListResponse() - .withValue(Arrays.asList( - new MonitoringTagRulesInner() - .withProperties(new MonitoringTagRulesProperties().withProvisioningState(ProvisioningState.CREATING) - .withLogRules(new LogRules().withSendAadLogs(true) - .withSendSubscriptionLogs(true) - .withSendActivityLogs(false) - .withFilteringTags(Arrays.asList(new FilteringTag(), new FilteringTag(), new FilteringTag(), - new FilteringTag())))), - new MonitoringTagRulesInner() - .withProperties(new MonitoringTagRulesProperties().withProvisioningState(ProvisioningState.FAILED) - .withLogRules(new LogRules().withSendAadLogs(true) - .withSendSubscriptionLogs(false) - .withSendActivityLogs(true) - .withFilteringTags(Arrays.asList(new FilteringTag(), new FilteringTag())))))) - .withNextLink("hfmvfaxkffe"); - model = BinaryData.fromObject(model).toObject(MonitoringTagRulesListResponse.class); - Assertions.assertEquals(ProvisioningState.CREATING, model.value().get(0).properties().provisioningState()); - Assertions.assertEquals(true, model.value().get(0).properties().logRules().sendAadLogs()); - Assertions.assertEquals(true, model.value().get(0).properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(false, model.value().get(0).properties().logRules().sendActivityLogs()); - Assertions.assertEquals("hfmvfaxkffe", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesPropertiesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesPropertiesTests.java deleted file mode 100644 index 778044a31dac..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesPropertiesTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.FilteringTag; -import com.azure.resourcemanager.elastic.models.LogRules; -import com.azure.resourcemanager.elastic.models.MonitoringTagRulesProperties; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import com.azure.resourcemanager.elastic.models.TagAction; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MonitoringTagRulesPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonitoringTagRulesProperties model = BinaryData.fromString( - "{\"provisioningState\":\"Deleting\",\"logRules\":{\"sendAadLogs\":false,\"sendSubscriptionLogs\":true,\"sendActivityLogs\":true,\"filteringTags\":[{\"name\":\"eamdp\",\"value\":\"g\",\"action\":\"Exclude\"},{\"name\":\"uxwgipwho\",\"value\":\"wkgshwa\",\"action\":\"Exclude\"}]}}") - .toObject(MonitoringTagRulesProperties.class); - Assertions.assertEquals(ProvisioningState.DELETING, model.provisioningState()); - Assertions.assertEquals(false, model.logRules().sendAadLogs()); - Assertions.assertEquals(true, model.logRules().sendSubscriptionLogs()); - Assertions.assertEquals(true, model.logRules().sendActivityLogs()); - Assertions.assertEquals("eamdp", model.logRules().filteringTags().get(0).name()); - Assertions.assertEquals("g", model.logRules().filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.EXCLUDE, model.logRules().filteringTags().get(0).action()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonitoringTagRulesProperties model - = new MonitoringTagRulesProperties().withProvisioningState(ProvisioningState.DELETING) - .withLogRules(new LogRules().withSendAadLogs(false) - .withSendSubscriptionLogs(true) - .withSendActivityLogs(true) - .withFilteringTags(Arrays.asList( - new FilteringTag().withName("eamdp").withValue("g").withAction(TagAction.EXCLUDE), - new FilteringTag().withName("uxwgipwho").withValue("wkgshwa").withAction(TagAction.EXCLUDE)))); - model = BinaryData.fromObject(model).toObject(MonitoringTagRulesProperties.class); - Assertions.assertEquals(ProvisioningState.DELETING, model.provisioningState()); - Assertions.assertEquals(false, model.logRules().sendAadLogs()); - Assertions.assertEquals(true, model.logRules().sendSubscriptionLogs()); - Assertions.assertEquals(true, model.logRules().sendActivityLogs()); - Assertions.assertEquals("eamdp", model.logRules().filteringTags().get(0).name()); - Assertions.assertEquals("g", model.logRules().filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.EXCLUDE, model.logRules().filteringTags().get(0).action()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitorsDeleteMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitorsDeleteMockTests.java deleted file mode 100644 index 45174c2221bf..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitorsDeleteMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class MonitorsDeleteMockTests { - @Test - public void testDelete() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.monitors().delete("aolps", "lqlfm", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIIntegrationStatusResponseInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIIntegrationStatusResponseInnerTests.java deleted file mode 100644 index 469db98223bc..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIIntegrationStatusResponseInnerTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.OpenAIIntegrationStatusResponseInner; -import com.azure.resourcemanager.elastic.models.OpenAIIntegrationStatusResponseProperties; -import org.junit.jupiter.api.Assertions; - -public final class OpenAIIntegrationStatusResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OpenAIIntegrationStatusResponseInner model - = BinaryData.fromString("{\"properties\":{\"status\":\"vsovmyokac\"}}") - .toObject(OpenAIIntegrationStatusResponseInner.class); - Assertions.assertEquals("vsovmyokac", model.properties().status()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OpenAIIntegrationStatusResponseInner model = new OpenAIIntegrationStatusResponseInner() - .withProperties(new OpenAIIntegrationStatusResponseProperties().withStatus("vsovmyokac")); - model = BinaryData.fromObject(model).toObject(OpenAIIntegrationStatusResponseInner.class); - Assertions.assertEquals("vsovmyokac", model.properties().status()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIIntegrationStatusResponsePropertiesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIIntegrationStatusResponsePropertiesTests.java deleted file mode 100644 index 266fe7d0904a..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIIntegrationStatusResponsePropertiesTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.OpenAIIntegrationStatusResponseProperties; -import org.junit.jupiter.api.Assertions; - -public final class OpenAIIntegrationStatusResponsePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OpenAIIntegrationStatusResponseProperties model = BinaryData.fromString("{\"status\":\"kwlhzdo\"}") - .toObject(OpenAIIntegrationStatusResponseProperties.class); - Assertions.assertEquals("kwlhzdo", model.status()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OpenAIIntegrationStatusResponseProperties model - = new OpenAIIntegrationStatusResponseProperties().withStatus("kwlhzdo"); - model = BinaryData.fromObject(model).toObject(OpenAIIntegrationStatusResponseProperties.class); - Assertions.assertEquals("kwlhzdo", model.status()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIsDeleteWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIsDeleteWithResponseMockTests.java deleted file mode 100644 index fb252662e347..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OpenAIsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.openAIs() - .deleteWithResponse("syrsndsytgadgvra", "aeneqnzarrwl", "uu", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIsGetStatusWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIsGetStatusWithResponseMockTests.java deleted file mode 100644 index 34988f2405dd..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OpenAIsGetStatusWithResponseMockTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.OpenAIIntegrationStatusResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OpenAIsGetStatusWithResponseMockTests { - @Test - public void testGetStatusWithResponse() throws Exception { - String responseStr = "{\"properties\":{\"status\":\"wifto\"}}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - OpenAIIntegrationStatusResponse response = manager.openAIs() - .getStatusWithResponse("jfqka", "e", "iipfpubj", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("wifto", response.properties().status()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationDisplayTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationDisplayTests.java deleted file mode 100644 index 47ed8ef70a73..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationDisplayTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = BinaryData.fromString( - "{\"provider\":\"cryuan\",\"resource\":\"uxzdxtay\",\"operation\":\"hmwhfpmrqo\",\"description\":\"tu\"}") - .toObject(OperationDisplay.class); - Assertions.assertEquals("cryuan", model.provider()); - Assertions.assertEquals("uxzdxtay", model.resource()); - Assertions.assertEquals("hmwhfpmrqo", model.operation()); - Assertions.assertEquals("tu", model.description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay().withProvider("cryuan") - .withResource("uxzdxtay") - .withOperation("hmwhfpmrqo") - .withDescription("tu"); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("cryuan", model.provider()); - Assertions.assertEquals("uxzdxtay", model.resource()); - Assertions.assertEquals("hmwhfpmrqo", model.operation()); - Assertions.assertEquals("tu", model.description()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationListResultTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationListResultTests.java deleted file mode 100644 index ac66f705364a..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationListResultTests.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.OperationResultInner; -import com.azure.resourcemanager.elastic.models.OperationDisplay; -import com.azure.resourcemanager.elastic.models.OperationListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = BinaryData.fromString( - "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"ownoizhw\"},{\"name\":\"xybqsoqij\",\"isDataAction\":true,\"display\":{\"provider\":\"pazlobcufpdz\",\"resource\":\"btcqq\",\"operation\":\"qglhq\",\"description\":\"ufo\"},\"origin\":\"jywif\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"o\"}],\"nextLink\":\"dkfo\"}") - .toObject(OperationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); - Assertions.assertEquals(true, model.value().get(0).isDataAction()); - Assertions.assertEquals("pbsphrupidgs", model.value().get(0).display().provider()); - Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).display().resource()); - Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation()); - Assertions.assertEquals("zehtbmu", model.value().get(0).display().description()); - Assertions.assertEquals("ownoizhw", model.value().get(0).origin()); - Assertions.assertEquals("dkfo", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult().withValue(Arrays.asList( - new OperationResultInner().withName("quvgjxpybczme") - .withIsDataAction(true) - .withDisplay(new OperationDisplay().withProvider("pbsphrupidgs") - .withResource("bejhphoycmsxa") - .withOperation("hdxbmtqio") - .withDescription("zehtbmu")) - .withOrigin("ownoizhw"), - new OperationResultInner().withName("xybqsoqij") - .withIsDataAction(true) - .withDisplay(new OperationDisplay().withProvider("pazlobcufpdz") - .withResource("btcqq") - .withOperation("qglhq") - .withDescription("ufo")) - .withOrigin("jywif"), - new OperationResultInner().withName("esaagdfm") - .withIsDataAction(true) - .withDisplay(new OperationDisplay().withProvider("j") - .withResource("ifkwmrvktsizntoc") - .withOperation("a") - .withDescription("ajpsquc")) - .withOrigin("o"))) - .withNextLink("dkfo"); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); - Assertions.assertEquals(true, model.value().get(0).isDataAction()); - Assertions.assertEquals("pbsphrupidgs", model.value().get(0).display().provider()); - Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).display().resource()); - Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation()); - Assertions.assertEquals("zehtbmu", model.value().get(0).display().description()); - Assertions.assertEquals("ownoizhw", model.value().get(0).origin()); - Assertions.assertEquals("dkfo", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationResultInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationResultInnerTests.java deleted file mode 100644 index 51e8c4a12c00..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationResultInnerTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.OperationResultInner; -import com.azure.resourcemanager.elastic.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationResultInner model = BinaryData.fromString( - "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"txukcdmp\"}") - .toObject(OperationResultInner.class); - Assertions.assertEquals("nygj", model.name()); - Assertions.assertEquals(true, model.isDataAction()); - Assertions.assertEquals("eqsrdeupewnwreit", model.display().provider()); - Assertions.assertEquals("yflusarhmofc", model.display().resource()); - Assertions.assertEquals("smy", model.display().operation()); - Assertions.assertEquals("kdtmlxhekuk", model.display().description()); - Assertions.assertEquals("txukcdmp", model.origin()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationResultInner model = new OperationResultInner().withName("nygj") - .withIsDataAction(true) - .withDisplay(new OperationDisplay().withProvider("eqsrdeupewnwreit") - .withResource("yflusarhmofc") - .withOperation("smy") - .withDescription("kdtmlxhekuk")) - .withOrigin("txukcdmp"); - model = BinaryData.fromObject(model).toObject(OperationResultInner.class); - Assertions.assertEquals("nygj", model.name()); - Assertions.assertEquals(true, model.isDataAction()); - Assertions.assertEquals("eqsrdeupewnwreit", model.display().provider()); - Assertions.assertEquals("yflusarhmofc", model.display().resource()); - Assertions.assertEquals("smy", model.display().operation()); - Assertions.assertEquals("kdtmlxhekuk", model.display().description()); - Assertions.assertEquals("txukcdmp", model.origin()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationsListMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationsListMockTests.java deleted file mode 100644 index 834f33ff2c6e..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationsListMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.OperationResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"name\":\"crnwbmeh\",\"isDataAction\":true,\"display\":{\"provider\":\"jusrtslhspk\",\"resource\":\"emaofmxagkvt\",\"operation\":\"lmqkrhahvlj\",\"description\":\"haquhcdh\"},\"origin\":\"ualaexqpvfadmw\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("crnwbmeh", response.iterator().next().name()); - Assertions.assertEquals(true, response.iterator().next().isDataAction()); - Assertions.assertEquals("jusrtslhspk", response.iterator().next().display().provider()); - Assertions.assertEquals("emaofmxagkvt", response.iterator().next().display().resource()); - Assertions.assertEquals("lmqkrhahvlj", response.iterator().next().display().operation()); - Assertions.assertEquals("haquhcdh", response.iterator().next().display().description()); - Assertions.assertEquals("ualaexqpvfadmw", response.iterator().next().origin()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetElasticToAzureSubscriptionMappingWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetElasticToAzureSubscriptionMappingWithResponseMockTests.java deleted file mode 100644 index 89eec50b7586..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OrganizationsGetElasticToAzureSubscriptionMappingWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.ElasticOrganizationToAzureSubscriptionMappingResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OrganizationsGetElasticToAzureSubscriptionMappingWithResponseMockTests { - @Test - public void testGetElasticToAzureSubscriptionMappingWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"billedAzureSubscriptionId\":\"kdgszywkbirr\",\"marketplaceSaasInfo\":{\"marketplaceSubscription\":{\"id\":\"lhkjoqrvqq\"},\"marketplaceName\":\"t\",\"marketplaceResourceId\":\"nrvgoupmfiibfgg\",\"marketplaceStatus\":\"ool\",\"billedAzureSubscriptionId\":\"wxkvtkkgll\",\"subscribed\":true},\"elasticOrganizationId\":\"gvjayvblmh\",\"elasticOrganizationName\":\"zuhbxvvyhgsopb\"}}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ElasticOrganizationToAzureSubscriptionMappingResponse response = manager.organizations() - .getElasticToAzureSubscriptionMappingWithResponse(com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("kdgszywkbirr", response.properties().billedAzureSubscriptionId()); - Assertions.assertEquals("gvjayvblmh", response.properties().elasticOrganizationId()); - Assertions.assertEquals("zuhbxvvyhgsopb", response.properties().elasticOrganizationName()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/PartnerBillingEntityTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/PartnerBillingEntityTests.java deleted file mode 100644 index 3e2833a58116..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/PartnerBillingEntityTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.PartnerBillingEntity; -import org.junit.jupiter.api.Assertions; - -public final class PartnerBillingEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PartnerBillingEntity model - = BinaryData.fromString("{\"id\":\"zdmohctbqvu\",\"name\":\"xdn\",\"partnerEntityUri\":\"vo\"}") - .toObject(PartnerBillingEntity.class); - Assertions.assertEquals("zdmohctbqvu", model.id()); - Assertions.assertEquals("xdn", model.name()); - Assertions.assertEquals("vo", model.partnerEntityUri()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PartnerBillingEntity model - = new PartnerBillingEntity().withId("zdmohctbqvu").withName("xdn").withPartnerEntityUri("vo"); - model = BinaryData.fromObject(model).toObject(PartnerBillingEntity.class); - Assertions.assertEquals("zdmohctbqvu", model.id()); - Assertions.assertEquals("xdn", model.name()); - Assertions.assertEquals("vo", model.partnerEntityUri()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/PlanDetailsTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/PlanDetailsTests.java deleted file mode 100644 index d083a356f2fc..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/PlanDetailsTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.PlanDetails; -import org.junit.jupiter.api.Assertions; - -public final class PlanDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PlanDetails model = BinaryData.fromString( - "{\"offerID\":\"bnbdxkqpxokajion\",\"publisherID\":\"mexgstxgcp\",\"termID\":\"gmaajrm\",\"planID\":\"jwzrl\",\"planName\":\"mcl\"}") - .toObject(PlanDetails.class); - Assertions.assertEquals("bnbdxkqpxokajion", model.offerId()); - Assertions.assertEquals("mexgstxgcp", model.publisherId()); - Assertions.assertEquals("gmaajrm", model.termId()); - Assertions.assertEquals("jwzrl", model.planId()); - Assertions.assertEquals("mcl", model.planName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PlanDetails model = new PlanDetails().withOfferId("bnbdxkqpxokajion") - .withPublisherId("mexgstxgcp") - .withTermId("gmaajrm") - .withPlanId("jwzrl") - .withPlanName("mcl"); - model = BinaryData.fromObject(model).toObject(PlanDetails.class); - Assertions.assertEquals("bnbdxkqpxokajion", model.offerId()); - Assertions.assertEquals("mexgstxgcp", model.publisherId()); - Assertions.assertEquals("gmaajrm", model.termId()); - Assertions.assertEquals("jwzrl", model.planId()); - Assertions.assertEquals("mcl", model.planName()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ResourceSkuTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ResourceSkuTests.java deleted file mode 100644 index 842881ad3655..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ResourceSkuTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ResourceSku; -import org.junit.jupiter.api.Assertions; - -public final class ResourceSkuTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceSku model = BinaryData.fromString("{\"name\":\"abkyqduujitcjcz\"}").toObject(ResourceSku.class); - Assertions.assertEquals("abkyqduujitcjcz", model.name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceSku model = new ResourceSku().withName("abkyqduujitcjcz"); - model = BinaryData.fromObject(model).toObject(ResourceSku.class); - Assertions.assertEquals("abkyqduujitcjcz", model.name()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesCreateOrUpdateWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index 8e670c7be422..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.FilteringTag; -import com.azure.resourcemanager.elastic.models.LogRules; -import com.azure.resourcemanager.elastic.models.MonitoringTagRules; -import com.azure.resourcemanager.elastic.models.MonitoringTagRulesProperties; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import com.azure.resourcemanager.elastic.models.TagAction; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class TagRulesCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Failed\",\"logRules\":{\"sendAadLogs\":true,\"sendSubscriptionLogs\":false,\"sendActivityLogs\":false,\"filteringTags\":[{\"name\":\"nyga\",\"value\":\"idb\",\"action\":\"Include\"},{\"name\":\"pxllrx\",\"value\":\"jmoadsuv\",\"action\":\"Include\"}]}},\"id\":\"wdmjsjqbjhhyx\",\"name\":\"rw\",\"type\":\"yc\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - MonitoringTagRules response = manager.tagRules() - .define("fatkld") - .withExistingMonitor("kzikfjawneaivxwc", "elpcirelsfeaenwa") - .withProperties(new MonitoringTagRulesProperties().withProvisioningState(ProvisioningState.DELETING) - .withLogRules(new LogRules().withSendAadLogs(true) - .withSendSubscriptionLogs(false) - .withSendActivityLogs(false) - .withFilteringTags(Arrays.asList(new FilteringTag().withName("sphyoulpjrvxa") - .withValue("rvimjwosytxitcsk") - .withAction(TagAction.INCLUDE))))) - .create(); - - Assertions.assertEquals(ProvisioningState.FAILED, response.properties().provisioningState()); - Assertions.assertEquals(true, response.properties().logRules().sendAadLogs()); - Assertions.assertEquals(false, response.properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(false, response.properties().logRules().sendActivityLogs()); - Assertions.assertEquals("nyga", response.properties().logRules().filteringTags().get(0).name()); - Assertions.assertEquals("idb", response.properties().logRules().filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.INCLUDE, response.properties().logRules().filteringTags().get(0).action()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesDeleteMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesDeleteMockTests.java deleted file mode 100644 index 188b5fc97c12..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesDeleteMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class TagRulesDeleteMockTests { - @Test - public void testDelete() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.tagRules().delete("hfjx", "mszkkfo", "rey", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesGetWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesGetWithResponseMockTests.java deleted file mode 100644 index 633f1abea6fe..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesGetWithResponseMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.MonitoringTagRules; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import com.azure.resourcemanager.elastic.models.TagAction; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class TagRulesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Failed\",\"logRules\":{\"sendAadLogs\":true,\"sendSubscriptionLogs\":false,\"sendActivityLogs\":false,\"filteringTags\":[{\"name\":\"ealmfmtdaaygdvwv\",\"value\":\"iohgwxrtfud\",\"action\":\"Include\"}]}},\"id\":\"gyqagvrvmnpkuk\",\"name\":\"himdbl\",\"type\":\"gwimfn\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - MonitoringTagRules response = manager.tagRules() - .getWithResponse("uipiccjzk", "ivgvvcna", "rhyrnxxmueed", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(ProvisioningState.FAILED, response.properties().provisioningState()); - Assertions.assertEquals(true, response.properties().logRules().sendAadLogs()); - Assertions.assertEquals(false, response.properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(false, response.properties().logRules().sendActivityLogs()); - Assertions.assertEquals("ealmfmtdaaygdvwv", response.properties().logRules().filteringTags().get(0).name()); - Assertions.assertEquals("iohgwxrtfud", response.properties().logRules().filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.INCLUDE, response.properties().logRules().filteringTags().get(0).action()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesListMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesListMockTests.java deleted file mode 100644 index 8b3dfd131708..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesListMockTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.MonitoringTagRules; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import com.azure.resourcemanager.elastic.models.TagAction; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class TagRulesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Deleted\",\"logRules\":{\"sendAadLogs\":false,\"sendSubscriptionLogs\":false,\"sendActivityLogs\":true,\"filteringTags\":[{\"name\":\"mwzn\",\"value\":\"biknsorgjhxbld\",\"action\":\"Exclude\"},{\"name\":\"rlkdmtncvokotl\",\"value\":\"d\",\"action\":\"Include\"},{\"name\":\"y\",\"value\":\"ogjltdtbnnhad\",\"action\":\"Exclude\"},{\"name\":\"kvci\",\"value\":\"nvpamq\",\"action\":\"Include\"}]}},\"id\":\"u\",\"name\":\"zikywgg\",\"type\":\"kallatmel\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.tagRules().list("zynkedya", "rwyhqmibzyhwitsm", com.azure.core.util.Context.NONE); - - Assertions.assertEquals(ProvisioningState.DELETED, response.iterator().next().properties().provisioningState()); - Assertions.assertEquals(false, response.iterator().next().properties().logRules().sendAadLogs()); - Assertions.assertEquals(false, response.iterator().next().properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(true, response.iterator().next().properties().logRules().sendActivityLogs()); - Assertions.assertEquals("mwzn", - response.iterator().next().properties().logRules().filteringTags().get(0).name()); - Assertions.assertEquals("biknsorgjhxbld", - response.iterator().next().properties().logRules().filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.EXCLUDE, - response.iterator().next().properties().logRules().filteringTags().get(0).action()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TrafficFiltersDeleteWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TrafficFiltersDeleteWithResponseMockTests.java deleted file mode 100644 index ff817e52d0fe..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TrafficFiltersDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class TrafficFiltersDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.trafficFilters() - .deleteWithResponse("edkowepbqpcrfk", "wccsnjvcdwxlpqek", "tn", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsDetailsWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsDetailsWithResponseMockTests.java deleted file mode 100644 index 7556ec87eb34..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsDetailsWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.UpgradableVersionsList; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class UpgradableVersionsDetailsWithResponseMockTests { - @Test - public void testDetailsWithResponse() throws Exception { - String responseStr - = "{\"currentVersion\":\"axhexiilivp\",\"upgradableVersions\":[\"irqtdqoa\",\"oruzfgsquyfxrxx\"]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - UpgradableVersionsList response = manager.upgradableVersions() - .detailsWithResponse("soibjudpfrx", "rthzvaytdwkqbrqu", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("axhexiilivp", response.currentVersion()); - Assertions.assertEquals("irqtdqoa", response.upgradableVersions().get(0)); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsListInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsListInnerTests.java deleted file mode 100644 index aae3d228a8fd..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsListInnerTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.UpgradableVersionsListInner; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class UpgradableVersionsListInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UpgradableVersionsListInner model = BinaryData - .fromString( - "{\"currentVersion\":\"pwvlqdq\",\"upgradableVersions\":[\"qylihkaetckt\",\"fcivfsnkym\",\"ctq\"]}") - .toObject(UpgradableVersionsListInner.class); - Assertions.assertEquals("pwvlqdq", model.currentVersion()); - Assertions.assertEquals("qylihkaetckt", model.upgradableVersions().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UpgradableVersionsListInner model = new UpgradableVersionsListInner().withCurrentVersion("pwvlqdq") - .withUpgradableVersions(Arrays.asList("qylihkaetckt", "fcivfsnkym", "ctq")); - model = BinaryData.fromObject(model).toObject(UpgradableVersionsListInner.class); - Assertions.assertEquals("pwvlqdq", model.currentVersion()); - Assertions.assertEquals("qylihkaetckt", model.upgradableVersions().get(0)); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserEmailIdTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserEmailIdTests.java deleted file mode 100644 index 6d85e32e2865..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserEmailIdTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.UserEmailId; -import org.junit.jupiter.api.Assertions; - -public final class UserEmailIdTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UserEmailId model = BinaryData.fromString("{\"emailId\":\"scwsv\"}").toObject(UserEmailId.class); - Assertions.assertEquals("scwsv", model.emailId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserEmailId model = new UserEmailId().withEmailId("scwsv"); - model = BinaryData.fromObject(model).toObject(UserEmailId.class); - Assertions.assertEquals("scwsv", model.emailId()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserInfoTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserInfoTests.java deleted file mode 100644 index bbaec49c012d..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserInfoTests.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.CompanyInfo; -import com.azure.resourcemanager.elastic.models.UserInfo; -import org.junit.jupiter.api.Assertions; - -public final class UserInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UserInfo model = BinaryData.fromString( - "{\"firstName\":\"soodqxhcrmnoh\",\"lastName\":\"ckwhds\",\"companyName\":\"fiyipjxsqwpgrj\",\"emailAddress\":\"norcjxvsnbyxqab\",\"companyInfo\":{\"domain\":\"cpc\",\"business\":\"hurzafblj\",\"employeesNumber\":\"pbtoqcjmkl\",\"state\":\"vbqid\",\"country\":\"ajzyul\"}}") - .toObject(UserInfo.class); - Assertions.assertEquals("soodqxhcrmnoh", model.firstName()); - Assertions.assertEquals("ckwhds", model.lastName()); - Assertions.assertEquals("fiyipjxsqwpgrj", model.companyName()); - Assertions.assertEquals("norcjxvsnbyxqab", model.emailAddress()); - Assertions.assertEquals("cpc", model.companyInfo().domain()); - Assertions.assertEquals("hurzafblj", model.companyInfo().business()); - Assertions.assertEquals("pbtoqcjmkl", model.companyInfo().employeesNumber()); - Assertions.assertEquals("vbqid", model.companyInfo().state()); - Assertions.assertEquals("ajzyul", model.companyInfo().country()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserInfo model = new UserInfo().withFirstName("soodqxhcrmnoh") - .withLastName("ckwhds") - .withCompanyName("fiyipjxsqwpgrj") - .withEmailAddress("norcjxvsnbyxqab") - .withCompanyInfo(new CompanyInfo().withDomain("cpc") - .withBusiness("hurzafblj") - .withEmployeesNumber("pbtoqcjmkl") - .withState("vbqid") - .withCountry("ajzyul")); - model = BinaryData.fromObject(model).toObject(UserInfo.class); - Assertions.assertEquals("soodqxhcrmnoh", model.firstName()); - Assertions.assertEquals("ckwhds", model.lastName()); - Assertions.assertEquals("fiyipjxsqwpgrj", model.companyName()); - Assertions.assertEquals("norcjxvsnbyxqab", model.emailAddress()); - Assertions.assertEquals("cpc", model.companyInfo().domain()); - Assertions.assertEquals("hurzafblj", model.companyInfo().business()); - Assertions.assertEquals("pbtoqcjmkl", model.companyInfo().employeesNumber()); - Assertions.assertEquals("vbqid", model.companyInfo().state()); - Assertions.assertEquals("ajzyul", model.companyInfo().country()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionUpdateTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionUpdateTests.java deleted file mode 100644 index 5741dac12ff8..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionUpdateTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.OperationName; -import com.azure.resourcemanager.elastic.models.VMCollectionUpdate; -import org.junit.jupiter.api.Assertions; - -public final class VMCollectionUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VMCollectionUpdate model = BinaryData.fromString("{\"vmResourceId\":\"enhwlrs\",\"operationName\":\"Delete\"}") - .toObject(VMCollectionUpdate.class); - Assertions.assertEquals("enhwlrs", model.vmResourceId()); - Assertions.assertEquals(OperationName.DELETE, model.operationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VMCollectionUpdate model - = new VMCollectionUpdate().withVmResourceId("enhwlrs").withOperationName(OperationName.DELETE); - model = BinaryData.fromObject(model).toObject(VMCollectionUpdate.class); - Assertions.assertEquals("enhwlrs", model.vmResourceId()); - Assertions.assertEquals(OperationName.DELETE, model.operationName()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionsUpdateWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionsUpdateWithResponseMockTests.java deleted file mode 100644 index 05ded0cb29f7..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionsUpdateWithResponseMockTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.OperationName; -import com.azure.resourcemanager.elastic.models.VMCollectionUpdate; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class VMCollectionsUpdateWithResponseMockTests { - @Test - public void testUpdateWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.vMCollections() - .updateWithResponse("tuzqogsexne", "fdnw", - new VMCollectionUpdate().withVmResourceId("mewzsyyc").withOperationName(OperationName.DELETE), - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostListResponseTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostListResponseTests.java deleted file mode 100644 index 4f9477d39d5e..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostListResponseTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.VMResourcesInner; -import com.azure.resourcemanager.elastic.models.VMHostListResponse; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class VMHostListResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VMHostListResponse model - = BinaryData.fromString("{\"value\":[{\"vmResourceId\":\"zko\"}],\"nextLink\":\"cukoklyaxuconu\"}") - .toObject(VMHostListResponse.class); - Assertions.assertEquals("zko", model.value().get(0).vmResourceId()); - Assertions.assertEquals("cukoklyaxuconu", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VMHostListResponse model - = new VMHostListResponse().withValue(Arrays.asList(new VMResourcesInner().withVmResourceId("zko"))) - .withNextLink("cukoklyaxuconu"); - model = BinaryData.fromObject(model).toObject(VMHostListResponse.class); - Assertions.assertEquals("zko", model.value().get(0).vmResourceId()); - Assertions.assertEquals("cukoklyaxuconu", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostsListMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostsListMockTests.java deleted file mode 100644 index 4d9b4bb44e2a..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostsListMockTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.VMResources; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class VMHostsListMockTests { - @Test - public void testList() throws Exception { - String responseStr = "{\"value\":[{\"vmResourceId\":\"ky\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ElasticManager manager = ElasticManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.vMHosts().list("duhpk", "kgymareqnajxqug", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ky", response.iterator().next().vmResourceId()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMResourcesInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMResourcesInnerTests.java deleted file mode 100644 index 0b04fba8b558..000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMResourcesInnerTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.VMResourcesInner; -import org.junit.jupiter.api.Assertions; - -public final class VMResourcesInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VMResourcesInner model = BinaryData.fromString("{\"vmResourceId\":\"zf\"}").toObject(VMResourcesInner.class); - Assertions.assertEquals("zf", model.vmResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VMResourcesInner model = new VMResourcesInner().withVmResourceId("zf"); - model = BinaryData.fromObject(model).toObject(VMResourcesInner.class); - Assertions.assertEquals("zf", model.vmResourceId()); - } -}