From ebf2f44daa7a0c7c1989265736e3d8756efdc80e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 14 Dec 2020 02:33:49 +0000 Subject: [PATCH] CodeGen from PR 11850 in Azure/azure-rest-api-specs added new api version for Tables resource (#11850) * added3 new properties to TableProperties: IsTroubleshootingAllowed, IsTroubleshootingEnabled, IsTroubleshootingEnabledLastActivation. * added Tables new api version * changed bool to boolean types * prettified jsons * fix erroes in swagger * undo changes to 2020-03-01-preview version * pr fixes * updated TableUpdate example * changed lastTroubleshootDate from date format to string, removed isTroubleshootingAllowed from body of example * changed v1 to v2 * changed WorkspaceNameParameter back to V1 * changed ErrorResponse to default ErrorResponse without ref to local definition * added systemData * removed systemData * added systemData to Patch and Get * moved systemData to Table properties * deleted systemData from Table.json, added to Get and Put examles * changed location of systemData in Tables.json * moved systemData to inside Table definition * moved systemData inside Table properties --- eng/versioning/external_dependencies.txt | 1 + eng/versioning/version_client.txt | 43 +- eng/versioning/version_data.txt | 2 +- pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 84 + .../pom.xml | 62 + .../loganalytics/LogAnalyticsManager.java | 428 +++++ .../fluent/AvailableServiceTiersClient.java | 43 + .../loganalytics/fluent/ClustersClient.java | 235 +++ .../fluent/DataExportsClient.java | 138 ++ .../fluent/DataSourcesClient.java | 142 ++ .../fluent/DeletedWorkspacesClient.java | 61 + .../loganalytics/fluent/GatewaysClient.java | 42 + .../fluent/IntelligencePacksClient.java | 101 ++ .../fluent/LinkedServicesClient.java | 209 +++ .../fluent/LinkedStorageAccountsClient.java | 150 ++ .../fluent/ManagementGroupsClient.java | 41 + .../fluent/OperationStatusesClient.java | 41 + .../OperationalInsightsManagementClient.java | 186 +++ .../loganalytics/fluent/OperationsClient.java | 36 + .../fluent/SavedSearchesClient.java | 139 ++ .../loganalytics/fluent/SchemasClient.java | 42 + .../fluent/SharedKeysOperationsClient.java | 71 + .../fluent/StorageInsightConfigsClient.java | 138 ++ .../loganalytics/fluent/TablesClient.java | 104 ++ .../loganalytics/fluent/UsagesClient.java | 41 + .../fluent/WorkspacePurgesClient.java | 86 + .../loganalytics/fluent/WorkspacesClient.java | 267 +++ .../models/AvailableServiceTierInner.java | 134 ++ .../fluent/models/ClusterInner.java | 189 +++ .../fluent/models/DataExportInner.java | 232 +++ .../fluent/models/DataSourceInner.java | 144 ++ .../fluent/models/IntelligencePackInner.java | 102 ++ .../fluent/models/LinkedServiceInner.java | 139 ++ .../LinkedStorageAccountsResourceInner.java | 70 + .../fluent/models/ManagementGroupInner.java | 236 +++ .../fluent/models/OperationInner.java | 80 + .../fluent/models/OperationStatusInner.java | 181 +++ .../fluent/models/SavedSearchInner.java | 267 +++ .../models/SavedSearchesListResultInner.java | 54 + .../models/SearchGetSchemaResponseInner.java | 85 + .../fluent/models/SharedKeysInner.java | 76 + .../fluent/models/StorageInsightInner.java | 182 +++ .../fluent/models/TableInner.java | 56 + .../fluent/models/UsageMetricInner.java | 186 +++ .../fluent/models/WorkspaceInner.java | 270 ++++ .../models/WorkspacePurgeResponseInner.java | 56 + .../WorkspacePurgeStatusResponseInner.java | 57 + .../fluent/models/package-info.java | 6 + .../loganalytics/fluent/package-info.java | 6 + .../AvailableServiceTierImpl.java | 57 + .../AvailableServiceTiersClientImpl.java | 223 +++ .../AvailableServiceTiersImpl.java | 73 + .../implementation/ClusterImpl.java | 230 +++ .../implementation/ClustersClientImpl.java | 1427 +++++++++++++++++ .../implementation/ClustersImpl.java | 170 ++ .../implementation/DataExportImpl.java | 205 +++ .../implementation/DataExportsClientImpl.java | 801 +++++++++ .../implementation/DataExportsImpl.java | 190 +++ .../implementation/DataSourceImpl.java | 174 ++ .../implementation/DataSourcesClientImpl.java | 937 +++++++++++ .../implementation/DataSourcesImpl.java | 192 +++ .../DeletedWorkspacesClientImpl.java | 365 +++++ .../implementation/DeletedWorkspacesImpl.java | 56 + .../implementation/GatewaysClientImpl.java | 219 +++ .../implementation/GatewaysImpl.java | 43 + .../implementation/IntelligencePackImpl.java | 40 + .../IntelligencePacksClientImpl.java | 557 +++++++ .../implementation/IntelligencePacksImpl.java | 93 ++ .../implementation/LinkedServiceImpl.java | 166 ++ .../LinkedServicesClientImpl.java | 1030 ++++++++++++ .../implementation/LinkedServicesImpl.java | 153 ++ .../LinkedStorageAccountsClientImpl.java | 828 ++++++++++ .../LinkedStorageAccountsImpl.java | 212 +++ .../LinkedStorageAccountsResourceImpl.java | 156 ++ .../implementation/ManagementGroupImpl.java | 61 + .../ManagementGroupsClientImpl.java | 241 +++ .../implementation/ManagementGroupsImpl.java | 47 + .../implementation/OperationImpl.java | 37 + .../implementation/OperationStatusImpl.java | 53 + .../OperationStatusesClientImpl.java | 219 +++ .../implementation/OperationStatusesImpl.java | 60 + ...tionalInsightsManagementClientBuilder.java | 146 ++ ...erationalInsightsManagementClientImpl.java | 559 +++++++ .../implementation/OperationsClientImpl.java | 269 ++++ .../implementation/OperationsImpl.java | 46 + .../implementation/SavedSearchImpl.java | 208 +++ .../SavedSearchesClientImpl.java | 775 +++++++++ .../implementation/SavedSearchesImpl.java | 204 +++ .../SavedSearchesListResultImpl.java | 47 + .../implementation/SchemasClientImpl.java | 220 +++ .../implementation/SchemasImpl.java | 61 + .../SearchGetSchemaResponseImpl.java | 45 + .../implementation/SharedKeysImpl.java | 36 + .../SharedKeysOperationsClientImpl.java | 391 +++++ .../SharedKeysOperationsImpl.java | 85 + .../StorageInsightConfigsClientImpl.java | 901 +++++++++++ .../StorageInsightConfigsImpl.java | 204 +++ .../implementation/StorageInsightImpl.java | 199 +++ .../implementation/TableImpl.java | 44 + .../implementation/TablesClientImpl.java | 618 +++++++ .../implementation/TablesImpl.java | 97 ++ .../implementation/UsageMetricImpl.java | 54 + .../implementation/UsagesClientImpl.java | 239 +++ .../implementation/UsagesImpl.java | 46 + .../loganalytics/implementation/Utils.java | 31 + .../implementation/WorkspaceImpl.java | 284 ++++ .../WorkspacePurgeResponseImpl.java | 32 + .../WorkspacePurgeStatusResponseImpl.java | 34 + .../WorkspacePurgesClientImpl.java | 450 ++++++ .../implementation/WorkspacePurgesImpl.java | 89 + .../implementation/WorkspacesClientImpl.java | 1322 +++++++++++++++ .../implementation/WorkspacesImpl.java | 175 ++ .../implementation/package-info.java | 6 + .../models/AvailableServiceTier.java | 68 + .../models/AvailableServiceTiers.java | 38 + .../models/AzureEntityResource.java | 40 + .../loganalytics/models/Cluster.java | 299 ++++ .../models/ClusterEntityStatus.java | 49 + .../models/ClusterListResult.java | 81 + .../loganalytics/models/ClusterPatch.java | 111 ++ .../loganalytics/models/ClusterSku.java | 76 + .../models/ClusterSkuNameEnum.java | 31 + .../loganalytics/models/Clusters.java | 155 ++ .../loganalytics/models/CoreSummary.java | 76 + .../loganalytics/models/DataExport.java | 345 ++++ .../models/DataExportListResult.java | 55 + .../loganalytics/models/DataExports.java | 145 ++ .../models/DataIngestionStatus.java | 46 + .../loganalytics/models/DataSource.java | 241 +++ .../loganalytics/models/DataSourceKind.java | 132 ++ .../models/DataSourceListResult.java | 81 + .../loganalytics/models/DataSourceType.java | 53 + .../loganalytics/models/DataSources.java | 149 ++ .../models/DeletedWorkspaces.java | 54 + .../models/ErrorAdditionalInfo.java | 54 + .../loganalytics/models/Gateways.java | 38 + .../loganalytics/models/Identity.java | 84 + .../loganalytics/models/IdentityType.java | 47 + .../loganalytics/models/IntelligencePack.java | 38 + .../models/IntelligencePacks.java | 91 ++ .../models/KeyVaultProperties.java | 103 ++ .../loganalytics/models/LinkedService.java | 249 +++ .../models/LinkedServiceEntityStatus.java | 40 + .../models/LinkedServiceListResult.java | 55 + .../loganalytics/models/LinkedServices.java | 123 ++ .../models/LinkedStorageAccounts.java | 150 ++ .../LinkedStorageAccountsListResult.java | 55 + .../models/LinkedStorageAccountsResource.java | 157 ++ .../loganalytics/models/ManagementGroup.java | 74 + .../loganalytics/models/ManagementGroups.java | 36 + .../loganalytics/models/MetricName.java | 76 + .../loganalytics/models/Operation.java | 31 + .../loganalytics/models/OperationDisplay.java | 128 ++ .../models/OperationListResult.java | 71 + .../loganalytics/models/OperationStatus.java | 60 + .../models/OperationStatuses.java | 36 + .../loganalytics/models/Operations.java | 31 + .../models/PrivateLinkScopedResource.java | 76 + .../models/PublicNetworkAccessType.java | 34 + .../loganalytics/models/PurgeState.java | 34 + .../loganalytics/models/SavedSearch.java | 376 +++++ .../loganalytics/models/SavedSearches.java | 145 ++ .../models/SavedSearchesListResult.java | 25 + .../loganalytics/models/Schemas.java | 36 + .../models/SearchGetSchemaResponse.java | 32 + .../loganalytics/models/SearchMetadata.java | 477 ++++++ .../models/SearchMetadataSchema.java | 76 + .../models/SearchSchemaValue.java | 207 +++ .../loganalytics/models/SearchSort.java | 76 + .../loganalytics/models/SearchSortEnum.java | 34 + .../loganalytics/models/SharedKeys.java | 31 + .../models/SharedKeysOperations.java | 63 + .../loganalytics/models/SkuNameEnum.java | 49 + .../loganalytics/models/StorageAccount.java | 86 + .../loganalytics/models/StorageInsight.java | 276 ++++ .../models/StorageInsightConfigs.java | 145 ++ .../models/StorageInsightListResult.java | 81 + .../models/StorageInsightState.java | 34 + .../models/StorageInsightStatus.java | 81 + .../loganalytics/models/Table.java | 46 + .../loganalytics/models/Tables.java | 95 ++ .../loganalytics/models/TablesListResult.java | 55 + .../loganalytics/models/Tag.java | 84 + .../loganalytics/models/Type.java | 34 + .../loganalytics/models/UsageMetric.java | 60 + .../loganalytics/models/Usages.java | 36 + .../loganalytics/models/Workspace.java | 405 +++++ .../loganalytics/models/WorkspaceCapping.java | 80 + .../models/WorkspaceEntityStatus.java | 49 + .../WorkspaceListManagementGroupsResult.java | 55 + .../models/WorkspaceListResult.java | 55 + .../models/WorkspaceListUsagesResult.java | 55 + .../loganalytics/models/WorkspacePatch.java | 252 +++ .../models/WorkspacePurgeBody.java | 90 ++ .../models/WorkspacePurgeBodyFilters.java | 140 ++ .../models/WorkspacePurgeResponse.java | 24 + .../models/WorkspacePurgeStatusResponse.java | 24 + .../loganalytics/models/WorkspacePurges.java | 77 + .../models/WorkspacePurgesPurgeHeaders.java | 50 + .../models/WorkspacePurgesPurgeResponse.java | 38 + .../loganalytics/models/WorkspaceSku.java | 116 ++ .../models/WorkspaceSkuNameEnum.java | 49 + .../loganalytics/models/Workspaces.java | 182 +++ .../loganalytics/models/package-info.java | 6 + .../loganalytics/package-info.java | 6 + .../src/main/java/module-info.java | 19 + sdk/loganalytics/ci.yml | 31 +- sdk/loganalytics/pom.xml | 1 + 210 files changed, 31784 insertions(+), 35 deletions(-) create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/CHANGELOG.md create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/README.md create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/pom.xml create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/LogAnalyticsManager.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/AvailableServiceTiersClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/ClustersClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DataExportsClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DataSourcesClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DeletedWorkspacesClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/GatewaysClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/IntelligencePacksClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/LinkedServicesClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/LinkedStorageAccountsClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/ManagementGroupsClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationStatusesClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationalInsightsManagementClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationsClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SavedSearchesClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SchemasClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SharedKeysOperationsClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/StorageInsightConfigsClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/TablesClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/UsagesClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/WorkspacePurgesClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/WorkspacesClient.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/AvailableServiceTierInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/ClusterInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/DataExportInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/DataSourceInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/IntelligencePackInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/LinkedServiceInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/LinkedStorageAccountsResourceInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/ManagementGroupInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/OperationInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/OperationStatusInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SavedSearchInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SavedSearchesListResultInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SearchGetSchemaResponseInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SharedKeysInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/StorageInsightInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/TableInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/UsageMetricInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspaceInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspacePurgeResponseInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspacePurgeStatusResponseInner.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/package-info.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/package-info.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTierImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTiersClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTiersImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClusterImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClustersClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClustersImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportsClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportsImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourceImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourcesClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourcesImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DeletedWorkspacesClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DeletedWorkspacesImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/GatewaysClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/GatewaysImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePackImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePacksClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePacksImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServiceImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServicesClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServicesImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsResourceImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupsClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupsImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusesClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusesImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationalInsightsManagementClientBuilder.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationalInsightsManagementClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationsClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationsImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesListResultImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SchemasClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SchemasImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SearchGetSchemaResponseImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysOperationsClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysOperationsImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightConfigsClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightConfigsImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TableImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TablesClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TablesImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsageMetricImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsagesClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsagesImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/Utils.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspaceImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgeResponseImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgeStatusResponseImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgesClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgesImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacesClientImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacesImpl.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/package-info.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AvailableServiceTier.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AvailableServiceTiers.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AzureEntityResource.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Cluster.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterEntityStatus.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterListResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterPatch.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterSku.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterSkuNameEnum.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Clusters.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/CoreSummary.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExport.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExportListResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExports.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataIngestionStatus.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSource.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceKind.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceListResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceType.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSources.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DeletedWorkspaces.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ErrorAdditionalInfo.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Gateways.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Identity.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IdentityType.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IntelligencePack.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IntelligencePacks.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/KeyVaultProperties.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedService.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServiceEntityStatus.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServiceListResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServices.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccounts.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccountsListResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccountsResource.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ManagementGroup.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ManagementGroups.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/MetricName.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Operation.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationDisplay.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationListResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationStatus.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationStatuses.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Operations.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PrivateLinkScopedResource.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PublicNetworkAccessType.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PurgeState.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearch.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearches.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearchesListResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Schemas.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchGetSchemaResponse.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchMetadata.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchMetadataSchema.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSchemaValue.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSort.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSortEnum.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SharedKeys.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SharedKeysOperations.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SkuNameEnum.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageAccount.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsight.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightConfigs.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightListResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightState.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightStatus.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Table.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Tables.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/TablesListResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Tag.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Type.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/UsageMetric.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Usages.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Workspace.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceCapping.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceEntityStatus.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListManagementGroupsResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListUsagesResult.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePatch.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeBody.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeBodyFilters.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeResponse.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeStatusResponse.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurges.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgesPurgeHeaders.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgesPurgeResponse.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceSku.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceSkuNameEnum.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Workspaces.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/package-info.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/package-info.java create mode 100644 sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/module-info.java diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 62906a566feea..464bc9b7cf1a7 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -110,6 +110,7 @@ org.springframework.kafka:spring-kafka;2.5.7.RELEASE org.springframework.security:spring-security-config;5.3.5.RELEASE org.springframework.security:spring-security-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-client;5.3.5.RELEASE +org.springframework.security:spring-security-oauth2-resource-server;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-jose;5.3.5.RELEASE org.springframework.security:spring-security-web;5.3.5.RELEASE diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fa2e6238ee364..a47ce1431e9ac 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -40,17 +40,22 @@ com.azure:azure-ai-anomalydetector;3.0.0-beta.1;3.0.0-beta.2 com.azure:azure-ai-formrecognizer;3.0.3;3.1.0-beta.2 com.azure:azure-ai-metricsadvisor;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-ai-textanalytics;5.0.1;5.1.0-beta.4 +com.azure:azure-analytics-synapse-accesscontrol;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-artifacts;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-spark;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-managedprivateendpoints;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-analytics-synapse-monitoring;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-communication-chat;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-common;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-administration;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-sms;1.0.0-beta.3;1.0.0-beta.4 -com.azure:azure-core;1.10.0;1.11.0 -com.azure:azure-core-amqp;1.6.0;1.7.0-beta.3 +com.azure:azure-core;1.11.0;1.12.0-beta.1 +com.azure:azure-core-amqp;2.0.0;2.1.0-beta.1 com.azure:azure-core-amqp-experimental;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-experimental;1.0.0-beta.8;1.0.0-beta.9 com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-core-http-netty;1.6.3;1.7.0 -com.azure:azure-core-http-okhttp;1.3.3;1.4.0 +com.azure:azure-core-http-netty;1.7.0;1.8.0-beta.1 +com.azure:azure-core-http-okhttp;1.4.0;1.5.0-beta.1 com.azure:azure-core-management;1.0.0;1.1.0-beta.1 com.azure:azure-core-serializer-avro-apache;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-core-serializer-avro-jackson;1.0.0-beta.1;1.0.0-beta.2 @@ -58,7 +63,7 @@ com.azure:azure-core-serializer-json-gson;1.0.3;1.1.0-beta.1 com.azure:azure-core-serializer-json-jackson;1.1.0;1.2.0-beta.1 com.azure:azure-core-test;1.5.1;1.6.0-beta.1 com.azure:azure-core-tracing-opentelemetry;1.0.0-beta.6;1.0.0-beta.7 -com.azure:azure-cosmos;4.8.0;4.9.0-beta.1 +com.azure:azure-cosmos;4.9.0;4.10.0-beta.1 com.azure:azure-cosmos-benchmark;4.0.1-beta.1;4.0.1-beta.1 com.azure:azure-cosmos-dotnet-benchmark;4.0.1-beta.1;4.0.1-beta.1 com.azure:azure-cosmos-encryption;1.0.0-beta.1;1.0.0-beta.1 @@ -68,12 +73,12 @@ com.azure:azure-data-schemaregistry-avro;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-data-tables;12.0.0-beta.3;12.0.0-beta.4 com.azure:azure-digitaltwins-core;1.0.1;1.1.0-beta.1 com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-identity;1.2.0;1.3.0-beta.1 +com.azure:azure-identity;1.2.0;1.2.1 com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventgrid;2.0.0-beta.3;2.0.0-beta.4 com.azure:azure-messaging-eventhubs;5.3.1;5.4.0-beta.2 com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.3.1;1.4.0-beta.2 -com.azure:azure-messaging-servicebus;7.0.0-beta.7;7.0.0-beta.8 +com.azure:azure-messaging-servicebus;7.0.0;7.1.0-beta.1 com.azure:azure-messaging-servicebus-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track2-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-search-documents;11.1.2;11.2.0-beta.4 @@ -84,19 +89,19 @@ com.azure:azure-security-keyvault-jca;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-security-keyvault-keys;4.2.3;4.3.0-beta.4 com.azure:azure-security-keyvault-secrets;4.2.3;4.3.0-beta.3 com.azure:azure-sdk-template;1.2.1-beta.2;1.2.1-beta.16 -com.azure:azure-spring-data-cosmos;3.1.0;3.2.0-beta.1 +com.azure:azure-spring-data-cosmos;3.2.0;3.3.0-beta.1 com.azure:azure-spring-data-cosmos-test;3.0.0-beta.1;3.0.0-beta.1 -com.azure:azure-storage-blob;12.9.0;12.10.0-beta.1 -com.azure:azure-storage-blob-batch;12.7.0;12.8.0-beta.1 +com.azure:azure-storage-blob;12.9.0;12.10.0-beta.2 +com.azure:azure-storage-blob-batch;12.7.0;12.8.0-beta.2 com.azure:azure-storage-blob-changefeed;12.0.0-beta.4;12.0.0-beta.5 -com.azure:azure-storage-blob-cryptography;12.9.0;12.10.0-beta.1 +com.azure:azure-storage-blob-cryptography;12.9.0;12.10.0-beta.2 com.azure:azure-storage-blob-nio;12.0.0-beta.2;12.0.0-beta.3 -com.azure:azure-storage-common;12.9.0;12.10.0-beta.1 -com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.1 -com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.1 -com.azure:azure-storage-internal-avro;12.0.1;12.1.0-beta.1 +com.azure:azure-storage-common;12.9.0;12.10.0-beta.2 +com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.2 +com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.2 +com.azure:azure-storage-internal-avro;12.0.1;12.0.2-beta.2 com.azure:azure-storage-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-storage-queue;12.7.0;12.8.0-beta.1 +com.azure:azure-storage-queue;12.7.0;12.8.0-beta.2 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 com.azure.spring:azure-spring-boot-starter-active-directory-b2c;3.0.0-beta.1;3.0.0-beta.2 com.azure.spring:azure-spring-boot-starter-active-directory;3.0.0-beta.1;3.0.0-beta.2 @@ -168,6 +173,7 @@ com.azure.resourcemanager:azure-resourcemanager-sql;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-storage;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-trafficmanager;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-test;2.0.0-beta.1;2.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0-beta.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 @@ -176,9 +182,7 @@ com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-b # Format; # unreleased_:;dependency-version # note: The unreleased dependencies will not be manipulated with the automatic PR creation code. -unreleased_com.azure:azure-core;1.11.0 -unreleased_com.azure:azure-core-amqp;1.7.0-beta.3 -unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 +unreleased_com.azure:azure-messaging-servicebus;7.0.0 # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current # version and set the version to the released beta. Released beta dependencies are only valid @@ -188,4 +192,3 @@ unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 # beta_:;dependency-version # note: Released beta versions will not be manipulated with the automatic PR creation code. beta_com.azure:azure-security-keyvault-keys;4.3.0-beta.1 -beta_com.azure:azure-core-amqp;1.7.0-beta.2 diff --git a/eng/versioning/version_data.txt b/eng/versioning/version_data.txt index 61c6a98825dfd..da53965c2792b 100644 --- a/eng/versioning/version_data.txt +++ b/eng/versioning/version_data.txt @@ -34,7 +34,7 @@ com.microsoft.azure:azure-keyvault-cryptography;1.2.4;1.3.0-beta.1 com.microsoft.azure:azure-keyvault-extensions;1.2.4;1.3.0-beta.1 com.microsoft.azure:azure-keyvault-test;1.2.3;1.2.4 com.microsoft.azure:azure-keyvault-webkey;1.2.4;1.3.0-beta.1 -com.microsoft.azure:azure-servicebus;3.5.0;3.5.1 +com.microsoft.azure:azure-servicebus;3.5.1;3.6.0-beta.1 com.microsoft.azure:azure-storage-blob;11.0.2;11.0.2 com.microsoft.azure.msi_auth_token_provider:azure-authentication-msi-token-provider;1.1.0-beta.1;1.1.0-beta.1 com.microsoft.azure:azure-eventgrid;1.4.0-beta.1;1.4.0-beta.1 diff --git a/pom.xml b/pom.xml index d97614e5dba32..85f448c1740a2 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ sdk/search sdk/servicebus sdk/storage + sdk/synapse sdk/tables sdk/template sdk/textanalytics diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/CHANGELOG.md b/sdk/loganalytics/azure-resourcemanager-loganalytics/CHANGELOG.md new file mode 100644 index 0000000000000..31124f8eb0dc2 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-14) + +- Azure Resource Manager LogAnalytics client library for Java. This package contains Microsoft Azure SDK for LogAnalytics Management SDK. Operational Insights Client. Package tag package-2020-08. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). \ No newline at end of file diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/README.md b/sdk/loganalytics/azure-resourcemanager-loganalytics/README.md new file mode 100644 index 0000000000000..920e88e02af4c --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/README.md @@ -0,0 +1,84 @@ +# Azure Resource Manager LogAnalytics client library for Java + +Azure Resource Manager LogAnalytics client library for Java. + +This package contains Microsoft Azure SDK for LogAnalytics Management SDK. Operational Insights Client. Package tag package-2020-08. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +```xml + + com.azure.resourcemanager + azure-resourcemanager-loganalytics + 1.0.0-beta.1 + +``` + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-loganalytics;current}) +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +LogAnalyticsManager manager = LogAnalyticsManager + .authenticate(credential, profile); +``` +[//]: # ({x-version-update-end}) + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/pom.xml b/sdk/loganalytics/azure-resourcemanager-loganalytics/pom.xml new file mode 100644 index 0000000000000..7061f334e90df --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-loganalytics + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for LogAnalytics Management + This package contains Microsoft Azure SDK for LogAnalytics Management SDK. Operational Insights Client. Package tag package-2020-08. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core-management + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/LogAnalyticsManager.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/LogAnalyticsManager.java new file mode 100644 index 0000000000000..98a1bd1600c75 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/LogAnalyticsManager.java @@ -0,0 +1,428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +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; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.OperationalInsightsManagementClient; +import com.azure.resourcemanager.loganalytics.implementation.AvailableServiceTiersImpl; +import com.azure.resourcemanager.loganalytics.implementation.ClustersImpl; +import com.azure.resourcemanager.loganalytics.implementation.DataExportsImpl; +import com.azure.resourcemanager.loganalytics.implementation.DataSourcesImpl; +import com.azure.resourcemanager.loganalytics.implementation.DeletedWorkspacesImpl; +import com.azure.resourcemanager.loganalytics.implementation.GatewaysImpl; +import com.azure.resourcemanager.loganalytics.implementation.IntelligencePacksImpl; +import com.azure.resourcemanager.loganalytics.implementation.LinkedServicesImpl; +import com.azure.resourcemanager.loganalytics.implementation.LinkedStorageAccountsImpl; +import com.azure.resourcemanager.loganalytics.implementation.ManagementGroupsImpl; +import com.azure.resourcemanager.loganalytics.implementation.OperationStatusesImpl; +import com.azure.resourcemanager.loganalytics.implementation.OperationalInsightsManagementClientBuilder; +import com.azure.resourcemanager.loganalytics.implementation.OperationsImpl; +import com.azure.resourcemanager.loganalytics.implementation.SavedSearchesImpl; +import com.azure.resourcemanager.loganalytics.implementation.SchemasImpl; +import com.azure.resourcemanager.loganalytics.implementation.SharedKeysOperationsImpl; +import com.azure.resourcemanager.loganalytics.implementation.StorageInsightConfigsImpl; +import com.azure.resourcemanager.loganalytics.implementation.TablesImpl; +import com.azure.resourcemanager.loganalytics.implementation.UsagesImpl; +import com.azure.resourcemanager.loganalytics.implementation.WorkspacePurgesImpl; +import com.azure.resourcemanager.loganalytics.implementation.WorkspacesImpl; +import com.azure.resourcemanager.loganalytics.models.AvailableServiceTiers; +import com.azure.resourcemanager.loganalytics.models.Clusters; +import com.azure.resourcemanager.loganalytics.models.DataExports; +import com.azure.resourcemanager.loganalytics.models.DataSources; +import com.azure.resourcemanager.loganalytics.models.DeletedWorkspaces; +import com.azure.resourcemanager.loganalytics.models.Gateways; +import com.azure.resourcemanager.loganalytics.models.IntelligencePacks; +import com.azure.resourcemanager.loganalytics.models.LinkedServices; +import com.azure.resourcemanager.loganalytics.models.LinkedStorageAccounts; +import com.azure.resourcemanager.loganalytics.models.ManagementGroups; +import com.azure.resourcemanager.loganalytics.models.OperationStatuses; +import com.azure.resourcemanager.loganalytics.models.Operations; +import com.azure.resourcemanager.loganalytics.models.SavedSearches; +import com.azure.resourcemanager.loganalytics.models.Schemas; +import com.azure.resourcemanager.loganalytics.models.SharedKeysOperations; +import com.azure.resourcemanager.loganalytics.models.StorageInsightConfigs; +import com.azure.resourcemanager.loganalytics.models.Tables; +import com.azure.resourcemanager.loganalytics.models.Usages; +import com.azure.resourcemanager.loganalytics.models.WorkspacePurges; +import com.azure.resourcemanager.loganalytics.models.Workspaces; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to LogAnalyticsManager. Operational Insights Client. */ +public final class LogAnalyticsManager { + private DataExports dataExports; + + private DataSources dataSources; + + private IntelligencePacks intelligencePacks; + + private LinkedServices linkedServices; + + private LinkedStorageAccounts linkedStorageAccounts; + + private ManagementGroups managementGroups; + + private Operations operations; + + private OperationStatuses operationStatuses; + + private SharedKeysOperations sharedKeysOperations; + + private Usages usages; + + private Workspaces workspaces; + + private DeletedWorkspaces deletedWorkspaces; + + private Clusters clusters; + + private StorageInsightConfigs storageInsightConfigs; + + private SavedSearches savedSearches; + + private AvailableServiceTiers availableServiceTiers; + + private Gateways gateways; + + private Schemas schemas; + + private WorkspacePurges workspacePurges; + + private Tables tables; + + private final OperationalInsightsManagementClient clientObject; + + private LogAnalyticsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new OperationalInsightsManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of LogAnalytics service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the LogAnalytics service API instance. + */ + public static LogAnalyticsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create LogAnalyticsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new LogAnalyticsManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of LogAnalytics service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the LogAnalytics service API instance. + */ + public LogAnalyticsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies + .add( + new UserAgentPolicy( + null, + "com.azure.resourcemanager.loganalytics", + "1.0.0-beta.1", + Configuration.getGlobalConfiguration())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new LogAnalyticsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of DataExports. */ + public DataExports dataExports() { + if (this.dataExports == null) { + this.dataExports = new DataExportsImpl(clientObject.getDataExports(), this); + } + return dataExports; + } + + /** @return Resource collection API of DataSources. */ + public DataSources dataSources() { + if (this.dataSources == null) { + this.dataSources = new DataSourcesImpl(clientObject.getDataSources(), this); + } + return dataSources; + } + + /** @return Resource collection API of IntelligencePacks. */ + public IntelligencePacks intelligencePacks() { + if (this.intelligencePacks == null) { + this.intelligencePacks = new IntelligencePacksImpl(clientObject.getIntelligencePacks(), this); + } + return intelligencePacks; + } + + /** @return Resource collection API of LinkedServices. */ + public LinkedServices linkedServices() { + if (this.linkedServices == null) { + this.linkedServices = new LinkedServicesImpl(clientObject.getLinkedServices(), this); + } + return linkedServices; + } + + /** @return Resource collection API of LinkedStorageAccounts. */ + public LinkedStorageAccounts linkedStorageAccounts() { + if (this.linkedStorageAccounts == null) { + this.linkedStorageAccounts = new LinkedStorageAccountsImpl(clientObject.getLinkedStorageAccounts(), this); + } + return linkedStorageAccounts; + } + + /** @return Resource collection API of ManagementGroups. */ + public ManagementGroups managementGroups() { + if (this.managementGroups == null) { + this.managementGroups = new ManagementGroupsImpl(clientObject.getManagementGroups(), this); + } + return managementGroups; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of OperationStatuses. */ + public OperationStatuses operationStatuses() { + if (this.operationStatuses == null) { + this.operationStatuses = new OperationStatusesImpl(clientObject.getOperationStatuses(), this); + } + return operationStatuses; + } + + /** @return Resource collection API of SharedKeysOperations. */ + public SharedKeysOperations sharedKeysOperations() { + if (this.sharedKeysOperations == null) { + this.sharedKeysOperations = new SharedKeysOperationsImpl(clientObject.getSharedKeysOperations(), this); + } + return sharedKeysOperations; + } + + /** @return Resource collection API of Usages. */ + public Usages usages() { + if (this.usages == null) { + this.usages = new UsagesImpl(clientObject.getUsages(), this); + } + return usages; + } + + /** @return Resource collection API of Workspaces. */ + public Workspaces workspaces() { + if (this.workspaces == null) { + this.workspaces = new WorkspacesImpl(clientObject.getWorkspaces(), this); + } + return workspaces; + } + + /** @return Resource collection API of DeletedWorkspaces. */ + public DeletedWorkspaces deletedWorkspaces() { + if (this.deletedWorkspaces == null) { + this.deletedWorkspaces = new DeletedWorkspacesImpl(clientObject.getDeletedWorkspaces(), this); + } + return deletedWorkspaces; + } + + /** @return Resource collection API of Clusters. */ + public Clusters clusters() { + if (this.clusters == null) { + this.clusters = new ClustersImpl(clientObject.getClusters(), this); + } + return clusters; + } + + /** @return Resource collection API of StorageInsightConfigs. */ + public StorageInsightConfigs storageInsightConfigs() { + if (this.storageInsightConfigs == null) { + this.storageInsightConfigs = new StorageInsightConfigsImpl(clientObject.getStorageInsightConfigs(), this); + } + return storageInsightConfigs; + } + + /** @return Resource collection API of SavedSearches. */ + public SavedSearches savedSearches() { + if (this.savedSearches == null) { + this.savedSearches = new SavedSearchesImpl(clientObject.getSavedSearches(), this); + } + return savedSearches; + } + + /** @return Resource collection API of AvailableServiceTiers. */ + public AvailableServiceTiers availableServiceTiers() { + if (this.availableServiceTiers == null) { + this.availableServiceTiers = new AvailableServiceTiersImpl(clientObject.getAvailableServiceTiers(), this); + } + return availableServiceTiers; + } + + /** @return Resource collection API of Gateways. */ + public Gateways gateways() { + if (this.gateways == null) { + this.gateways = new GatewaysImpl(clientObject.getGateways(), this); + } + return gateways; + } + + /** @return Resource collection API of Schemas. */ + public Schemas schemas() { + if (this.schemas == null) { + this.schemas = new SchemasImpl(clientObject.getSchemas(), this); + } + return schemas; + } + + /** @return Resource collection API of WorkspacePurges. */ + public WorkspacePurges workspacePurges() { + if (this.workspacePurges == null) { + this.workspacePurges = new WorkspacePurgesImpl(clientObject.getWorkspacePurges(), this); + } + return workspacePurges; + } + + /** @return Resource collection API of Tables. */ + public Tables tables() { + if (this.tables == null) { + this.tables = new TablesImpl(clientObject.getTables(), this); + } + return tables; + } + + /** + * @return Wrapped service client OperationalInsightsManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public OperationalInsightsManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/AvailableServiceTiersClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/AvailableServiceTiersClient.java new file mode 100644 index 0000000000000..87da77ea34182 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/AvailableServiceTiersClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.AvailableServiceTierInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in AvailableServiceTiersClient. */ +public interface AvailableServiceTiersClient { + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 available service tiers for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 available service tiers for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/ClustersClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/ClustersClient.java new file mode 100644 index 0000000000000..b99600c90fae8 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/ClustersClient.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.loganalytics.fluent.models.ClusterInner; +import com.azure.resourcemanager.loganalytics.models.ClusterPatch; + +/** An instance of this class provides access to all the operations defined in ClustersClient. */ +public interface ClustersClient { + /** + * Gets Log Analytics clusters in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 log Analytics clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets Log Analytics clusters in a 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 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 log Analytics clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @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 Log Analytics clusters in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @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 Log Analytics clusters in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ClusterInner> beginCreateOrUpdate( + String resourceGroupName, String clusterName, ClusterInner parameters); + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ClusterInner> beginCreateOrUpdate( + String resourceGroupName, String clusterName, ClusterInner parameters, Context context); + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner createOrUpdate(String resourceGroupName, String clusterName, ClusterInner parameters); + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner createOrUpdate(String resourceGroupName, String clusterName, ClusterInner parameters, Context context); + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName); + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName, Context context); + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 clusterName); + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 clusterName, Context context); + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 Log Analytics cluster instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner getByResourceGroup(String resourceGroupName, String clusterName); + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 Log Analytics cluster instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context); + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner update(String resourceGroupName, String clusterName, ClusterPatch parameters); + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String clusterName, ClusterPatch parameters, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DataExportsClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DataExportsClient.java new file mode 100644 index 0000000000000..e55f2efcc7857 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DataExportsClient.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.loganalytics.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.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.DataExportInner; + +/** An instance of this class provides access to all the operations defined in DataExportsClient. */ +public interface DataExportsClient { + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 the request to list data exports. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 the request to list data exports. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The top level data export resource container. + * @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 top level data export resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataExportInner createOrUpdate( + String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters); + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The top level data export resource container. + * @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 top level data export resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String workspaceName, + String dataExportName, + DataExportInner parameters, + Context context); + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 a data export instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataExportInner get(String resourceGroupName, String workspaceName, String dataExportName); + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 a data export instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String workspaceName, String dataExportName, Context context); + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String dataExportName); + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String workspaceName, String dataExportName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DataSourcesClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DataSourcesClient.java new file mode 100644 index 0000000000000..2ae8179117a97 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DataSourcesClient.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.DataSourceInner; + +/** An instance of this class provides access to all the operations defined in DataSourcesClient. */ +public interface DataSourcesClient { + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters Datasources under OMS Workspace. + * @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 datasources under OMS Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataSourceInner createOrUpdate( + String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters); + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters Datasources under OMS Workspace. + * @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 datasources under OMS Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String workspaceName, + String dataSourceName, + DataSourceInner parameters, + Context context); + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 workspaceName, String dataSourceName); + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String workspaceName, String dataSourceName, Context context); + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 datasource instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataSourceInner get(String resourceGroupName, String workspaceName, String dataSourceName); + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 datasource instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String workspaceName, String dataSourceName, Context context); + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the 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 first page of data source instances in a workspace with the link to the next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, String filter); + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @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 first page of data source instances in a workspace with the link to the next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, String filter, String skiptoken, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DeletedWorkspacesClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DeletedWorkspacesClient.java new file mode 100644 index 0000000000000..bfe3d7e6f65e6 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/DeletedWorkspacesClient.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.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspaceInner; + +/** An instance of this class provides access to all the operations defined in DeletedWorkspacesClient. */ +public interface DeletedWorkspacesClient { + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @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 recently deleted workspaces in a subscription, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @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 recently deleted workspaces in a subscription, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 recently deleted workspaces in a resource group, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @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 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 recently deleted workspaces in a resource group, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/GatewaysClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/GatewaysClient.java new file mode 100644 index 0000000000000..67166742fd62a --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/GatewaysClient.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** An instance of this class provides access to all the operations defined in GatewaysClient. */ +public interface GatewaysClient { + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String gatewayId); + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String workspaceName, String gatewayId, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/IntelligencePacksClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/IntelligencePacksClient.java new file mode 100644 index 0000000000000..f9f450e40ec3f --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/IntelligencePacksClient.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.IntelligencePackInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in IntelligencePacksClient. */ +public interface IntelligencePacksClient { + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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 disable(String resourceGroupName, String workspaceName, String intelligencePackName); + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response disableWithResponse( + String resourceGroupName, String workspaceName, String intelligencePackName, Context context); + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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 enable(String resourceGroupName, String workspaceName, String intelligencePackName); + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response enableWithResponse( + String resourceGroupName, String workspaceName, String intelligencePackName, Context context); + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 array of IntelligencePack. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List list(String resourceGroupName, String workspaceName); + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 array of IntelligencePack. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listWithResponse( + String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/LinkedServicesClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/LinkedServicesClient.java new file mode 100644 index 0000000000000..b60df04636c4b --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/LinkedServicesClient.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.loganalytics.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.loganalytics.fluent.models.LinkedServiceInner; + +/** An instance of this class provides access to all the operations defined in LinkedServicesClient. */ +public interface LinkedServicesClient { + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LinkedServiceInner> beginCreateOrUpdate( + String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters); + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LinkedServiceInner> beginCreateOrUpdate( + String resourceGroupName, + String workspaceName, + String linkedServiceName, + LinkedServiceInner parameters, + Context context); + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkedServiceInner createOrUpdate( + String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters); + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkedServiceInner createOrUpdate( + String resourceGroupName, + String workspaceName, + String linkedServiceName, + LinkedServiceInner parameters, + Context context); + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LinkedServiceInner> beginDelete( + String resourceGroupName, String workspaceName, String linkedServiceName); + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LinkedServiceInner> beginDelete( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context); + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkedServiceInner delete(String resourceGroupName, String workspaceName, String linkedServiceName); + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkedServiceInner delete( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context); + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 linked service instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkedServiceInner get(String resourceGroupName, String workspaceName, String linkedServiceName); + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 linked service instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context); + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 linked services instances in a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 linked services instances in a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/LinkedStorageAccountsClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/LinkedStorageAccountsClient.java new file mode 100644 index 0000000000000..eae3164bf4251 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/LinkedStorageAccountsClient.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedStorageAccountsResourceInner; +import com.azure.resourcemanager.loganalytics.models.DataSourceType; + +/** An instance of this class provides access to all the operations defined in LinkedStorageAccountsClient. */ +public interface LinkedStorageAccountsClient { + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data + * source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @param parameters Linked storage accounts top level resource container. + * @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 linked storage accounts top level resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkedStorageAccountsResourceInner createOrUpdate( + String resourceGroupName, + String workspaceName, + DataSourceType dataSourceType, + LinkedStorageAccountsResourceInner parameters); + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data + * source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @param parameters Linked storage accounts top level resource container. + * @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 linked storage accounts top level resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String workspaceName, + DataSourceType dataSourceType, + LinkedStorageAccountsResourceInner parameters, + Context context); + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 workspaceName, DataSourceType dataSourceType); + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType, Context context); + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkedStorageAccountsResourceInner get( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType); + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType, Context context); + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/ManagementGroupsClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/ManagementGroupsClient.java new file mode 100644 index 0000000000000..827ffa2140649 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/ManagementGroupsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.ManagementGroupInner; + +/** An instance of this class provides access to all the operations defined in ManagementGroupsClient. */ +public interface ManagementGroupsClient { + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list of management groups connected to a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list of management groups connected to a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationStatusesClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationStatusesClient.java new file mode 100644 index 0000000000000..d28d2e6578780 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationStatusesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.OperationStatusInner; + +/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */ +public interface OperationStatusesClient { + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation 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 status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusInner get(String location, String asyncOperationId); + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation 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 status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String asyncOperationId, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationalInsightsManagementClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationalInsightsManagementClient.java new file mode 100644 index 0000000000000..ecb9e1ead6dc4 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationalInsightsManagementClient.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for OperationalInsightsManagementClient class. */ +public interface OperationalInsightsManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the DataExportsClient object to access its operations. + * + * @return the DataExportsClient object. + */ + DataExportsClient getDataExports(); + + /** + * Gets the DataSourcesClient object to access its operations. + * + * @return the DataSourcesClient object. + */ + DataSourcesClient getDataSources(); + + /** + * Gets the IntelligencePacksClient object to access its operations. + * + * @return the IntelligencePacksClient object. + */ + IntelligencePacksClient getIntelligencePacks(); + + /** + * Gets the LinkedServicesClient object to access its operations. + * + * @return the LinkedServicesClient object. + */ + LinkedServicesClient getLinkedServices(); + + /** + * Gets the LinkedStorageAccountsClient object to access its operations. + * + * @return the LinkedStorageAccountsClient object. + */ + LinkedStorageAccountsClient getLinkedStorageAccounts(); + + /** + * Gets the ManagementGroupsClient object to access its operations. + * + * @return the ManagementGroupsClient object. + */ + ManagementGroupsClient getManagementGroups(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the OperationStatusesClient object to access its operations. + * + * @return the OperationStatusesClient object. + */ + OperationStatusesClient getOperationStatuses(); + + /** + * Gets the SharedKeysOperationsClient object to access its operations. + * + * @return the SharedKeysOperationsClient object. + */ + SharedKeysOperationsClient getSharedKeysOperations(); + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + UsagesClient getUsages(); + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + WorkspacesClient getWorkspaces(); + + /** + * Gets the DeletedWorkspacesClient object to access its operations. + * + * @return the DeletedWorkspacesClient object. + */ + DeletedWorkspacesClient getDeletedWorkspaces(); + + /** + * Gets the ClustersClient object to access its operations. + * + * @return the ClustersClient object. + */ + ClustersClient getClusters(); + + /** + * Gets the StorageInsightConfigsClient object to access its operations. + * + * @return the StorageInsightConfigsClient object. + */ + StorageInsightConfigsClient getStorageInsightConfigs(); + + /** + * Gets the SavedSearchesClient object to access its operations. + * + * @return the SavedSearchesClient object. + */ + SavedSearchesClient getSavedSearches(); + + /** + * Gets the AvailableServiceTiersClient object to access its operations. + * + * @return the AvailableServiceTiersClient object. + */ + AvailableServiceTiersClient getAvailableServiceTiers(); + + /** + * Gets the GatewaysClient object to access its operations. + * + * @return the GatewaysClient object. + */ + GatewaysClient getGateways(); + + /** + * Gets the SchemasClient object to access its operations. + * + * @return the SchemasClient object. + */ + SchemasClient getSchemas(); + + /** + * Gets the WorkspacePurgesClient object to access its operations. + * + * @return the WorkspacePurgesClient object. + */ + WorkspacePurgesClient getWorkspacePurges(); + + /** + * Gets the TablesClient object to access its operations. + * + * @return the TablesClient object. + */ + TablesClient getTables(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationsClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationsClient.java new file mode 100644 index 0000000000000..d96ce122c9e6a --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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 the request to list solution operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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 the request to list solution operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SavedSearchesClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SavedSearchesClient.java new file mode 100644 index 0000000000000..fb9bbcf1cf0c8 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SavedSearchesClient.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchInner; +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchesListResultInner; + +/** An instance of this class provides access to all the operations defined in SavedSearchesClient. */ +public interface SavedSearchesClient { + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 workspaceName, String savedSearchId); + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String workspaceName, String savedSearchId, Context context); + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters Value object for saved search results. + * @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 value object for saved search results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SavedSearchInner createOrUpdate( + String resourceGroupName, String workspaceName, String savedSearchId, SavedSearchInner parameters); + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters Value object for saved search results. + * @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 value object for saved search results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String workspaceName, + String savedSearchId, + SavedSearchInner parameters, + Context context); + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 specified saved search for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SavedSearchInner get(String resourceGroupName, String workspaceName, String savedSearchId); + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 specified saved search for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String workspaceName, String savedSearchId, Context context); + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 saved searches for a given Log Analytics Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SavedSearchesListResultInner listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 saved searches for a given Log Analytics Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SchemasClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SchemasClient.java new file mode 100644 index 0000000000000..d7470e311ab71 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SchemasClient.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.SearchGetSchemaResponseInner; + +/** An instance of this class provides access to all the operations defined in SchemasClient. */ +public interface SchemasClient { + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 schema for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SearchGetSchemaResponseInner get(String resourceGroupName, String workspaceName); + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 schema for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SharedKeysOperationsClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SharedKeysOperationsClient.java new file mode 100644 index 0000000000000..7cf8175233649 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/SharedKeysOperationsClient.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.SharedKeysInner; + +/** An instance of this class provides access to all the operations defined in SharedKeysOperationsClient. */ +public interface SharedKeysOperationsClient { + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedKeysInner getSharedKeys(String resourceGroupName, String workspaceName); + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getSharedKeysWithResponse( + String resourceGroupName, String workspaceName, Context context); + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational + * Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedKeysInner regenerate(String resourceGroupName, String workspaceName); + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational + * Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response regenerateWithResponse(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/StorageInsightConfigsClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/StorageInsightConfigsClient.java new file mode 100644 index 0000000000000..865220f57b9c9 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/StorageInsightConfigsClient.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.loganalytics.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.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.StorageInsightInner; + +/** An instance of this class provides access to all the operations defined in StorageInsightConfigsClient. */ +public interface StorageInsightConfigsClient { + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @param parameters The top level storage insight resource container. + * @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 top level storage insight resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageInsightInner createOrUpdate( + String resourceGroupName, String workspaceName, String storageInsightName, StorageInsightInner parameters); + + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @param parameters The top level storage insight resource container. + * @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 top level storage insight resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String workspaceName, + String storageInsightName, + StorageInsightInner parameters, + Context context); + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 storage insight instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageInsightInner get(String resourceGroupName, String workspaceName, String storageInsightName); + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 storage insight instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String workspaceName, String storageInsightName, Context context); + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 workspaceName, String storageInsightName); + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String workspaceName, String storageInsightName, Context context); + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list storage insights operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list storage insights operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/TablesClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/TablesClient.java new file mode 100644 index 0000000000000..34da5a2b9a042 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/TablesClient.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.TableInner; + +/** An instance of this class provides access to all the operations defined in TablesClient. */ +public interface TablesClient { + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all the tables for the specified Log Analytics workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all the tables for the specified Log Analytics workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param parameters Workspace data table definition. + * @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 workspace data table definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TableInner update(String resourceGroupName, String workspaceName, String tableName, TableInner parameters); + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param parameters Workspace data table definition. + * @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 workspace data table definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String workspaceName, String tableName, TableInner parameters, Context context); + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 Log Analytics workspace table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TableInner get(String resourceGroupName, String workspaceName, String tableName); + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 Log Analytics workspace table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String workspaceName, String tableName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/UsagesClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/UsagesClient.java new file mode 100644 index 0000000000000..17a73a511dc34 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/UsagesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.UsageMetricInner; + +/** An instance of this class provides access to all the operations defined in UsagesClient. */ +public interface UsagesClient { + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list of usage metrics for a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list of usage metrics for a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/WorkspacePurgesClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/WorkspacePurgesClient.java new file mode 100644 index 0000000000000..2fbad457d32a6 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/WorkspacePurgesClient.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeResponseInner; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeStatusResponseInner; +import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeBody; + +/** An instance of this class provides access to all the operations defined in WorkspacePurgesClient. */ +public interface WorkspacePurgesClient { + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + * + *

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch + * the execution of purge requests by sending a single command whose predicate includes all user identities that + * require purging. Use the in operator to specify multiple identities. You should run the query prior to using for + * a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a purge request for an App Insights Workspace. + * @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 response containing operationId for a specific purge action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspacePurgeResponseInner purge(String resourceGroupName, String workspaceName, WorkspacePurgeBody body); + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + * + *

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch + * the execution of purge requests by sending a single command whose predicate includes all user identities that + * require purging. Use the in operator to specify multiple identities. You should run the query prior to using for + * a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a purge request for an App Insights Workspace. + * @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 response containing operationId for a specific purge action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response purgeWithResponse( + String resourceGroupName, String workspaceName, WorkspacePurgeBody body, Context context); + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @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 status of an ongoing purge operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspacePurgeStatusResponseInner getPurgeStatus(String resourceGroupName, String workspaceName, String purgeId); + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @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 status of an ongoing purge operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getPurgeStatusWithResponse( + String resourceGroupName, String workspaceName, String purgeId, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/WorkspacesClient.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/WorkspacesClient.java new file mode 100644 index 0000000000000..1be1a6da2dfb9 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/WorkspacesClient.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.loganalytics.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.loganalytics.models.WorkspacePatch; + +/** An instance of this class provides access to all the operations defined in WorkspacesClient. */ +public interface WorkspacesClient { + /** + * Gets the workspaces in a subscription. + * + * @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 workspaces in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the workspaces in a subscription. + * + * @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 workspaces in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 workspaces in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets workspaces in a 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 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 workspaces in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, WorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, String workspaceName, WorkspaceInner parameters); + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, WorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, String workspaceName, WorkspaceInner parameters, Context context); + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner createOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner parameters); + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner createOrUpdate( + String resourceGroupName, String workspaceName, WorkspaceInner parameters, Context context); + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, Boolean force); + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String workspaceName, Boolean force, Context context); + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 workspaceName, Boolean force); + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspaceName); + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 workspaceName, Boolean force, Context context); + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner getByResourceGroup(String resourceGroupName, String workspaceName); + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceName, Context context); + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner update(String resourceGroupName, String workspaceName, WorkspacePatch parameters); + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String workspaceName, WorkspacePatch parameters, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/AvailableServiceTierInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/AvailableServiceTierInner.java new file mode 100644 index 0000000000000..dfa21413205f6 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/AvailableServiceTierInner.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.SkuNameEnum; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Service Tier details. */ +@Immutable +public final class AvailableServiceTierInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailableServiceTierInner.class); + + /* + * The name of the Service Tier. + */ + @JsonProperty(value = "serviceTier", access = JsonProperty.Access.WRITE_ONLY) + private SkuNameEnum serviceTier; + + /* + * True if the Service Tier is enabled for the workspace. + */ + @JsonProperty(value = "enabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean enabled; + + /* + * The minimum retention for the Service Tier, in days. + */ + @JsonProperty(value = "minimumRetention", access = JsonProperty.Access.WRITE_ONLY) + private Long minimumRetention; + + /* + * The maximum retention for the Service Tier, in days. + */ + @JsonProperty(value = "maximumRetention", access = JsonProperty.Access.WRITE_ONLY) + private Long maximumRetention; + + /* + * The default retention for the Service Tier, in days. + */ + @JsonProperty(value = "defaultRetention", access = JsonProperty.Access.WRITE_ONLY) + private Long defaultRetention; + + /* + * The capacity reservation level in GB per day. Returned for the Capacity + * Reservation Service Tier. + */ + @JsonProperty(value = "capacityReservationLevel", access = JsonProperty.Access.WRITE_ONLY) + private Long capacityReservationLevel; + + /* + * Time when the sku was last updated for the workspace. Returned for the + * Capacity Reservation Service Tier. + */ + @JsonProperty(value = "lastSkuUpdate", access = JsonProperty.Access.WRITE_ONLY) + private String lastSkuUpdate; + + /** + * Get the serviceTier property: The name of the Service Tier. + * + * @return the serviceTier value. + */ + public SkuNameEnum serviceTier() { + return this.serviceTier; + } + + /** + * Get the enabled property: True if the Service Tier is enabled for the workspace. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Get the minimumRetention property: The minimum retention for the Service Tier, in days. + * + * @return the minimumRetention value. + */ + public Long minimumRetention() { + return this.minimumRetention; + } + + /** + * Get the maximumRetention property: The maximum retention for the Service Tier, in days. + * + * @return the maximumRetention value. + */ + public Long maximumRetention() { + return this.maximumRetention; + } + + /** + * Get the defaultRetention property: The default retention for the Service Tier, in days. + * + * @return the defaultRetention value. + */ + public Long defaultRetention() { + return this.defaultRetention; + } + + /** + * Get the capacityReservationLevel property: The capacity reservation level in GB per day. Returned for the + * Capacity Reservation Service Tier. + * + * @return the capacityReservationLevel value. + */ + public Long capacityReservationLevel() { + return this.capacityReservationLevel; + } + + /** + * Get the lastSkuUpdate property: Time when the sku was last updated for the workspace. Returned for the Capacity + * Reservation Service Tier. + * + * @return the lastSkuUpdate value. + */ + public String lastSkuUpdate() { + return this.lastSkuUpdate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/ClusterInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/ClusterInner.java new file mode 100644 index 0000000000000..d5bc163290d33 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/ClusterInner.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.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.ClusterEntityStatus; +import com.azure.resourcemanager.loganalytics.models.ClusterSku; +import com.azure.resourcemanager.loganalytics.models.Identity; +import com.azure.resourcemanager.loganalytics.models.KeyVaultProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The top level Log Analytics cluster resource container. */ +@JsonFlatten +@Fluent +public class ClusterInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterInner.class); + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * The sku properties. + */ + @JsonProperty(value = "sku") + private ClusterSku sku; + + /* + * The link used to get the next page of recommendations. + */ + @JsonProperty(value = "properties.nextLink") + private String nextLink; + + /* + * The ID associated with the cluster. + */ + @JsonProperty(value = "properties.clusterId", access = JsonProperty.Access.WRITE_ONLY) + private String clusterId; + + /* + * The provisioning state of the cluster. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ClusterEntityStatus provisioningState; + + /* + * The associated key properties. + */ + @JsonProperty(value = "properties.keyVaultProperties") + private KeyVaultProperties keyVaultProperties; + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the sku property: The sku properties. + * + * @return the sku value. + */ + public ClusterSku sku() { + return this.sku; + } + + /** + * Set the sku property: The sku properties. + * + * @param sku the sku value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withSku(ClusterSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of recommendations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of recommendations. + * + * @param nextLink the nextLink value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the clusterId property: The ID associated with the cluster. + * + * @return the clusterId value. + */ + public String clusterId() { + return this.clusterId; + } + + /** + * Get the provisioningState property: The provisioning state of the cluster. + * + * @return the provisioningState value. + */ + public ClusterEntityStatus provisioningState() { + return this.provisioningState; + } + + /** + * Get the keyVaultProperties property: The associated key properties. + * + * @return the keyVaultProperties value. + */ + public KeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the keyVaultProperties property: The associated key properties. + * + * @param keyVaultProperties the keyVaultProperties value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (keyVaultProperties() != null) { + keyVaultProperties().validate(); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/DataExportInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/DataExportInner.java new file mode 100644 index 0000000000000..293aa39a13eab --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/DataExportInner.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.Type; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The top level data export resource container. */ +@JsonFlatten +@Fluent +public class DataExportInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataExportInner.class); + + /* + * The data export rule ID. + */ + @JsonProperty(value = "properties.dataExportId") + private String dataExportId; + + /* + * An array of tables to export, for example: [“Heartbeat, SecurityEvent”]. + */ + @JsonProperty(value = "properties.tableNames") + private List tableNames; + + /* + * Active when enabled. + */ + @JsonProperty(value = "properties.enable") + private Boolean enable; + + /* + * The latest data export rule modification time. + */ + @JsonProperty(value = "properties.createdDate") + private String createdDate; + + /* + * Date and time when the export was last modified. + */ + @JsonProperty(value = "properties.lastModifiedDate") + private String lastModifiedDate; + + /* + * The destination resource ID. This can be copied from the Properties + * entry of the destination resource in Azure. + */ + @JsonProperty(value = "properties.destination.resourceId") + private String resourceId; + + /* + * The type of the destination resource + */ + @JsonProperty(value = "properties.destination.type", access = JsonProperty.Access.WRITE_ONLY) + private Type typePropertiesDestinationType; + + /* + * Optional. Allows to define an Event Hub name. Not applicable when + * destination is Storage Account. + */ + @JsonProperty(value = "properties.destination.metaData.eventHubName") + private String eventHubName; + + /** + * Get the dataExportId property: The data export rule ID. + * + * @return the dataExportId value. + */ + public String dataExportId() { + return this.dataExportId; + } + + /** + * Set the dataExportId property: The data export rule ID. + * + * @param dataExportId the dataExportId value to set. + * @return the DataExportInner object itself. + */ + public DataExportInner withDataExportId(String dataExportId) { + this.dataExportId = dataExportId; + return this; + } + + /** + * Get the tableNames property: An array of tables to export, for example: [“Heartbeat, SecurityEvent”]. + * + * @return the tableNames value. + */ + public List tableNames() { + return this.tableNames; + } + + /** + * Set the tableNames property: An array of tables to export, for example: [“Heartbeat, SecurityEvent”]. + * + * @param tableNames the tableNames value to set. + * @return the DataExportInner object itself. + */ + public DataExportInner withTableNames(List tableNames) { + this.tableNames = tableNames; + return this; + } + + /** + * Get the enable property: Active when enabled. + * + * @return the enable value. + */ + public Boolean enable() { + return this.enable; + } + + /** + * Set the enable property: Active when enabled. + * + * @param enable the enable value to set. + * @return the DataExportInner object itself. + */ + public DataExportInner withEnable(Boolean enable) { + this.enable = enable; + return this; + } + + /** + * Get the createdDate property: The latest data export rule modification time. + * + * @return the createdDate value. + */ + public String createdDate() { + return this.createdDate; + } + + /** + * Set the createdDate property: The latest data export rule modification time. + * + * @param createdDate the createdDate value to set. + * @return the DataExportInner object itself. + */ + public DataExportInner withCreatedDate(String createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get the lastModifiedDate property: Date and time when the export was last modified. + * + * @return the lastModifiedDate value. + */ + public String lastModifiedDate() { + return this.lastModifiedDate; + } + + /** + * Set the lastModifiedDate property: Date and time when the export was last modified. + * + * @param lastModifiedDate the lastModifiedDate value to set. + * @return the DataExportInner object itself. + */ + public DataExportInner withLastModifiedDate(String lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + return this; + } + + /** + * Get the resourceId property: The destination resource ID. This can be copied from the Properties entry of the + * destination resource in Azure. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The destination resource ID. This can be copied from the Properties entry of the + * destination resource in Azure. + * + * @param resourceId the resourceId value to set. + * @return the DataExportInner object itself. + */ + public DataExportInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the typePropertiesDestinationType property: The type of the destination resource. + * + * @return the typePropertiesDestinationType value. + */ + public Type typePropertiesDestinationType() { + return this.typePropertiesDestinationType; + } + + /** + * Get the eventHubName property: Optional. Allows to define an Event Hub name. Not applicable when destination is + * Storage Account. + * + * @return the eventHubName value. + */ + public String eventHubName() { + return this.eventHubName; + } + + /** + * Set the eventHubName property: Optional. Allows to define an Event Hub name. Not applicable when destination is + * Storage Account. + * + * @param eventHubName the eventHubName value to set. + * @return the DataExportInner object itself. + */ + public DataExportInner withEventHubName(String eventHubName) { + this.eventHubName = eventHubName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/DataSourceInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/DataSourceInner.java new file mode 100644 index 0000000000000..df0abde01f4cd --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/DataSourceInner.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.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.DataSourceKind; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Datasources under OMS Workspace. */ +@Fluent +public final class DataSourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataSourceInner.class); + + /* + * The data source properties in raw json format, each kind of data source + * have it's own schema. + */ + @JsonProperty(value = "properties", required = true) + private Object properties; + + /* + * The ETag of the data source. + */ + @JsonProperty(value = "etag") + private String etag; + + /* + * The kind of the DataSource. + */ + @JsonProperty(value = "kind", required = true) + private DataSourceKind kind; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the properties property: The data source properties in raw json format, each kind of data source have it's + * own schema. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: The data source properties in raw json format, each kind of data source have it's + * own schema. + * + * @param properties the properties value to set. + * @return the DataSourceInner object itself. + */ + public DataSourceInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the etag property: The ETag of the data source. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The ETag of the data source. + * + * @param etag the etag value to set. + * @return the DataSourceInner object itself. + */ + public DataSourceInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the kind property: The kind of the DataSource. + * + * @return the kind value. + */ + public DataSourceKind kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of the DataSource. + * + * @param kind the kind value to set. + * @return the DataSourceInner object itself. + */ + public DataSourceInner withKind(DataSourceKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the DataSourceInner object itself. + */ + public DataSourceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property properties in model DataSourceInner")); + } + if (kind() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property kind in model DataSourceInner")); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/IntelligencePackInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/IntelligencePackInner.java new file mode 100644 index 0000000000000..21cbb135a612a --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/IntelligencePackInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Intelligence Pack containing a string name and boolean indicating if it's enabled. */ +@Fluent +public final class IntelligencePackInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IntelligencePackInner.class); + + /* + * The name of the intelligence pack. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The enabled boolean for the intelligence pack. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * The display name of the intelligence pack. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the name property: The name of the intelligence pack. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the intelligence pack. + * + * @param name the name value to set. + * @return the IntelligencePackInner object itself. + */ + public IntelligencePackInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the enabled property: The enabled boolean for the intelligence pack. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: The enabled boolean for the intelligence pack. + * + * @param enabled the enabled value to set. + * @return the IntelligencePackInner object itself. + */ + public IntelligencePackInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the displayName property: The display name of the intelligence pack. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the intelligence pack. + * + * @param displayName the displayName value to set. + * @return the IntelligencePackInner object itself. + */ + public IntelligencePackInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/LinkedServiceInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/LinkedServiceInner.java new file mode 100644 index 0000000000000..91c7206aaeba5 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/LinkedServiceInner.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.LinkedServiceEntityStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The top level Linked service resource container. */ +@JsonFlatten +@Fluent +public class LinkedServiceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkedServiceInner.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The resource id of the resource that will be linked to the workspace. + * This should be used for linking resources which require read access + */ + @JsonProperty(value = "properties.resourceId") + private String resourceId; + + /* + * The resource id of the resource that will be linked to the workspace. + * This should be used for linking resources which require write access + */ + @JsonProperty(value = "properties.writeAccessResourceId") + private String writeAccessResourceId; + + /* + * The provisioning state of the linked service. + */ + @JsonProperty(value = "properties.provisioningState") + private LinkedServiceEntityStatus provisioningState; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the resourceId property: The resource id of the resource that will be linked to the workspace. This should be + * used for linking resources which require read access. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource id of the resource that will be linked to the workspace. This should be + * used for linking resources which require read access. + * + * @param resourceId the resourceId value to set. + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the writeAccessResourceId property: The resource id of the resource that will be linked to the workspace. + * This should be used for linking resources which require write access. + * + * @return the writeAccessResourceId value. + */ + public String writeAccessResourceId() { + return this.writeAccessResourceId; + } + + /** + * Set the writeAccessResourceId property: The resource id of the resource that will be linked to the workspace. + * This should be used for linking resources which require write access. + * + * @param writeAccessResourceId the writeAccessResourceId value to set. + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withWriteAccessResourceId(String writeAccessResourceId) { + this.writeAccessResourceId = writeAccessResourceId; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the linked service. + * + * @return the provisioningState value. + */ + public LinkedServiceEntityStatus provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The provisioning state of the linked service. + * + * @param provisioningState the provisioningState value to set. + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withProvisioningState(LinkedServiceEntityStatus provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/LinkedStorageAccountsResourceInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/LinkedStorageAccountsResourceInner.java new file mode 100644 index 0000000000000..01639e3857bc5 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/LinkedStorageAccountsResourceInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.DataSourceType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Linked storage accounts top level resource container. */ +@JsonFlatten +@Fluent +public class LinkedStorageAccountsResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkedStorageAccountsResourceInner.class); + + /* + * Linked storage accounts type. + */ + @JsonProperty(value = "properties.dataSourceType", access = JsonProperty.Access.WRITE_ONLY) + private DataSourceType dataSourceType; + + /* + * Linked storage accounts resources ids. + */ + @JsonProperty(value = "properties.storageAccountIds") + private List storageAccountIds; + + /** + * Get the dataSourceType property: Linked storage accounts type. + * + * @return the dataSourceType value. + */ + public DataSourceType dataSourceType() { + return this.dataSourceType; + } + + /** + * Get the storageAccountIds property: Linked storage accounts resources ids. + * + * @return the storageAccountIds value. + */ + public List storageAccountIds() { + return this.storageAccountIds; + } + + /** + * Set the storageAccountIds property: Linked storage accounts resources ids. + * + * @param storageAccountIds the storageAccountIds value to set. + * @return the LinkedStorageAccountsResourceInner object itself. + */ + public LinkedStorageAccountsResourceInner withStorageAccountIds(List storageAccountIds) { + this.storageAccountIds = storageAccountIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/ManagementGroupInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/ManagementGroupInner.java new file mode 100644 index 0000000000000..210342b8a60f4 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/ManagementGroupInner.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A management group that is connected to a workspace. */ +@JsonFlatten +@Fluent +public class ManagementGroupInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupInner.class); + + /* + * The number of servers connected to the management group. + */ + @JsonProperty(value = "properties.serverCount") + private Integer serverCount; + + /* + * Gets or sets a value indicating whether the management group is a + * gateway. + */ + @JsonProperty(value = "properties.isGateway") + private Boolean isGateway; + + /* + * The name of the management group. + */ + @JsonProperty(value = "properties.name") + private String name; + + /* + * The unique ID of the management group. + */ + @JsonProperty(value = "properties.id") + private String id; + + /* + * The datetime that the management group was created. + */ + @JsonProperty(value = "properties.created") + private OffsetDateTime created; + + /* + * The last datetime that the management group received data. + */ + @JsonProperty(value = "properties.dataReceived") + private OffsetDateTime dataReceived; + + /* + * The version of System Center that is managing the management group. + */ + @JsonProperty(value = "properties.version") + private String version; + + /* + * The SKU of System Center that is managing the management group. + */ + @JsonProperty(value = "properties.sku") + private String sku; + + /** + * Get the serverCount property: The number of servers connected to the management group. + * + * @return the serverCount value. + */ + public Integer serverCount() { + return this.serverCount; + } + + /** + * Set the serverCount property: The number of servers connected to the management group. + * + * @param serverCount the serverCount value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withServerCount(Integer serverCount) { + this.serverCount = serverCount; + return this; + } + + /** + * Get the isGateway property: Gets or sets a value indicating whether the management group is a gateway. + * + * @return the isGateway value. + */ + public Boolean isGateway() { + return this.isGateway; + } + + /** + * Set the isGateway property: Gets or sets a value indicating whether the management group is a gateway. + * + * @param isGateway the isGateway value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withIsGateway(Boolean isGateway) { + this.isGateway = isGateway; + return this; + } + + /** + * Get the name property: The name of the management group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the management group. + * + * @param name the name value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the id property: The unique ID of the management group. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The unique ID of the management group. + * + * @param id the id value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the created property: The datetime that the management group was created. + * + * @return the created value. + */ + public OffsetDateTime created() { + return this.created; + } + + /** + * Set the created property: The datetime that the management group was created. + * + * @param created the created value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withCreated(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * Get the dataReceived property: The last datetime that the management group received data. + * + * @return the dataReceived value. + */ + public OffsetDateTime dataReceived() { + return this.dataReceived; + } + + /** + * Set the dataReceived property: The last datetime that the management group received data. + * + * @param dataReceived the dataReceived value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withDataReceived(OffsetDateTime dataReceived) { + this.dataReceived = dataReceived; + return this; + } + + /** + * Get the version property: The version of System Center that is managing the management group. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of System Center that is managing the management group. + * + * @param version the version value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the sku property: The SKU of System Center that is managing the management group. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of System Center that is managing the management group. + * + * @param sku the sku value to set. + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/OperationInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..d0cd3f670f0c4 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/OperationInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Supported operation of OperationalInsights resource provider. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display metadata associated with the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/OperationStatusInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/OperationStatusInner.java new file mode 100644 index 0000000000000..39d0e82438aef --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/OperationStatusInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The status of operation. */ +@Fluent +public final class OperationStatusInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationStatusInner.class); + + /* + * The operation Id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The operation name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The start time of the operation. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /* + * The end time of the operation. + */ + @JsonProperty(value = "endTime") + private String endTime; + + /* + * The status of the operation. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The error detail of the operation if any. + */ + @JsonProperty(value = "error") + private ManagementError error; + + /** + * Get the id property: The operation Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The operation Id. + * + * @param id the id value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The operation name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The operation name. + * + * @param name the name value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time of the operation. + * + * @param startTime the startTime value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + public String endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end time of the operation. + * + * @param endTime the endTime value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the status property: The status of the operation. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the operation. + * + * @param status the status value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error property: The error detail of the operation if any. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: The error detail of the operation if any. + * + * @param error the error value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SavedSearchInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SavedSearchInner.java new file mode 100644 index 0000000000000..69d58886efe69 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SavedSearchInner.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.Tag; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Value object for saved search results. */ +@JsonFlatten +@Fluent +public class SavedSearchInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SavedSearchInner.class); + + /* + * The ETag of the saved search. + */ + @JsonProperty(value = "etag") + private String etag; + + /* + * The category of the saved search. This helps the user to find a saved + * search faster. + */ + @JsonProperty(value = "properties.category", required = true) + private String category; + + /* + * Saved search display name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /* + * The query expression for the saved search. + */ + @JsonProperty(value = "properties.query", required = true) + private String query; + + /* + * The function alias if query serves as a function. + */ + @JsonProperty(value = "properties.functionAlias") + private String functionAlias; + + /* + * The optional function parameters if query serves as a function. Value + * should be in the following format: 'param-name1:type1 = default_value1, + * param-name2:type2 = default_value2'. For more examples and proper syntax + * please refer to + * https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + */ + @JsonProperty(value = "properties.functionParameters") + private String functionParameters; + + /* + * The version number of the query language. The current version is 2 and + * is the default. + */ + @JsonProperty(value = "properties.version") + private Long version; + + /* + * The tags attached to the saved search. + */ + @JsonProperty(value = "properties.tags") + private List tags; + + /** + * Get the etag property: The ETag of the saved search. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The ETag of the saved search. + * + * @param etag the etag value to set. + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the category property: The category of the saved search. This helps the user to find a saved search faster. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Set the category property: The category of the saved search. This helps the user to find a saved search faster. + * + * @param category the category value to set. + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get the displayName property: Saved search display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Saved search display name. + * + * @param displayName the displayName value to set. + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the query property: The query expression for the saved search. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The query expression for the saved search. + * + * @param query the query value to set. + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the functionAlias property: The function alias if query serves as a function. + * + * @return the functionAlias value. + */ + public String functionAlias() { + return this.functionAlias; + } + + /** + * Set the functionAlias property: The function alias if query serves as a function. + * + * @param functionAlias the functionAlias value to set. + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withFunctionAlias(String functionAlias) { + this.functionAlias = functionAlias; + return this; + } + + /** + * Get the functionParameters property: The optional function parameters if query serves as a function. Value should + * be in the following format: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. For more + * examples and proper syntax please refer to + * https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + * + * @return the functionParameters value. + */ + public String functionParameters() { + return this.functionParameters; + } + + /** + * Set the functionParameters property: The optional function parameters if query serves as a function. Value should + * be in the following format: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. For more + * examples and proper syntax please refer to + * https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + * + * @param functionParameters the functionParameters value to set. + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withFunctionParameters(String functionParameters) { + this.functionParameters = functionParameters; + return this; + } + + /** + * Get the version property: The version number of the query language. The current version is 2 and is the default. + * + * @return the version value. + */ + public Long version() { + return this.version; + } + + /** + * Set the version property: The version number of the query language. The current version is 2 and is the default. + * + * @param version the version value to set. + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withVersion(Long version) { + this.version = version; + return this; + } + + /** + * Get the tags property: The tags attached to the saved search. + * + * @return the tags value. + */ + public List tags() { + return this.tags; + } + + /** + * Set the tags property: The tags attached to the saved search. + * + * @param tags the tags value to set. + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withTags(List tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (category() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property category in model SavedSearchInner")); + } + if (displayName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property displayName in model SavedSearchInner")); + } + if (query() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property query in model SavedSearchInner")); + } + if (tags() != null) { + tags().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SavedSearchesListResultInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SavedSearchesListResultInner.java new file mode 100644 index 0000000000000..eab26be41e29e --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SavedSearchesListResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The saved search list operation response. */ +@Fluent +public final class SavedSearchesListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SavedSearchesListResultInner.class); + + /* + * The array of result values. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The array of result values. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of result values. + * + * @param value the value value to set. + * @return the SavedSearchesListResultInner object itself. + */ + public SavedSearchesListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SearchGetSchemaResponseInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SearchGetSchemaResponseInner.java new file mode 100644 index 0000000000000..1f860762e99f2 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SearchGetSchemaResponseInner.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.SearchMetadata; +import com.azure.resourcemanager.loganalytics.models.SearchSchemaValue; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The get schema operation response. */ +@Fluent +public final class SearchGetSchemaResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SearchGetSchemaResponseInner.class); + + /* + * The metadata from search results. + */ + @JsonProperty(value = "metadata") + private SearchMetadata metadata; + + /* + * The array of result values. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the metadata property: The metadata from search results. + * + * @return the metadata value. + */ + public SearchMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The metadata from search results. + * + * @param metadata the metadata value to set. + * @return the SearchGetSchemaResponseInner object itself. + */ + public SearchGetSchemaResponseInner withMetadata(SearchMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the value property: The array of result values. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of result values. + * + * @param value the value value to set. + * @return the SearchGetSchemaResponseInner object itself. + */ + public SearchGetSchemaResponseInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metadata() != null) { + metadata().validate(); + } + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SharedKeysInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SharedKeysInner.java new file mode 100644 index 0000000000000..f691605aad1bf --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/SharedKeysInner.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The shared keys for a workspace. */ +@Fluent +public final class SharedKeysInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedKeysInner.class); + + /* + * The primary shared key of a workspace. + */ + @JsonProperty(value = "primarySharedKey") + private String primarySharedKey; + + /* + * The secondary shared key of a workspace. + */ + @JsonProperty(value = "secondarySharedKey") + private String secondarySharedKey; + + /** + * Get the primarySharedKey property: The primary shared key of a workspace. + * + * @return the primarySharedKey value. + */ + public String primarySharedKey() { + return this.primarySharedKey; + } + + /** + * Set the primarySharedKey property: The primary shared key of a workspace. + * + * @param primarySharedKey the primarySharedKey value to set. + * @return the SharedKeysInner object itself. + */ + public SharedKeysInner withPrimarySharedKey(String primarySharedKey) { + this.primarySharedKey = primarySharedKey; + return this; + } + + /** + * Get the secondarySharedKey property: The secondary shared key of a workspace. + * + * @return the secondarySharedKey value. + */ + public String secondarySharedKey() { + return this.secondarySharedKey; + } + + /** + * Set the secondarySharedKey property: The secondary shared key of a workspace. + * + * @param secondarySharedKey the secondarySharedKey value to set. + * @return the SharedKeysInner object itself. + */ + public SharedKeysInner withSecondarySharedKey(String secondarySharedKey) { + this.secondarySharedKey = secondarySharedKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/StorageInsightInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/StorageInsightInner.java new file mode 100644 index 0000000000000..035a1a22ef073 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/StorageInsightInner.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.StorageAccount; +import com.azure.resourcemanager.loganalytics.models.StorageInsightStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The top level storage insight resource container. */ +@JsonFlatten +@Fluent +public class StorageInsightInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageInsightInner.class); + + /* + * The ETag of the storage insight. + */ + @JsonProperty(value = "eTag") + private String etag; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The names of the blob containers that the workspace should read + */ + @JsonProperty(value = "properties.containers") + private List containers; + + /* + * The names of the Azure tables that the workspace should read + */ + @JsonProperty(value = "properties.tables") + private List tables; + + /* + * The storage account connection details + */ + @JsonProperty(value = "properties.storageAccount") + private StorageAccount storageAccount; + + /* + * The status of the storage insight + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private StorageInsightStatus status; + + /** + * Get the etag property: The ETag of the storage insight. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The ETag of the storage insight. + * + * @param etag the etag value to set. + * @return the StorageInsightInner object itself. + */ + public StorageInsightInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the StorageInsightInner object itself. + */ + public StorageInsightInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the containers property: The names of the blob containers that the workspace should read. + * + * @return the containers value. + */ + public List containers() { + return this.containers; + } + + /** + * Set the containers property: The names of the blob containers that the workspace should read. + * + * @param containers the containers value to set. + * @return the StorageInsightInner object itself. + */ + public StorageInsightInner withContainers(List containers) { + this.containers = containers; + return this; + } + + /** + * Get the tables property: The names of the Azure tables that the workspace should read. + * + * @return the tables value. + */ + public List tables() { + return this.tables; + } + + /** + * Set the tables property: The names of the Azure tables that the workspace should read. + * + * @param tables the tables value to set. + * @return the StorageInsightInner object itself. + */ + public StorageInsightInner withTables(List tables) { + this.tables = tables; + return this; + } + + /** + * Get the storageAccount property: The storage account connection details. + * + * @return the storageAccount value. + */ + public StorageAccount storageAccount() { + return this.storageAccount; + } + + /** + * Set the storageAccount property: The storage account connection details. + * + * @param storageAccount the storageAccount value to set. + * @return the StorageInsightInner object itself. + */ + public StorageInsightInner withStorageAccount(StorageAccount storageAccount) { + this.storageAccount = storageAccount; + return this; + } + + /** + * Get the status property: The status of the storage insight. + * + * @return the status value. + */ + public StorageInsightStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageAccount() != null) { + storageAccount().validate(); + } + if (status() != null) { + status().validate(); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/TableInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/TableInner.java new file mode 100644 index 0000000000000..97f0a3960707e --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/TableInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Workspace data table definition. */ +@JsonFlatten +@Fluent +public class TableInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TableInner.class); + + /* + * The data table data retention in days, between 30 and 730. Setting this + * property to null will default to the workspace retention. + */ + @JsonProperty(value = "properties.retentionInDays") + private Integer retentionInDays; + + /** + * Get the retentionInDays property: The data table data retention in days, between 30 and 730. Setting this + * property to null will default to the workspace retention. + * + * @return the retentionInDays value. + */ + public Integer retentionInDays() { + return this.retentionInDays; + } + + /** + * Set the retentionInDays property: The data table data retention in days, between 30 and 730. Setting this + * property to null will default to the workspace retention. + * + * @param retentionInDays the retentionInDays value to set. + * @return the TableInner object itself. + */ + public TableInner withRetentionInDays(Integer retentionInDays) { + this.retentionInDays = retentionInDays; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/UsageMetricInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/UsageMetricInner.java new file mode 100644 index 0000000000000..cfed6590e933b --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/UsageMetricInner.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.MetricName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A metric describing the usage of a resource. */ +@Fluent +public final class UsageMetricInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageMetricInner.class); + + /* + * The name of the metric. + */ + @JsonProperty(value = "name") + private MetricName name; + + /* + * The units used for the metric. + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * The current value of the metric. + */ + @JsonProperty(value = "currentValue") + private Double currentValue; + + /* + * The quota limit for the metric. + */ + @JsonProperty(value = "limit") + private Double limit; + + /* + * The time that the metric's value will reset. + */ + @JsonProperty(value = "nextResetTime") + private OffsetDateTime nextResetTime; + + /* + * The quota period that determines the length of time between value + * resets. + */ + @JsonProperty(value = "quotaPeriod") + private String quotaPeriod; + + /** + * Get the name property: The name of the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Set the name property: The name of the metric. + * + * @param name the name value to set. + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withName(MetricName name) { + this.name = name; + return this; + } + + /** + * Get the unit property: The units used for the metric. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: The units used for the metric. + * + * @param unit the unit value to set. + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the currentValue property: The current value of the metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Set the currentValue property: The current value of the metric. + * + * @param currentValue the currentValue value to set. + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withCurrentValue(Double currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the limit property: The quota limit for the metric. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Set the limit property: The quota limit for the metric. + * + * @param limit the limit value to set. + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withLimit(Double limit) { + this.limit = limit; + return this; + } + + /** + * Get the nextResetTime property: The time that the metric's value will reset. + * + * @return the nextResetTime value. + */ + public OffsetDateTime nextResetTime() { + return this.nextResetTime; + } + + /** + * Set the nextResetTime property: The time that the metric's value will reset. + * + * @param nextResetTime the nextResetTime value to set. + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withNextResetTime(OffsetDateTime nextResetTime) { + this.nextResetTime = nextResetTime; + return this; + } + + /** + * Get the quotaPeriod property: The quota period that determines the length of time between value resets. + * + * @return the quotaPeriod value. + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Set the quotaPeriod property: The quota period that determines the length of time between value resets. + * + * @param quotaPeriod the quotaPeriod value to set. + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withQuotaPeriod(String quotaPeriod) { + this.quotaPeriod = quotaPeriod; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspaceInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspaceInner.java new file mode 100644 index 0000000000000..42a2262853f1e --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspaceInner.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.PrivateLinkScopedResource; +import com.azure.resourcemanager.loganalytics.models.PublicNetworkAccessType; +import com.azure.resourcemanager.loganalytics.models.WorkspaceCapping; +import com.azure.resourcemanager.loganalytics.models.WorkspaceEntityStatus; +import com.azure.resourcemanager.loganalytics.models.WorkspaceSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The top level Workspace resource container. */ +@JsonFlatten +@Fluent +public class WorkspaceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceInner.class); + + /* + * The ETag of the workspace. + */ + @JsonProperty(value = "eTag") + private String etag; + + /* + * The provisioning state of the workspace. + */ + @JsonProperty(value = "properties.provisioningState") + private WorkspaceEntityStatus provisioningState; + + /* + * This is a read-only property. Represents the ID associated with the + * workspace. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /* + * The SKU of the workspace. + */ + @JsonProperty(value = "properties.sku") + private WorkspaceSku sku; + + /* + * The workspace data retention in days, between 30 and 730. + */ + @JsonProperty(value = "properties.retentionInDays") + private Integer retentionInDays; + + /* + * The daily volume cap for ingestion. + */ + @JsonProperty(value = "properties.workspaceCapping") + private WorkspaceCapping workspaceCapping; + + /* + * The network access type for accessing Log Analytics ingestion. + */ + @JsonProperty(value = "properties.publicNetworkAccessForIngestion") + private PublicNetworkAccessType publicNetworkAccessForIngestion; + + /* + * The network access type for accessing Log Analytics query. + */ + @JsonProperty(value = "properties.publicNetworkAccessForQuery") + private PublicNetworkAccessType publicNetworkAccessForQuery; + + /* + * List of linked private link scope resources. + */ + @JsonProperty(value = "properties.privateLinkScopedResources", access = JsonProperty.Access.WRITE_ONLY) + private List privateLinkScopedResources; + + /** + * Get the etag property: The ETag of the workspace. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The ETag of the workspace. + * + * @param etag the etag value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the workspace. + * + * @return the provisioningState value. + */ + public WorkspaceEntityStatus provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The provisioning state of the workspace. + * + * @param provisioningState the provisioningState value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withProvisioningState(WorkspaceEntityStatus provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the customerId property: This is a read-only property. Represents the ID associated with the workspace. + * + * @return the customerId value. + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the sku property: The SKU of the workspace. + * + * @return the sku value. + */ + public WorkspaceSku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of the workspace. + * + * @param sku the sku value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withSku(WorkspaceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the retentionInDays property: The workspace data retention in days, between 30 and 730. + * + * @return the retentionInDays value. + */ + public Integer retentionInDays() { + return this.retentionInDays; + } + + /** + * Set the retentionInDays property: The workspace data retention in days, between 30 and 730. + * + * @param retentionInDays the retentionInDays value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withRetentionInDays(Integer retentionInDays) { + this.retentionInDays = retentionInDays; + return this; + } + + /** + * Get the workspaceCapping property: The daily volume cap for ingestion. + * + * @return the workspaceCapping value. + */ + public WorkspaceCapping workspaceCapping() { + return this.workspaceCapping; + } + + /** + * Set the workspaceCapping property: The daily volume cap for ingestion. + * + * @param workspaceCapping the workspaceCapping value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withWorkspaceCapping(WorkspaceCapping workspaceCapping) { + this.workspaceCapping = workspaceCapping; + return this; + } + + /** + * Get the publicNetworkAccessForIngestion property: The network access type for accessing Log Analytics ingestion. + * + * @return the publicNetworkAccessForIngestion value. + */ + public PublicNetworkAccessType publicNetworkAccessForIngestion() { + return this.publicNetworkAccessForIngestion; + } + + /** + * Set the publicNetworkAccessForIngestion property: The network access type for accessing Log Analytics ingestion. + * + * @param publicNetworkAccessForIngestion the publicNetworkAccessForIngestion value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withPublicNetworkAccessForIngestion(PublicNetworkAccessType publicNetworkAccessForIngestion) { + this.publicNetworkAccessForIngestion = publicNetworkAccessForIngestion; + return this; + } + + /** + * Get the publicNetworkAccessForQuery property: The network access type for accessing Log Analytics query. + * + * @return the publicNetworkAccessForQuery value. + */ + public PublicNetworkAccessType publicNetworkAccessForQuery() { + return this.publicNetworkAccessForQuery; + } + + /** + * Set the publicNetworkAccessForQuery property: The network access type for accessing Log Analytics query. + * + * @param publicNetworkAccessForQuery the publicNetworkAccessForQuery value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withPublicNetworkAccessForQuery(PublicNetworkAccessType publicNetworkAccessForQuery) { + this.publicNetworkAccessForQuery = publicNetworkAccessForQuery; + return this; + } + + /** + * Get the privateLinkScopedResources property: List of linked private link scope resources. + * + * @return the privateLinkScopedResources value. + */ + public List privateLinkScopedResources() { + return this.privateLinkScopedResources; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (workspaceCapping() != null) { + workspaceCapping().validate(); + } + if (privateLinkScopedResources() != null) { + privateLinkScopedResources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspacePurgeResponseInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspacePurgeResponseInner.java new file mode 100644 index 0000000000000..4e2c6552bc25b --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspacePurgeResponseInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response containing operationId for a specific purge action. */ +@Fluent +public final class WorkspacePurgeResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacePurgeResponseInner.class); + + /* + * Id to use when querying for status for a particular purge operation. + */ + @JsonProperty(value = "operationId", required = true) + private String operationId; + + /** + * Get the operationId property: Id to use when querying for status for a particular purge operation. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Set the operationId property: Id to use when querying for status for a particular purge operation. + * + * @param operationId the operationId value to set. + * @return the WorkspacePurgeResponseInner object itself. + */ + public WorkspacePurgeResponseInner withOperationId(String operationId) { + this.operationId = operationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operationId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property operationId in model WorkspacePurgeResponseInner")); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspacePurgeStatusResponseInner.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspacePurgeStatusResponseInner.java new file mode 100644 index 0000000000000..f7890495f6e51 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/WorkspacePurgeStatusResponseInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.models.PurgeState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response containing status for a specific purge operation. */ +@Fluent +public final class WorkspacePurgeStatusResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacePurgeStatusResponseInner.class); + + /* + * Status of the operation represented by the requested Id. + */ + @JsonProperty(value = "status", required = true) + private PurgeState status; + + /** + * Get the status property: Status of the operation represented by the requested Id. + * + * @return the status value. + */ + public PurgeState status() { + return this.status; + } + + /** + * Set the status property: Status of the operation represented by the requested Id. + * + * @param status the status value to set. + * @return the WorkspacePurgeStatusResponseInner object itself. + */ + public WorkspacePurgeStatusResponseInner withStatus(PurgeState status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model WorkspacePurgeStatusResponseInner")); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/package-info.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/package-info.java new file mode 100644 index 0000000000000..2b0aff4ecedf1 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for OperationalInsightsManagementClient. Operational Insights Client. */ +package com.azure.resourcemanager.loganalytics.fluent.models; diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/package-info.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/package-info.java new file mode 100644 index 0000000000000..47a29a11cfb36 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for OperationalInsightsManagementClient. Operational Insights Client. */ +package com.azure.resourcemanager.loganalytics.fluent; diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTierImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTierImpl.java new file mode 100644 index 0000000000000..fb9b53ea9077f --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTierImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.AvailableServiceTierInner; +import com.azure.resourcemanager.loganalytics.models.AvailableServiceTier; +import com.azure.resourcemanager.loganalytics.models.SkuNameEnum; + +public final class AvailableServiceTierImpl implements AvailableServiceTier { + private AvailableServiceTierInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public AvailableServiceTierImpl(AvailableServiceTierInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SkuNameEnum serviceTier() { + return this.innerModel().serviceTier(); + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public Long minimumRetention() { + return this.innerModel().minimumRetention(); + } + + public Long maximumRetention() { + return this.innerModel().maximumRetention(); + } + + public Long defaultRetention() { + return this.innerModel().defaultRetention(); + } + + public Long capacityReservationLevel() { + return this.innerModel().capacityReservationLevel(); + } + + public String lastSkuUpdate() { + return this.innerModel().lastSkuUpdate(); + } + + public AvailableServiceTierInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTiersClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTiersClientImpl.java new file mode 100644 index 0000000000000..6351619ef4202 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTiersClientImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.PathParam; +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.Response; +import com.azure.core.http.rest.RestProxy; +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.loganalytics.fluent.AvailableServiceTiersClient; +import com.azure.resourcemanager.loganalytics.fluent.models.AvailableServiceTierInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AvailableServiceTiersClient. */ +public final class AvailableServiceTiersClientImpl implements AvailableServiceTiersClient { + private final ClientLogger logger = new ClientLogger(AvailableServiceTiersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AvailableServiceTiersService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of AvailableServiceTiersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AvailableServiceTiersClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy + .create(AvailableServiceTiersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientAvailableServiceTiers to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface AvailableServiceTiersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/availableServiceTiers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> listByWorkspace( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 available service tiers for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByWorkspaceWithResponseAsync( + String resourceGroupName, String workspaceName) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByWorkspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 available service tiers for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByWorkspaceWithResponseAsync( + String resourceGroupName, String workspaceName, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByWorkspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 available service tiers for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithResponseAsync(resourceGroupName, workspaceName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 available service tiers for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listByWorkspace(String resourceGroupName, String workspaceName) { + return listByWorkspaceAsync(resourceGroupName, workspaceName).block(); + } + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 available service tiers for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, Context context) { + return listByWorkspaceWithResponseAsync(resourceGroupName, workspaceName, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTiersImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTiersImpl.java new file mode 100644 index 0000000000000..d0285aa052079 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/AvailableServiceTiersImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.AvailableServiceTiersClient; +import com.azure.resourcemanager.loganalytics.fluent.models.AvailableServiceTierInner; +import com.azure.resourcemanager.loganalytics.models.AvailableServiceTier; +import com.azure.resourcemanager.loganalytics.models.AvailableServiceTiers; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class AvailableServiceTiersImpl implements AvailableServiceTiers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailableServiceTiersImpl.class); + + private final AvailableServiceTiersClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public AvailableServiceTiersImpl(AvailableServiceTiersClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public List listByWorkspace(String resourceGroupName, String workspaceName) { + List inner = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new AvailableServiceTierImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, Context context) { + Response> inner = + this.serviceClient().listByWorkspaceWithResponse(resourceGroupName, workspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new AvailableServiceTierImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + private AvailableServiceTiersClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClusterImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClusterImpl.java new file mode 100644 index 0000000000000..f7553c8bf9d01 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClusterImpl.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.ClusterInner; +import com.azure.resourcemanager.loganalytics.models.Cluster; +import com.azure.resourcemanager.loganalytics.models.ClusterEntityStatus; +import com.azure.resourcemanager.loganalytics.models.ClusterPatch; +import com.azure.resourcemanager.loganalytics.models.ClusterSku; +import com.azure.resourcemanager.loganalytics.models.Identity; +import com.azure.resourcemanager.loganalytics.models.KeyVaultProperties; +import java.util.Collections; +import java.util.Map; + +public final class ClusterImpl implements Cluster, Cluster.Definition, Cluster.Update { + private ClusterInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public ClusterSku sku() { + return this.innerModel().sku(); + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public String clusterId() { + return this.innerModel().clusterId(); + } + + public ClusterEntityStatus provisioningState() { + return this.innerModel().provisioningState(); + } + + public KeyVaultProperties keyVaultProperties() { + return this.innerModel().keyVaultProperties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ClusterInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String clusterName; + + private ClusterPatch updateParameters; + + public ClusterImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Cluster create() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .createOrUpdate(resourceGroupName, clusterName, this.innerModel(), Context.NONE); + return this; + } + + public Cluster create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .createOrUpdate(resourceGroupName, clusterName, this.innerModel(), context); + return this; + } + + public ClusterImpl(String name, LogAnalyticsManager serviceManager) { + this.innerObject = new ClusterInner(); + this.serviceManager = serviceManager; + this.clusterName = name; + } + + public ClusterImpl update() { + this.updateParameters = new ClusterPatch(); + return this; + } + + public Cluster apply() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .updateWithResponse(resourceGroupName, clusterName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public Cluster apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .updateWithResponse(resourceGroupName, clusterName, updateParameters, context) + .getValue(); + return this; + } + + public ClusterImpl(ClusterInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.clusterName = Utils.getValueFromIdByName(innerObject.id(), "clusters"); + } + + public Cluster refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE) + .getValue(); + return this; + } + + public Cluster refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, context) + .getValue(); + return this; + } + + public ClusterImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ClusterImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ClusterImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ClusterImpl withIdentity(Identity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public ClusterImpl withSku(ClusterSku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public ClusterImpl withNextLink(String nextLink) { + this.innerModel().withNextLink(nextLink); + return this; + } + + public ClusterImpl withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + if (isInCreateMode()) { + this.innerModel().withKeyVaultProperties(keyVaultProperties); + return this; + } else { + this.updateParameters.withKeyVaultProperties(keyVaultProperties); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClustersClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClustersClientImpl.java new file mode 100644 index 0000000000000..616019c14fb91 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClustersClientImpl.java @@ -0,0 +1,1427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.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.loganalytics.fluent.ClustersClient; +import com.azure.resourcemanager.loganalytics.fluent.models.ClusterInner; +import com.azure.resourcemanager.loganalytics.models.ClusterListResult; +import com.azure.resourcemanager.loganalytics.models.ClusterPatch; +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 ClustersClient. */ +public final class ClustersClientImpl implements ClustersClient { + private final ClientLogger logger = new ClientLogger(ClustersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ClustersService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of ClustersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ClustersClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = RestProxy.create(ClustersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientClusters to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface ClustersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/clusters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @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.OperationalInsights/clusters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/clusters/{clusterName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("clusterName") String clusterName, + @BodyParam("application/json") ClusterInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/clusters/{clusterName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @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.OperationalInsights" + + "/clusters/{clusterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("clusterName") String clusterName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/clusters/{clusterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ClusterPatch parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + 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) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 log Analytics clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets Log Analytics clusters in a 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 log Analytics clusters in a resource group. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + 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)); + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 log Analytics clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets Log Analytics clusters in a 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 log Analytics clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 log Analytics clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets Log Analytics clusters in a 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 log Analytics clusters in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @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 Log Analytics clusters in a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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"; + return FluxUtil + .withContext( + context -> + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the Log Analytics clusters in a 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 the Log Analytics clusters in a subscription. + */ + @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)); + } + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @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 Log Analytics clusters in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the Log Analytics clusters in a 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 the Log Analytics clusters in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @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 Log Analytics clusters in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the Log Analytics clusters in a 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 the Log Analytics clusters in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String clusterName, ClusterInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + clusterName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String clusterName, ClusterInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + clusterName, + parameters, + accept, + context); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ClusterInner> beginCreateOrUpdateAsync( + String resourceGroupName, String clusterName, ClusterInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, clusterName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterInner.class, ClusterInner.class, Context.NONE); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ClusterInner> beginCreateOrUpdateAsync( + String resourceGroupName, String clusterName, ClusterInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, clusterName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterInner.class, ClusterInner.class, context); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ClusterInner> beginCreateOrUpdate( + String resourceGroupName, String clusterName, ClusterInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, parameters).getSyncPoller(); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ClusterInner> beginCreateOrUpdate( + String resourceGroupName, String clusterName, ClusterInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, parameters, context).getSyncPoller(); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String clusterName, ClusterInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String clusterName, ClusterInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, clusterName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner createOrUpdate(String resourceGroupName, String clusterName, ClusterInner parameters) { + return createOrUpdateAsync(resourceGroupName, clusterName, parameters).block(); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner createOrUpdate( + String resourceGroupName, String clusterName, ClusterInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, clusterName, parameters, context).block(); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String clusterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String clusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String clusterName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String clusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String clusterName) { + return beginDeleteAsync(resourceGroupName, clusterName).getSyncPoller(); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String clusterName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, context).getSyncPoller(); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName) { + return beginDeleteAsync(resourceGroupName, clusterName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterName, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 clusterName) { + deleteAsync(resourceGroupName, clusterName).block(); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 clusterName, Context context) { + deleteAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 Log Analytics cluster instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + clusterName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 Log Analytics cluster instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + clusterName, + accept, + context); + } + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 Log Analytics cluster instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String clusterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, clusterName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 Log Analytics cluster instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner getByResourceGroup(String resourceGroupName, String clusterName) { + return getByResourceGroupAsync(resourceGroupName, clusterName).block(); + } + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 Log Analytics cluster instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String clusterName, ClusterPatch parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String clusterName, ClusterPatch parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String clusterName, ClusterPatch parameters) { + return updateWithResponseAsync(resourceGroupName, clusterName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner update(String resourceGroupName, String clusterName, ClusterPatch parameters) { + return updateAsync(resourceGroupName, clusterName, parameters).block(); + } + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The top level Log Analytics cluster resource container. + * @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 top level Log Analytics cluster resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String clusterName, ClusterPatch parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, clusterName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list clusters operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list clusters operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + 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"; + 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)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list clusters operation response. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list clusters operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + 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"; + 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)); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClustersImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClustersImpl.java new file mode 100644 index 0000000000000..d7547fb440d28 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClustersImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.ClustersClient; +import com.azure.resourcemanager.loganalytics.fluent.models.ClusterInner; +import com.azure.resourcemanager.loganalytics.models.Cluster; +import com.azure.resourcemanager.loganalytics.models.Clusters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ClustersImpl implements Clusters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClustersImpl.class); + + private final ClustersClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public ClustersImpl(ClustersClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new ClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new ClusterImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new ClusterImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new ClusterImpl(inner1, this.manager())); + } + + public void delete(String resourceGroupName, String clusterName) { + this.serviceClient().delete(resourceGroupName, clusterName); + } + + public void delete(String resourceGroupName, String clusterName, Context context) { + this.serviceClient().delete(resourceGroupName, clusterName, context); + } + + public Cluster getByResourceGroup(String resourceGroupName, String clusterName) { + ClusterInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, clusterName); + if (inner != null) { + return new ClusterImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, clusterName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ClusterImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Cluster getById(String id) { + String resourceGroupName = Utils.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 clusterName = Utils.getValueFromIdByName(id, "clusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 clusterName = Utils.getValueFromIdByName(id, "clusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, clusterName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 clusterName = Utils.getValueFromIdByName(id, "clusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id))); + } + this.delete(resourceGroupName, clusterName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 clusterName = Utils.getValueFromIdByName(id, "clusters"); + if (clusterName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id))); + } + this.delete(resourceGroupName, clusterName, context); + } + + private ClustersClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + public ClusterImpl define(String name) { + return new ClusterImpl(name, this.manager()); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportImpl.java new file mode 100644 index 0000000000000..72fc0723f0220 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.DataExportInner; +import com.azure.resourcemanager.loganalytics.models.DataExport; +import com.azure.resourcemanager.loganalytics.models.Type; +import java.util.Collections; +import java.util.List; + +public final class DataExportImpl implements DataExport, DataExport.Definition, DataExport.Update { + private DataExportInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String dataExportId() { + return this.innerModel().dataExportId(); + } + + public List tableNames() { + List inner = this.innerModel().tableNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean enable() { + return this.innerModel().enable(); + } + + public String createdDate() { + return this.innerModel().createdDate(); + } + + public String lastModifiedDate() { + return this.innerModel().lastModifiedDate(); + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public Type typePropertiesDestinationType() { + return this.innerModel().typePropertiesDestinationType(); + } + + public String eventHubName() { + return this.innerModel().eventHubName(); + } + + public DataExportInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String dataExportName; + + public DataExportImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public DataExport create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataExports() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataExportName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataExport create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataExports() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataExportName, this.innerModel(), context) + .getValue(); + return this; + } + + public DataExportImpl(String name, LogAnalyticsManager serviceManager) { + this.innerObject = new DataExportInner(); + this.serviceManager = serviceManager; + this.dataExportName = name; + } + + public DataExportImpl update() { + return this; + } + + public DataExport apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataExports() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataExportName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataExport apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataExports() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataExportName, this.innerModel(), context) + .getValue(); + return this; + } + + public DataExportImpl(DataExportInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.dataExportName = Utils.getValueFromIdByName(innerObject.id(), "dataExports"); + } + + public DataExport refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataExports() + .getWithResponse(resourceGroupName, workspaceName, dataExportName, Context.NONE) + .getValue(); + return this; + } + + public DataExport refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataExports() + .getWithResponse(resourceGroupName, workspaceName, dataExportName, context) + .getValue(); + return this; + } + + public DataExportImpl withDataExportId(String dataExportId) { + this.innerModel().withDataExportId(dataExportId); + return this; + } + + public DataExportImpl withTableNames(List tableNames) { + this.innerModel().withTableNames(tableNames); + return this; + } + + public DataExportImpl withEnable(Boolean enable) { + this.innerModel().withEnable(enable); + return this; + } + + public DataExportImpl withCreatedDate(String createdDate) { + this.innerModel().withCreatedDate(createdDate); + return this; + } + + public DataExportImpl withLastModifiedDate(String lastModifiedDate) { + this.innerModel().withLastModifiedDate(lastModifiedDate); + return this; + } + + public DataExportImpl withResourceId(String resourceId) { + this.innerModel().withResourceId(resourceId); + return this; + } + + public DataExportImpl withEventHubName(String eventHubName) { + this.innerModel().withEventHubName(eventHubName); + return this; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportsClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportsClientImpl.java new file mode 100644 index 0000000000000..43c478841283c --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportsClientImpl.java @@ -0,0 +1,801 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.DataExportsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.DataExportInner; +import com.azure.resourcemanager.loganalytics.models.DataExportListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataExportsClient. */ +public final class DataExportsClientImpl implements DataExportsClient { + private final ClientLogger logger = new ClientLogger(DataExportsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DataExportsService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of DataExportsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataExportsClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(DataExportsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientDataExports to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface DataExportsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/dataExports") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/dataExports/{dataExportName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("dataExportName") String dataExportName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DataExportInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/dataExports/{dataExportName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("dataExportName") String dataExportName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/dataExports/{dataExportName}") + @ExpectedResponses({200, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("dataExportName") String dataExportName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 the request to list data exports. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByWorkspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 the request to list data exports. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByWorkspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 the request to list data exports. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName)); + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 the request to list data exports. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync( + String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 the request to list data exports. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName)); + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 the request to list data exports. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The top level data export resource container. + * @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 top level data export resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataExportName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataExportName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + dataExportName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The top level data export resource container. + * @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 top level data export resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String workspaceName, + String dataExportName, + DataExportInner parameters, + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataExportName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataExportName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + dataExportName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The top level data export resource container. + * @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 top level data export resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, dataExportName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The top level data export resource container. + * @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 top level data export resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataExportInner createOrUpdate( + String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters) { + return createOrUpdateAsync(resourceGroupName, workspaceName, dataExportName, parameters).block(); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The top level data export resource container. + * @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 top level data export resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String workspaceName, + String dataExportName, + DataExportInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, dataExportName, parameters, context) + .block(); + } + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 a data export instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String dataExportName) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataExportName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataExportName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + dataExportName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 data export instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String dataExportName, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataExportName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataExportName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + dataExportName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 a data export instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String dataExportName) { + return getWithResponseAsync(resourceGroupName, workspaceName, dataExportName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 a data export instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataExportInner get(String resourceGroupName, String workspaceName, String dataExportName) { + return getAsync(resourceGroupName, workspaceName, dataExportName).block(); + } + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 data export instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String workspaceName, String dataExportName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, dataExportName, context).block(); + } + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String dataExportName) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataExportName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataExportName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + dataExportName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String dataExportName, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataExportName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataExportName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + dataExportName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String dataExportName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, dataExportName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String dataExportName) { + deleteAsync(resourceGroupName, workspaceName, dataExportName).block(); + } + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, String dataExportName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, dataExportName, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportsImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportsImpl.java new file mode 100644 index 0000000000000..4efe7bdc4ff6f --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataExportsImpl.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.DataExportsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.DataExportInner; +import com.azure.resourcemanager.loganalytics.models.DataExport; +import com.azure.resourcemanager.loganalytics.models.DataExports; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DataExportsImpl implements DataExports { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataExportsImpl.class); + + private final DataExportsClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public DataExportsImpl(DataExportsClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + return inner.mapPage(inner1 -> new DataExportImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context); + return inner.mapPage(inner1 -> new DataExportImpl(inner1, this.manager())); + } + + public DataExport get(String resourceGroupName, String workspaceName, String dataExportName) { + DataExportInner inner = this.serviceClient().get(resourceGroupName, workspaceName, dataExportName); + if (inner != null) { + return new DataExportImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String workspaceName, String dataExportName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, workspaceName, dataExportName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataExportImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String workspaceName, String dataExportName) { + this.serviceClient().delete(resourceGroupName, workspaceName, dataExportName); + } + + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, String dataExportName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, dataExportName, context); + } + + public DataExport getById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String dataExportName = Utils.getValueFromIdByName(id, "dataExports"); + if (dataExportName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataExports'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, dataExportName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String dataExportName = Utils.getValueFromIdByName(id, "dataExports"); + if (dataExportName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataExports'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, dataExportName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String dataExportName = Utils.getValueFromIdByName(id, "dataExports"); + if (dataExportName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataExports'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, dataExportName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String dataExportName = Utils.getValueFromIdByName(id, "dataExports"); + if (dataExportName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataExports'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, dataExportName, context); + } + + private DataExportsClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + public DataExportImpl define(String name) { + return new DataExportImpl(name, this.manager()); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourceImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourceImpl.java new file mode 100644 index 0000000000000..7dffa8f9a3756 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourceImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.DataSourceInner; +import com.azure.resourcemanager.loganalytics.models.DataSource; +import com.azure.resourcemanager.loganalytics.models.DataSourceKind; +import java.util.Collections; +import java.util.Map; + +public final class DataSourceImpl implements DataSource, DataSource.Definition, DataSource.Update { + private DataSourceInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public DataSourceKind kind() { + return this.innerModel().kind(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public DataSourceInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String dataSourceName; + + public DataSourceImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public DataSource create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataSources() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataSourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataSource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataSources() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataSourceName, this.innerModel(), context) + .getValue(); + return this; + } + + public DataSourceImpl(String name, LogAnalyticsManager serviceManager) { + this.innerObject = new DataSourceInner(); + this.serviceManager = serviceManager; + this.dataSourceName = name; + } + + public DataSourceImpl update() { + return this; + } + + public DataSource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataSources() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataSourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataSource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataSources() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataSourceName, this.innerModel(), context) + .getValue(); + return this; + } + + public DataSourceImpl(DataSourceInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.dataSourceName = Utils.getValueFromIdByName(innerObject.id(), "dataSources"); + } + + public DataSource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataSources() + .getWithResponse(resourceGroupName, workspaceName, dataSourceName, Context.NONE) + .getValue(); + return this; + } + + public DataSource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataSources() + .getWithResponse(resourceGroupName, workspaceName, dataSourceName, context) + .getValue(); + return this; + } + + public DataSourceImpl withProperties(Object properties) { + this.innerModel().withProperties(properties); + return this; + } + + public DataSourceImpl withKind(DataSourceKind kind) { + this.innerModel().withKind(kind); + return this; + } + + public DataSourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public DataSourceImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourcesClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourcesClientImpl.java new file mode 100644 index 0000000000000..ccd4d8cd7a66e --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourcesClientImpl.java @@ -0,0 +1,937 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.DataSourcesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.DataSourceInner; +import com.azure.resourcemanager.loganalytics.models.DataSourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataSourcesClient. */ +public final class DataSourcesClientImpl implements DataSourcesClient { + private final ClientLogger logger = new ClientLogger(DataSourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DataSourcesService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of DataSourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataSourcesClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(DataSourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientDataSources to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface DataSourcesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/dataSources/{dataSourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("dataSourceName") String dataSourceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") DataSourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/dataSources/{dataSourceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("dataSourceName") String dataSourceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/dataSources/{dataSourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("dataSourceName") String dataSourceName, + @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.OperationalInsights" + + "/workspaces/{workspaceName}/dataSources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("$filter") String filter, + @QueryParam("$skiptoken") String skiptoken, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspaceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters Datasources under OMS Workspace. + * @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 datasources under OMS Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters Datasources under OMS Workspace. + * @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 datasources under OMS Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String workspaceName, + String dataSourceName, + DataSourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters Datasources under OMS Workspace. + * @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 datasources under OMS Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, dataSourceName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters Datasources under OMS Workspace. + * @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 datasources under OMS Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataSourceInner createOrUpdate( + String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters) { + return createOrUpdateAsync(resourceGroupName, workspaceName, dataSourceName, parameters).block(); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters Datasources under OMS Workspace. + * @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 datasources under OMS Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String workspaceName, + String dataSourceName, + DataSourceInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, dataSourceName, parameters, context) + .block(); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String dataSourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceName 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.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String dataSourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceName 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.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, dataSourceName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 workspaceName, String dataSourceName) { + deleteAsync(resourceGroupName, workspaceName, dataSourceName).block(); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, String dataSourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, dataSourceName, context).block(); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 datasource instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String dataSourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceName 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"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 datasource instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String dataSourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceName 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 datasource instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + return getWithResponseAsync(resourceGroupName, workspaceName, dataSourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 datasource instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataSourceInner get(String resourceGroupName, String workspaceName, String dataSourceName) { + return getAsync(resourceGroupName, workspaceName, dataSourceName).block(); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 datasource instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String workspaceName, String dataSourceName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, dataSourceName, context).block(); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @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 first page of data source instances in a workspace with the link to the next page. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName, String filter, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter 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"; + return FluxUtil + .withContext( + context -> + service + .listByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + filter, + skiptoken, + 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @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 first page of data source instances in a workspace with the link to the next page. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName, String filter, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter 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 + .listByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + filter, + skiptoken, + 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)); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @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 first page of data source instances in a workspace with the link to the next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync( + String resourceGroupName, String workspaceName, String filter, String skiptoken) { + return new PagedFlux<>( + () -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter, skiptoken), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink)); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the 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 first page of data source instances in a workspace with the link to the next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync( + String resourceGroupName, String workspaceName, String filter) { + final String skiptoken = null; + return new PagedFlux<>( + () -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter, skiptoken), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink)); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @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 first page of data source instances in a workspace with the link to the next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync( + String resourceGroupName, String workspaceName, String filter, String skiptoken, Context context) { + return new PagedFlux<>( + () -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter, skiptoken, context), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the 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 first page of data source instances in a workspace with the link to the next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, String filter) { + final String skiptoken = null; + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName, filter, skiptoken)); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @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 first page of data source instances in a workspace with the link to the next page. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, String filter, String skiptoken, Context context) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName, filter, skiptoken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list data source by workspace operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceNextSinglePageAsync(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.listByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list data source by workspace operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceNextSinglePageAsync(String nextLink, Context context) { + 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"; + context = this.client.mergeContext(context); + return service + .listByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourcesImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourcesImpl.java new file mode 100644 index 0000000000000..56de2cdb12ece --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DataSourcesImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.DataSourcesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.DataSourceInner; +import com.azure.resourcemanager.loganalytics.models.DataSource; +import com.azure.resourcemanager.loganalytics.models.DataSources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DataSourcesImpl implements DataSources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataSourcesImpl.class); + + private final DataSourcesClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public DataSourcesImpl(DataSourcesClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String workspaceName, String dataSourceName) { + this.serviceClient().delete(resourceGroupName, workspaceName, dataSourceName); + } + + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, String dataSourceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, dataSourceName, context); + } + + public DataSource get(String resourceGroupName, String workspaceName, String dataSourceName) { + DataSourceInner inner = this.serviceClient().get(resourceGroupName, workspaceName, dataSourceName); + if (inner != null) { + return new DataSourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String workspaceName, String dataSourceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, workspaceName, dataSourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataSourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, String filter) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, filter); + return inner.mapPage(inner1 -> new DataSourceImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, String filter, String skiptoken, Context context) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, filter, skiptoken, context); + return inner.mapPage(inner1 -> new DataSourceImpl(inner1, this.manager())); + } + + public DataSource getById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String dataSourceName = Utils.getValueFromIdByName(id, "dataSources"); + if (dataSourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataSources'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, dataSourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String dataSourceName = Utils.getValueFromIdByName(id, "dataSources"); + if (dataSourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataSources'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, dataSourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String dataSourceName = Utils.getValueFromIdByName(id, "dataSources"); + if (dataSourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataSources'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, dataSourceName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String dataSourceName = Utils.getValueFromIdByName(id, "dataSources"); + if (dataSourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataSources'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, dataSourceName, context); + } + + private DataSourcesClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + public DataSourceImpl define(String name) { + return new DataSourceImpl(name, this.manager()); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DeletedWorkspacesClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DeletedWorkspacesClientImpl.java new file mode 100644 index 0000000000000..ef179d8630c1d --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DeletedWorkspacesClientImpl.java @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.PathParam; +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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.DeletedWorkspacesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.loganalytics.models.WorkspaceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DeletedWorkspacesClient. */ +public final class DeletedWorkspacesClientImpl implements DeletedWorkspacesClient { + private final ClientLogger logger = new ClientLogger(DeletedWorkspacesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DeletedWorkspacesService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of DeletedWorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeletedWorkspacesClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(DeletedWorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientDeletedWorkspaces to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface DeletedWorkspacesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/deletedWorkspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @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.OperationalInsights" + + "/deletedWorkspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @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 recently deleted workspaces in a subscription, available for recovery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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"; + return FluxUtil + .withContext( + context -> + 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(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @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 recently deleted workspaces in a subscription, available for recovery. + */ + @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(), null, null)); + } + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @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 recently deleted workspaces in a subscription, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @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 recently deleted workspaces in a subscription, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @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 recently deleted workspaces in a subscription, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @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 recently deleted workspaces in a subscription, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 recently deleted workspaces in a resource group, available for recovery. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @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 recently deleted workspaces in a resource group, available for recovery. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 recently deleted workspaces in a resource group, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @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 recently deleted workspaces in a resource group, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 recently deleted workspaces in a resource group, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @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 recently deleted workspaces in a resource group, available for recovery. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DeletedWorkspacesImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DeletedWorkspacesImpl.java new file mode 100644 index 0000000000000..f0299701d0097 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/DeletedWorkspacesImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.DeletedWorkspacesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.loganalytics.models.DeletedWorkspaces; +import com.azure.resourcemanager.loganalytics.models.Workspace; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DeletedWorkspacesImpl implements DeletedWorkspaces { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeletedWorkspacesImpl.class); + + private final DeletedWorkspacesClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public DeletedWorkspacesImpl(DeletedWorkspacesClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + private DeletedWorkspacesClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/GatewaysClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/GatewaysClientImpl.java new file mode 100644 index 0000000000000..4c7018a55e718 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/GatewaysClientImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +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.Response; +import com.azure.core.http.rest.RestProxy; +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.loganalytics.fluent.GatewaysClient; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GatewaysClient. */ +public final class GatewaysClientImpl implements GatewaysClient { + private final ClientLogger logger = new ClientLogger(GatewaysClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GatewaysService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of GatewaysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GatewaysClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = RestProxy.create(GatewaysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientGateways to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface GatewaysService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/gateways/{gatewayId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("gatewayId") String gatewayId, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway Id. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String gatewayId) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (gatewayId == null) { + return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + gatewayId, + this.client.getApiVersion(), + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String gatewayId, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (gatewayId == null) { + return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + gatewayId, + this.client.getApiVersion(), + context); + } + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway Id. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String gatewayId) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, gatewayId) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway Id. + * @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 workspaceName, String gatewayId) { + deleteAsync(resourceGroupName, workspaceName, gatewayId).block(); + } + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, String gatewayId, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, gatewayId, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/GatewaysImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/GatewaysImpl.java new file mode 100644 index 0000000000000..21229a1b9487a --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/GatewaysImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.GatewaysClient; +import com.azure.resourcemanager.loganalytics.models.Gateways; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GatewaysImpl implements Gateways { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GatewaysImpl.class); + + private final GatewaysClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public GatewaysImpl(GatewaysClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String workspaceName, String gatewayId) { + this.serviceClient().delete(resourceGroupName, workspaceName, gatewayId); + } + + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, String gatewayId, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, gatewayId, context); + } + + private GatewaysClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePackImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePackImpl.java new file mode 100644 index 0000000000000..c1e9170855c0e --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePackImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.IntelligencePackInner; +import com.azure.resourcemanager.loganalytics.models.IntelligencePack; + +public final class IntelligencePackImpl implements IntelligencePack { + private IntelligencePackInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public IntelligencePackImpl(IntelligencePackInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public IntelligencePackInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePacksClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePacksClientImpl.java new file mode 100644 index 0000000000000..56919c745037a --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePacksClientImpl.java @@ -0,0 +1,557 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.PathParam; +import com.azure.core.annotation.Post; +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.Response; +import com.azure.core.http.rest.RestProxy; +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.loganalytics.fluent.IntelligencePacksClient; +import com.azure.resourcemanager.loganalytics.fluent.models.IntelligencePackInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IntelligencePacksClient. */ +public final class IntelligencePacksClientImpl implements IntelligencePacksClient { + private final ClientLogger logger = new ClientLogger(IntelligencePacksClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IntelligencePacksService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of IntelligencePacksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IntelligencePacksClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(IntelligencePacksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientIntelligencePacks to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface IntelligencePacksService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Disable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> disable( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("intelligencePackName") String intelligencePackName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Enable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> enable( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("intelligencePackName") String intelligencePackName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/intelligencePacks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> disableWithResponseAsync( + String resourceGroupName, String workspaceName, String intelligencePackName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (intelligencePackName == null) { + return Mono + .error(new IllegalArgumentException("Parameter intelligencePackName 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.")); + } + return FluxUtil + .withContext( + context -> + service + .disable( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + intelligencePackName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> disableWithResponseAsync( + String resourceGroupName, String workspaceName, String intelligencePackName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (intelligencePackName == null) { + return Mono + .error(new IllegalArgumentException("Parameter intelligencePackName 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.")); + } + context = this.client.mergeContext(context); + return service + .disable( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + intelligencePackName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + return disableWithResponseAsync(resourceGroupName, workspaceName, intelligencePackName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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 disable(String resourceGroupName, String workspaceName, String intelligencePackName) { + disableAsync(resourceGroupName, workspaceName, intelligencePackName).block(); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response disableWithResponse( + String resourceGroupName, String workspaceName, String intelligencePackName, Context context) { + return disableWithResponseAsync(resourceGroupName, workspaceName, intelligencePackName, context).block(); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> enableWithResponseAsync( + String resourceGroupName, String workspaceName, String intelligencePackName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (intelligencePackName == null) { + return Mono + .error(new IllegalArgumentException("Parameter intelligencePackName 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.")); + } + return FluxUtil + .withContext( + context -> + service + .enable( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + intelligencePackName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> enableWithResponseAsync( + String resourceGroupName, String workspaceName, String intelligencePackName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (intelligencePackName == null) { + return Mono + .error(new IllegalArgumentException("Parameter intelligencePackName 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.")); + } + context = this.client.mergeContext(context); + return service + .enable( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + intelligencePackName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono enableAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + return enableWithResponseAsync(resourceGroupName, workspaceName, intelligencePackName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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 enable(String resourceGroupName, String workspaceName, String intelligencePackName) { + enableAsync(resourceGroupName, workspaceName, intelligencePackName).block(); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response enableWithResponse( + String resourceGroupName, String workspaceName, String intelligencePackName, Context context) { + return enableWithResponseAsync(resourceGroupName, workspaceName, intelligencePackName, context).block(); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 array of IntelligencePack. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 array of IntelligencePack. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 array of IntelligencePack. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync(String resourceGroupName, String workspaceName) { + return listWithResponseAsync(resourceGroupName, workspaceName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 array of IntelligencePack. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List list(String resourceGroupName, String workspaceName) { + return listAsync(resourceGroupName, workspaceName).block(); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 array of IntelligencePack. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listWithResponse( + String resourceGroupName, String workspaceName, Context context) { + return listWithResponseAsync(resourceGroupName, workspaceName, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePacksImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePacksImpl.java new file mode 100644 index 0000000000000..d32adabe8192c --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/IntelligencePacksImpl.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.IntelligencePacksClient; +import com.azure.resourcemanager.loganalytics.fluent.models.IntelligencePackInner; +import com.azure.resourcemanager.loganalytics.models.IntelligencePack; +import com.azure.resourcemanager.loganalytics.models.IntelligencePacks; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class IntelligencePacksImpl implements IntelligencePacks { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IntelligencePacksImpl.class); + + private final IntelligencePacksClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public IntelligencePacksImpl(IntelligencePacksClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void disable(String resourceGroupName, String workspaceName, String intelligencePackName) { + this.serviceClient().disable(resourceGroupName, workspaceName, intelligencePackName); + } + + public Response disableWithResponse( + String resourceGroupName, String workspaceName, String intelligencePackName, Context context) { + return this + .serviceClient() + .disableWithResponse(resourceGroupName, workspaceName, intelligencePackName, context); + } + + public void enable(String resourceGroupName, String workspaceName, String intelligencePackName) { + this.serviceClient().enable(resourceGroupName, workspaceName, intelligencePackName); + } + + public Response enableWithResponse( + String resourceGroupName, String workspaceName, String intelligencePackName, Context context) { + return this.serviceClient().enableWithResponse(resourceGroupName, workspaceName, intelligencePackName, context); + } + + public List list(String resourceGroupName, String workspaceName) { + List inner = this.serviceClient().list(resourceGroupName, workspaceName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new IntelligencePackImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listWithResponse( + String resourceGroupName, String workspaceName, Context context) { + Response> inner = + this.serviceClient().listWithResponse(resourceGroupName, workspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new IntelligencePackImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + private IntelligencePacksClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServiceImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServiceImpl.java new file mode 100644 index 0000000000000..812c1afb37d48 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServiceImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedServiceInner; +import com.azure.resourcemanager.loganalytics.models.LinkedService; +import com.azure.resourcemanager.loganalytics.models.LinkedServiceEntityStatus; +import java.util.Collections; +import java.util.Map; + +public final class LinkedServiceImpl implements LinkedService, LinkedService.Definition, LinkedService.Update { + private LinkedServiceInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public String writeAccessResourceId() { + return this.innerModel().writeAccessResourceId(); + } + + public LinkedServiceEntityStatus provisioningState() { + return this.innerModel().provisioningState(); + } + + public LinkedServiceInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String linkedServiceName; + + public LinkedServiceImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public LinkedService create() { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedServices() + .createOrUpdate(resourceGroupName, workspaceName, linkedServiceName, this.innerModel(), Context.NONE); + return this; + } + + public LinkedService create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedServices() + .createOrUpdate(resourceGroupName, workspaceName, linkedServiceName, this.innerModel(), context); + return this; + } + + public LinkedServiceImpl(String name, LogAnalyticsManager serviceManager) { + this.innerObject = new LinkedServiceInner(); + this.serviceManager = serviceManager; + this.linkedServiceName = name; + } + + public LinkedServiceImpl update() { + return this; + } + + public LinkedService apply() { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedServices() + .createOrUpdate(resourceGroupName, workspaceName, linkedServiceName, this.innerModel(), Context.NONE); + return this; + } + + public LinkedService apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedServices() + .createOrUpdate(resourceGroupName, workspaceName, linkedServiceName, this.innerModel(), context); + return this; + } + + public LinkedServiceImpl(LinkedServiceInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.linkedServiceName = Utils.getValueFromIdByName(innerObject.id(), "linkedServices"); + } + + public LinkedService refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedServices() + .getWithResponse(resourceGroupName, workspaceName, linkedServiceName, Context.NONE) + .getValue(); + return this; + } + + public LinkedService refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedServices() + .getWithResponse(resourceGroupName, workspaceName, linkedServiceName, context) + .getValue(); + return this; + } + + public LinkedServiceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public LinkedServiceImpl withResourceId(String resourceId) { + this.innerModel().withResourceId(resourceId); + return this; + } + + public LinkedServiceImpl withWriteAccessResourceId(String writeAccessResourceId) { + this.innerModel().withWriteAccessResourceId(writeAccessResourceId); + return this; + } + + public LinkedServiceImpl withProvisioningState(LinkedServiceEntityStatus provisioningState) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServicesClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServicesClientImpl.java new file mode 100644 index 0000000000000..d7a577eee3917 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServicesClientImpl.java @@ -0,0 +1,1030 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.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.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.loganalytics.fluent.LinkedServicesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedServiceInner; +import com.azure.resourcemanager.loganalytics.models.LinkedServiceListResult; +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 LinkedServicesClient. */ +public final class LinkedServicesClientImpl implements LinkedServicesClient { + private final ClientLogger logger = new ClientLogger(LinkedServicesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LinkedServicesService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of LinkedServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LinkedServicesClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(LinkedServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientLinkedServices to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface LinkedServicesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/linkedServices/{linkedServiceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("linkedServiceName") String linkedServiceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LinkedServiceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/linkedServices/{linkedServiceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("linkedServiceName") String linkedServiceName, + @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.OperationalInsights" + + "/workspaces/{workspaceName}/linkedServices/{linkedServiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("linkedServiceName") String linkedServiceName, + @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.OperationalInsights" + + "/workspaces/{workspaceName}/linkedServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (linkedServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter linkedServiceName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + linkedServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String workspaceName, + String linkedServiceName, + LinkedServiceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (linkedServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter linkedServiceName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + linkedServiceName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LinkedServiceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, linkedServiceName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LinkedServiceInner.class, LinkedServiceInner.class, Context.NONE); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LinkedServiceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String workspaceName, + String linkedServiceName, + LinkedServiceInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, linkedServiceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LinkedServiceInner.class, LinkedServiceInner.class, context); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LinkedServiceInner> beginCreateOrUpdate( + String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, linkedServiceName, parameters) + .getSyncPoller(); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LinkedServiceInner> beginCreateOrUpdate( + String resourceGroupName, + String workspaceName, + String linkedServiceName, + LinkedServiceInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, linkedServiceName, parameters, context) + .getSyncPoller(); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, linkedServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String workspaceName, + String linkedServiceName, + LinkedServiceInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, linkedServiceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkedServiceInner createOrUpdate( + String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + return createOrUpdateAsync(resourceGroupName, workspaceName, linkedServiceName, parameters).block(); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource. + * @param parameters The top level Linked service resource container. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkedServiceInner createOrUpdate( + String resourceGroupName, + String workspaceName, + String linkedServiceName, + LinkedServiceInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, workspaceName, linkedServiceName, parameters, context).block(); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String linkedServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (linkedServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter linkedServiceName 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"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + linkedServiceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (linkedServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter linkedServiceName 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 + .delete( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + linkedServiceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LinkedServiceInner> beginDeleteAsync( + String resourceGroupName, String workspaceName, String linkedServiceName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, workspaceName, linkedServiceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LinkedServiceInner.class, LinkedServiceInner.class, Context.NONE); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LinkedServiceInner> beginDeleteAsync( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, workspaceName, linkedServiceName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LinkedServiceInner.class, LinkedServiceInner.class, context); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LinkedServiceInner> beginDelete( + String resourceGroupName, String workspaceName, String linkedServiceName) { + return beginDeleteAsync(resourceGroupName, workspaceName, linkedServiceName).getSyncPoller(); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LinkedServiceInner> beginDelete( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context) { + return beginDeleteAsync(resourceGroupName, workspaceName, linkedServiceName, context).getSyncPoller(); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String workspaceName, String linkedServiceName) { + return beginDeleteAsync(resourceGroupName, workspaceName, linkedServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context) { + return beginDeleteAsync(resourceGroupName, workspaceName, linkedServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkedServiceInner delete(String resourceGroupName, String workspaceName, String linkedServiceName) { + return deleteAsync(resourceGroupName, workspaceName, linkedServiceName).block(); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkedServiceInner delete( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context) { + return deleteAsync(resourceGroupName, workspaceName, linkedServiceName, context).block(); + } + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 linked service instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String linkedServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (linkedServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter linkedServiceName 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"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + linkedServiceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 linked service instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (linkedServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter linkedServiceName 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + linkedServiceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 linked service instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String workspaceName, String linkedServiceName) { + return getWithResponseAsync(resourceGroupName, workspaceName, linkedServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 linked service instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkedServiceInner get(String resourceGroupName, String workspaceName, String linkedServiceName) { + return getAsync(resourceGroupName, workspaceName, linkedServiceName).block(); + } + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 linked service instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, linkedServiceName, context).block(); + } + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 linked services instances in a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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"; + return FluxUtil + .withContext( + context -> + service + .listByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 linked services instances in a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 + .listByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 linked services instances in a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 linked services instances in a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync( + String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 linked services instances in a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 linked services instances in a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName, context)); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServicesImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServicesImpl.java new file mode 100644 index 0000000000000..6c3519696eb72 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedServicesImpl.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.LinkedServicesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedServiceInner; +import com.azure.resourcemanager.loganalytics.models.LinkedService; +import com.azure.resourcemanager.loganalytics.models.LinkedServices; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LinkedServicesImpl implements LinkedServices { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkedServicesImpl.class); + + private final LinkedServicesClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public LinkedServicesImpl(LinkedServicesClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public LinkedService delete(String resourceGroupName, String workspaceName, String linkedServiceName) { + LinkedServiceInner inner = this.serviceClient().delete(resourceGroupName, workspaceName, linkedServiceName); + if (inner != null) { + return new LinkedServiceImpl(inner, this.manager()); + } else { + return null; + } + } + + public LinkedService delete( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context) { + LinkedServiceInner inner = + this.serviceClient().delete(resourceGroupName, workspaceName, linkedServiceName, context); + if (inner != null) { + return new LinkedServiceImpl(inner, this.manager()); + } else { + return null; + } + } + + public LinkedService get(String resourceGroupName, String workspaceName, String linkedServiceName) { + LinkedServiceInner inner = this.serviceClient().get(resourceGroupName, workspaceName, linkedServiceName); + if (inner != null) { + return new LinkedServiceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, workspaceName, linkedServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LinkedServiceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + return inner.mapPage(inner1 -> new LinkedServiceImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context); + return inner.mapPage(inner1 -> new LinkedServiceImpl(inner1, this.manager())); + } + + public LinkedService getById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String linkedServiceName = Utils.getValueFromIdByName(id, "linkedServices"); + if (linkedServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'linkedServices'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, linkedServiceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String linkedServiceName = Utils.getValueFromIdByName(id, "linkedServices"); + if (linkedServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'linkedServices'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, linkedServiceName, context); + } + + private LinkedServicesClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + public LinkedServiceImpl define(String name) { + return new LinkedServiceImpl(name, this.manager()); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsClientImpl.java new file mode 100644 index 0000000000000..495b702c24a7a --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsClientImpl.java @@ -0,0 +1,828 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.LinkedStorageAccountsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedStorageAccountsResourceInner; +import com.azure.resourcemanager.loganalytics.models.DataSourceType; +import com.azure.resourcemanager.loganalytics.models.LinkedStorageAccountsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LinkedStorageAccountsClient. */ +public final class LinkedStorageAccountsClientImpl implements LinkedStorageAccountsClient { + private final ClientLogger logger = new ClientLogger(LinkedStorageAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LinkedStorageAccountsService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of LinkedStorageAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LinkedStorageAccountsClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy + .create(LinkedStorageAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientLinkedStorageAccounts to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface LinkedStorageAccountsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("dataSourceType") DataSourceType dataSourceType, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LinkedStorageAccountsResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("dataSourceType") DataSourceType dataSourceType, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("dataSourceType") DataSourceType dataSourceType, + @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.OperationalInsights" + + "/workspaces/{workspaceName}/linkedStorageAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data + * source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @param parameters Linked storage accounts top level resource container. + * @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 linked storage accounts top level resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String workspaceName, + DataSourceType dataSourceType, + LinkedStorageAccountsResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceType 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceType, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data + * source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @param parameters Linked storage accounts top level resource container. + * @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 linked storage accounts top level resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String workspaceName, + DataSourceType dataSourceType, + LinkedStorageAccountsResourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceType 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceType, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data + * source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @param parameters Linked storage accounts top level resource container. + * @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 linked storage accounts top level resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String workspaceName, + DataSourceType dataSourceType, + LinkedStorageAccountsResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, dataSourceType, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data + * source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @param parameters Linked storage accounts top level resource container. + * @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 linked storage accounts top level resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkedStorageAccountsResourceInner createOrUpdate( + String resourceGroupName, + String workspaceName, + DataSourceType dataSourceType, + LinkedStorageAccountsResourceInner parameters) { + return createOrUpdateAsync(resourceGroupName, workspaceName, dataSourceType, parameters).block(); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data + * source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @param parameters Linked storage accounts top level resource container. + * @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 linked storage accounts top level resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String workspaceName, + DataSourceType dataSourceType, + LinkedStorageAccountsResourceInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, dataSourceType, parameters, context) + .block(); + } + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceType 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.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceType, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceType 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.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceType, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context); + } + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, dataSourceType) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 workspaceName, DataSourceType dataSourceType) { + deleteAsync(resourceGroupName, workspaceName, dataSourceType).block(); + } + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, dataSourceType, context).block(); + } + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceType 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"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceType, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataSourceType == null) { + return Mono.error(new IllegalArgumentException("Parameter dataSourceType 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + dataSourceType, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + return getWithResponseAsync(resourceGroupName, workspaceName, dataSourceType) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkedStorageAccountsResourceInner get( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + return getAsync(resourceGroupName, workspaceName, dataSourceType).block(); + } + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, dataSourceType, context).block(); + } + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByWorkspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + workspaceName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByWorkspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + workspaceName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync( + String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync( + String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName, context)); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsImpl.java new file mode 100644 index 0000000000000..d21ac9a8e6ac9 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.LinkedStorageAccountsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedStorageAccountsResourceInner; +import com.azure.resourcemanager.loganalytics.models.DataSourceType; +import com.azure.resourcemanager.loganalytics.models.LinkedStorageAccounts; +import com.azure.resourcemanager.loganalytics.models.LinkedStorageAccountsResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LinkedStorageAccountsImpl implements LinkedStorageAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkedStorageAccountsImpl.class); + + private final LinkedStorageAccountsClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public LinkedStorageAccountsImpl(LinkedStorageAccountsClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + this.serviceClient().delete(resourceGroupName, workspaceName, dataSourceType); + } + + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, dataSourceType, context); + } + + public LinkedStorageAccountsResource get( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + LinkedStorageAccountsResourceInner inner = + this.serviceClient().get(resourceGroupName, workspaceName, dataSourceType); + if (inner != null) { + return new LinkedStorageAccountsResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, workspaceName, dataSourceType, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LinkedStorageAccountsResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + return inner.mapPage(inner1 -> new LinkedStorageAccountsResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context); + return inner.mapPage(inner1 -> new LinkedStorageAccountsResourceImpl(inner1, this.manager())); + } + + public LinkedStorageAccountsResource getById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + DataSourceType dataSourceType = + DataSourceType.fromString(Utils.getValueFromIdByName(id, "linkedStorageAccounts")); + if (dataSourceType == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'linkedStorageAccounts'.", + id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, dataSourceType, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + DataSourceType dataSourceType = + DataSourceType.fromString(Utils.getValueFromIdByName(id, "linkedStorageAccounts")); + if (dataSourceType == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'linkedStorageAccounts'.", + id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, dataSourceType, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + DataSourceType dataSourceType = + DataSourceType.fromString(Utils.getValueFromIdByName(id, "linkedStorageAccounts")); + if (dataSourceType == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'linkedStorageAccounts'.", + id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, dataSourceType, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + DataSourceType dataSourceType = + DataSourceType.fromString(Utils.getValueFromIdByName(id, "linkedStorageAccounts")); + if (dataSourceType == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'linkedStorageAccounts'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, dataSourceType, context); + } + + private LinkedStorageAccountsClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + public LinkedStorageAccountsResourceImpl define(DataSourceType name) { + return new LinkedStorageAccountsResourceImpl(name, this.manager()); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsResourceImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsResourceImpl.java new file mode 100644 index 0000000000000..fc46b704c98d0 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/LinkedStorageAccountsResourceImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedStorageAccountsResourceInner; +import com.azure.resourcemanager.loganalytics.models.DataSourceType; +import com.azure.resourcemanager.loganalytics.models.LinkedStorageAccountsResource; +import java.util.Collections; +import java.util.List; + +public final class LinkedStorageAccountsResourceImpl + implements LinkedStorageAccountsResource, + LinkedStorageAccountsResource.Definition, + LinkedStorageAccountsResource.Update { + private LinkedStorageAccountsResourceInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public DataSourceType dataSourceType() { + return this.innerModel().dataSourceType(); + } + + public List storageAccountIds() { + List inner = this.innerModel().storageAccountIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public LinkedStorageAccountsResourceInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private DataSourceType dataSourceType; + + public LinkedStorageAccountsResourceImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public LinkedStorageAccountsResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedStorageAccounts() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataSourceType, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LinkedStorageAccountsResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedStorageAccounts() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataSourceType, this.innerModel(), context) + .getValue(); + return this; + } + + public LinkedStorageAccountsResourceImpl(DataSourceType name, LogAnalyticsManager serviceManager) { + this.innerObject = new LinkedStorageAccountsResourceInner(); + this.serviceManager = serviceManager; + this.dataSourceType = name; + } + + public LinkedStorageAccountsResourceImpl update() { + return this; + } + + public LinkedStorageAccountsResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedStorageAccounts() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataSourceType, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LinkedStorageAccountsResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedStorageAccounts() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, dataSourceType, this.innerModel(), context) + .getValue(); + return this; + } + + public LinkedStorageAccountsResourceImpl( + LinkedStorageAccountsResourceInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.dataSourceType = + DataSourceType.fromString(Utils.getValueFromIdByName(innerObject.id(), "linkedStorageAccounts")); + } + + public LinkedStorageAccountsResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedStorageAccounts() + .getWithResponse(resourceGroupName, workspaceName, dataSourceType, Context.NONE) + .getValue(); + return this; + } + + public LinkedStorageAccountsResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLinkedStorageAccounts() + .getWithResponse(resourceGroupName, workspaceName, dataSourceType, context) + .getValue(); + return this; + } + + public LinkedStorageAccountsResourceImpl withStorageAccountIds(List storageAccountIds) { + this.innerModel().withStorageAccountIds(storageAccountIds); + return this; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupImpl.java new file mode 100644 index 0000000000000..8414de3045f8c --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupImpl.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.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.ManagementGroupInner; +import com.azure.resourcemanager.loganalytics.models.ManagementGroup; +import java.time.OffsetDateTime; + +public final class ManagementGroupImpl implements ManagementGroup { + private ManagementGroupInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public ManagementGroupImpl(ManagementGroupInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Integer serverCount() { + return this.innerModel().serverCount(); + } + + public Boolean isGateway() { + return this.innerModel().isGateway(); + } + + public String name() { + return this.innerModel().name(); + } + + public String id() { + return this.innerModel().id(); + } + + public OffsetDateTime created() { + return this.innerModel().created(); + } + + public OffsetDateTime dataReceived() { + return this.innerModel().dataReceived(); + } + + public String version() { + return this.innerModel().version(); + } + + public String sku() { + return this.innerModel().sku(); + } + + public ManagementGroupInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupsClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupsClientImpl.java new file mode 100644 index 0000000000000..af667506ff337 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupsClientImpl.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.PathParam; +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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.ManagementGroupsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.ManagementGroupInner; +import com.azure.resourcemanager.loganalytics.models.WorkspaceListManagementGroupsResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagementGroupsClient. */ +public final class ManagementGroupsClientImpl implements ManagementGroupsClient { + private final ClientLogger logger = new ClientLogger(ManagementGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ManagementGroupsService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of ManagementGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagementGroupsClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(ManagementGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientManagementGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface ManagementGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/managementGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 management groups connected to a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 management groups connected to a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 management groups connected to a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 management groups connected to a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 management groups connected to a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 management groups connected to a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, context)); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupsImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupsImpl.java new file mode 100644 index 0000000000000..4fabe3f24812b --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ManagementGroupsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.ManagementGroupsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.ManagementGroupInner; +import com.azure.resourcemanager.loganalytics.models.ManagementGroup; +import com.azure.resourcemanager.loganalytics.models.ManagementGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ManagementGroupsImpl implements ManagementGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementGroupsImpl.class); + + private final ManagementGroupsClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public ManagementGroupsImpl(ManagementGroupsClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return inner.mapPage(inner1 -> new ManagementGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, workspaceName, context); + return inner.mapPage(inner1 -> new ManagementGroupImpl(inner1, this.manager())); + } + + private ManagementGroupsClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationImpl.java new file mode 100644 index 0000000000000..11b1ea60e3a97 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.OperationInner; +import com.azure.resourcemanager.loganalytics.models.Operation; +import com.azure.resourcemanager.loganalytics.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public OperationImpl(OperationInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusImpl.java new file mode 100644 index 0000000000000..30880e4b34882 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.loganalytics.models.OperationStatus; + +public final class OperationStatusImpl implements OperationStatus { + private OperationStatusInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public OperationStatusImpl(OperationStatusInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String startTime() { + return this.innerModel().startTime(); + } + + public String endTime() { + return this.innerModel().endTime(); + } + + public String status() { + return this.innerModel().status(); + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public OperationStatusInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusesClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusesClientImpl.java new file mode 100644 index 0000000000000..da9dfd6fdfcd2 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusesClientImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.PathParam; +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.Response; +import com.azure.core.http.rest.RestProxy; +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.loganalytics.fluent.OperationStatusesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.OperationStatusInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */ +public final class OperationStatusesClientImpl implements OperationStatusesClient { + private final ClientLogger logger = new ClientLogger(OperationStatusesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationStatusesService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of OperationStatusesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationStatusesClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(OperationStatusesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientOperationStatuses to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface OperationStatusesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/locations/{location}" + + "/operationStatuses/{asyncOperationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("asyncOperationId") String asyncOperationId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @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 status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String asyncOperationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (asyncOperationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter asyncOperationId 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"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + location, + asyncOperationId, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation 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 status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String asyncOperationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (asyncOperationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter asyncOperationId 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 + .get( + this.client.getEndpoint(), + location, + asyncOperationId, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @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 status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String asyncOperationId) { + return getWithResponseAsync(location, asyncOperationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @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 status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusInner get(String location, String asyncOperationId) { + return getAsync(location, asyncOperationId).block(); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation 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 status of a long running azure asynchronous operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String asyncOperationId, Context context) { + return getWithResponseAsync(location, asyncOperationId, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusesImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusesImpl.java new file mode 100644 index 0000000000000..e9756290389b5 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationStatusesImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.OperationStatusesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.loganalytics.models.OperationStatus; +import com.azure.resourcemanager.loganalytics.models.OperationStatuses; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationStatusesImpl implements OperationStatuses { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationStatusesImpl.class); + + private final OperationStatusesClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public OperationStatusesImpl(OperationStatusesClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationStatus get(String location, String asyncOperationId) { + OperationStatusInner inner = this.serviceClient().get(location, asyncOperationId); + if (inner != null) { + return new OperationStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String location, String asyncOperationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(location, asyncOperationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationStatusesClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationalInsightsManagementClientBuilder.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationalInsightsManagementClientBuilder.java new file mode 100644 index 0000000000000..4317db2dd3e0e --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationalInsightsManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the OperationalInsightsManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {OperationalInsightsManagementClientImpl.class}) +public final class OperationalInsightsManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the OperationalInsightsManagementClientBuilder. + */ + public OperationalInsightsManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the OperationalInsightsManagementClientBuilder. + */ + public OperationalInsightsManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the OperationalInsightsManagementClientBuilder. + */ + public OperationalInsightsManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the OperationalInsightsManagementClientBuilder. + */ + public OperationalInsightsManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the OperationalInsightsManagementClientBuilder. + */ + public OperationalInsightsManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the OperationalInsightsManagementClientBuilder. + */ + public OperationalInsightsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of OperationalInsightsManagementClientImpl with the provided parameters. + * + * @return an instance of OperationalInsightsManagementClientImpl. + */ + public OperationalInsightsManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + OperationalInsightsManagementClientImpl client = + new OperationalInsightsManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationalInsightsManagementClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationalInsightsManagementClientImpl.java new file mode 100644 index 0000000000000..14499fa6cd88d --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationalInsightsManagementClientImpl.java @@ -0,0 +1,559 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +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.util.Context; +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.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.loganalytics.fluent.AvailableServiceTiersClient; +import com.azure.resourcemanager.loganalytics.fluent.ClustersClient; +import com.azure.resourcemanager.loganalytics.fluent.DataExportsClient; +import com.azure.resourcemanager.loganalytics.fluent.DataSourcesClient; +import com.azure.resourcemanager.loganalytics.fluent.DeletedWorkspacesClient; +import com.azure.resourcemanager.loganalytics.fluent.GatewaysClient; +import com.azure.resourcemanager.loganalytics.fluent.IntelligencePacksClient; +import com.azure.resourcemanager.loganalytics.fluent.LinkedServicesClient; +import com.azure.resourcemanager.loganalytics.fluent.LinkedStorageAccountsClient; +import com.azure.resourcemanager.loganalytics.fluent.ManagementGroupsClient; +import com.azure.resourcemanager.loganalytics.fluent.OperationStatusesClient; +import com.azure.resourcemanager.loganalytics.fluent.OperationalInsightsManagementClient; +import com.azure.resourcemanager.loganalytics.fluent.OperationsClient; +import com.azure.resourcemanager.loganalytics.fluent.SavedSearchesClient; +import com.azure.resourcemanager.loganalytics.fluent.SchemasClient; +import com.azure.resourcemanager.loganalytics.fluent.SharedKeysOperationsClient; +import com.azure.resourcemanager.loganalytics.fluent.StorageInsightConfigsClient; +import com.azure.resourcemanager.loganalytics.fluent.TablesClient; +import com.azure.resourcemanager.loganalytics.fluent.UsagesClient; +import com.azure.resourcemanager.loganalytics.fluent.WorkspacePurgesClient; +import com.azure.resourcemanager.loganalytics.fluent.WorkspacesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the OperationalInsightsManagementClientImpl type. */ +@ServiceClient(builder = OperationalInsightsManagementClientBuilder.class) +public final class OperationalInsightsManagementClientImpl implements OperationalInsightsManagementClient { + private final ClientLogger logger = new ClientLogger(OperationalInsightsManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The DataExportsClient object to access its operations. */ + private final DataExportsClient dataExports; + + /** + * Gets the DataExportsClient object to access its operations. + * + * @return the DataExportsClient object. + */ + public DataExportsClient getDataExports() { + return this.dataExports; + } + + /** The DataSourcesClient object to access its operations. */ + private final DataSourcesClient dataSources; + + /** + * Gets the DataSourcesClient object to access its operations. + * + * @return the DataSourcesClient object. + */ + public DataSourcesClient getDataSources() { + return this.dataSources; + } + + /** The IntelligencePacksClient object to access its operations. */ + private final IntelligencePacksClient intelligencePacks; + + /** + * Gets the IntelligencePacksClient object to access its operations. + * + * @return the IntelligencePacksClient object. + */ + public IntelligencePacksClient getIntelligencePacks() { + return this.intelligencePacks; + } + + /** The LinkedServicesClient object to access its operations. */ + private final LinkedServicesClient linkedServices; + + /** + * Gets the LinkedServicesClient object to access its operations. + * + * @return the LinkedServicesClient object. + */ + public LinkedServicesClient getLinkedServices() { + return this.linkedServices; + } + + /** The LinkedStorageAccountsClient object to access its operations. */ + private final LinkedStorageAccountsClient linkedStorageAccounts; + + /** + * Gets the LinkedStorageAccountsClient object to access its operations. + * + * @return the LinkedStorageAccountsClient object. + */ + public LinkedStorageAccountsClient getLinkedStorageAccounts() { + return this.linkedStorageAccounts; + } + + /** The ManagementGroupsClient object to access its operations. */ + private final ManagementGroupsClient managementGroups; + + /** + * Gets the ManagementGroupsClient object to access its operations. + * + * @return the ManagementGroupsClient object. + */ + public ManagementGroupsClient getManagementGroups() { + return this.managementGroups; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The OperationStatusesClient object to access its operations. */ + private final OperationStatusesClient operationStatuses; + + /** + * Gets the OperationStatusesClient object to access its operations. + * + * @return the OperationStatusesClient object. + */ + public OperationStatusesClient getOperationStatuses() { + return this.operationStatuses; + } + + /** The SharedKeysOperationsClient object to access its operations. */ + private final SharedKeysOperationsClient sharedKeysOperations; + + /** + * Gets the SharedKeysOperationsClient object to access its operations. + * + * @return the SharedKeysOperationsClient object. + */ + public SharedKeysOperationsClient getSharedKeysOperations() { + return this.sharedKeysOperations; + } + + /** The UsagesClient object to access its operations. */ + private final UsagesClient usages; + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + public UsagesClient getUsages() { + return this.usages; + } + + /** The WorkspacesClient object to access its operations. */ + private final WorkspacesClient workspaces; + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + public WorkspacesClient getWorkspaces() { + return this.workspaces; + } + + /** The DeletedWorkspacesClient object to access its operations. */ + private final DeletedWorkspacesClient deletedWorkspaces; + + /** + * Gets the DeletedWorkspacesClient object to access its operations. + * + * @return the DeletedWorkspacesClient object. + */ + public DeletedWorkspacesClient getDeletedWorkspaces() { + return this.deletedWorkspaces; + } + + /** The ClustersClient object to access its operations. */ + private final ClustersClient clusters; + + /** + * Gets the ClustersClient object to access its operations. + * + * @return the ClustersClient object. + */ + public ClustersClient getClusters() { + return this.clusters; + } + + /** The StorageInsightConfigsClient object to access its operations. */ + private final StorageInsightConfigsClient storageInsightConfigs; + + /** + * Gets the StorageInsightConfigsClient object to access its operations. + * + * @return the StorageInsightConfigsClient object. + */ + public StorageInsightConfigsClient getStorageInsightConfigs() { + return this.storageInsightConfigs; + } + + /** The SavedSearchesClient object to access its operations. */ + private final SavedSearchesClient savedSearches; + + /** + * Gets the SavedSearchesClient object to access its operations. + * + * @return the SavedSearchesClient object. + */ + public SavedSearchesClient getSavedSearches() { + return this.savedSearches; + } + + /** The AvailableServiceTiersClient object to access its operations. */ + private final AvailableServiceTiersClient availableServiceTiers; + + /** + * Gets the AvailableServiceTiersClient object to access its operations. + * + * @return the AvailableServiceTiersClient object. + */ + public AvailableServiceTiersClient getAvailableServiceTiers() { + return this.availableServiceTiers; + } + + /** The GatewaysClient object to access its operations. */ + private final GatewaysClient gateways; + + /** + * Gets the GatewaysClient object to access its operations. + * + * @return the GatewaysClient object. + */ + public GatewaysClient getGateways() { + return this.gateways; + } + + /** The SchemasClient object to access its operations. */ + private final SchemasClient schemas; + + /** + * Gets the SchemasClient object to access its operations. + * + * @return the SchemasClient object. + */ + public SchemasClient getSchemas() { + return this.schemas; + } + + /** The WorkspacePurgesClient object to access its operations. */ + private final WorkspacePurgesClient workspacePurges; + + /** + * Gets the WorkspacePurgesClient object to access its operations. + * + * @return the WorkspacePurgesClient object. + */ + public WorkspacePurgesClient getWorkspacePurges() { + return this.workspacePurges; + } + + /** The TablesClient object to access its operations. */ + private final TablesClient tables; + + /** + * Gets the TablesClient object to access its operations. + * + * @return the TablesClient object. + */ + public TablesClient getTables() { + return this.tables; + } + + /** + * Initializes an instance of OperationalInsightsManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + OperationalInsightsManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-08-01"; + this.dataExports = new DataExportsClientImpl(this); + this.dataSources = new DataSourcesClientImpl(this); + this.intelligencePacks = new IntelligencePacksClientImpl(this); + this.linkedServices = new LinkedServicesClientImpl(this); + this.linkedStorageAccounts = new LinkedStorageAccountsClientImpl(this); + this.managementGroups = new ManagementGroupsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.operationStatuses = new OperationStatusesClientImpl(this); + this.sharedKeysOperations = new SharedKeysOperationsClientImpl(this); + this.usages = new UsagesClientImpl(this); + this.workspaces = new WorkspacesClientImpl(this); + this.deletedWorkspaces = new DeletedWorkspacesClientImpl(this); + this.clusters = new ClustersClientImpl(this); + this.storageInsightConfigs = new StorageInsightConfigsClientImpl(this); + this.savedSearches = new SavedSearchesClientImpl(this); + this.availableServiceTiers = new AvailableServiceTiersClientImpl(this); + this.gateways = new GatewaysClientImpl(this); + this.schemas = new SchemasClientImpl(this); + this.workspacePurges = new WorkspacePurgesClientImpl(this); + this.tables = new TablesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationsClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..ba1f658144a9d --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.PathParam; +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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.OperationsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.OperationInner; +import com.azure.resourcemanager.loganalytics.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.OperationalInsights/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @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); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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 the request to list solution operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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.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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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 the request to list solution operations. + */ + @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)); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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 the request to list solution operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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 the request to list solution operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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 the request to list solution operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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 the request to list solution operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 result of the request to list solution operations. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 result of the request to list solution operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + 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"; + 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)); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationsImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..c00a152761bff --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.OperationsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.OperationInner; +import com.azure.resourcemanager.loganalytics.models.Operation; +import com.azure.resourcemanager.loganalytics.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchImpl.java new file mode 100644 index 0000000000000..eef98dedcc3cb --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchInner; +import com.azure.resourcemanager.loganalytics.models.SavedSearch; +import com.azure.resourcemanager.loganalytics.models.Tag; +import java.util.Collections; +import java.util.List; + +public final class SavedSearchImpl implements SavedSearch, SavedSearch.Definition, SavedSearch.Update { + private SavedSearchInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public String category() { + return this.innerModel().category(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String query() { + return this.innerModel().query(); + } + + public String functionAlias() { + return this.innerModel().functionAlias(); + } + + public String functionParameters() { + return this.innerModel().functionParameters(); + } + + public Long version() { + return this.innerModel().version(); + } + + public List tags() { + List inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SavedSearchInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String savedSearchId; + + public SavedSearchImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public SavedSearch create() { + this.innerObject = + serviceManager + .serviceClient() + .getSavedSearches() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, savedSearchId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SavedSearch create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSavedSearches() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, savedSearchId, this.innerModel(), context) + .getValue(); + return this; + } + + public SavedSearchImpl(String name, LogAnalyticsManager serviceManager) { + this.innerObject = new SavedSearchInner(); + this.serviceManager = serviceManager; + this.savedSearchId = name; + } + + public SavedSearchImpl update() { + return this; + } + + public SavedSearch apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSavedSearches() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, savedSearchId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SavedSearch apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSavedSearches() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, savedSearchId, this.innerModel(), context) + .getValue(); + return this; + } + + public SavedSearchImpl(SavedSearchInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.savedSearchId = Utils.getValueFromIdByName(innerObject.id(), "savedSearches"); + } + + public SavedSearch refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSavedSearches() + .getWithResponse(resourceGroupName, workspaceName, savedSearchId, Context.NONE) + .getValue(); + return this; + } + + public SavedSearch refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSavedSearches() + .getWithResponse(resourceGroupName, workspaceName, savedSearchId, context) + .getValue(); + return this; + } + + public SavedSearchImpl withCategory(String category) { + this.innerModel().withCategory(category); + return this; + } + + public SavedSearchImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public SavedSearchImpl withQuery(String query) { + this.innerModel().withQuery(query); + return this; + } + + public SavedSearchImpl withTags(List tags) { + this.innerModel().withTags(tags); + return this; + } + + public SavedSearchImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public SavedSearchImpl withFunctionAlias(String functionAlias) { + this.innerModel().withFunctionAlias(functionAlias); + return this; + } + + public SavedSearchImpl withFunctionParameters(String functionParameters) { + this.innerModel().withFunctionParameters(functionParameters); + return this; + } + + public SavedSearchImpl withVersion(Long version) { + this.innerModel().withVersion(version); + return this; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesClientImpl.java new file mode 100644 index 0000000000000..eba02192ae983 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesClientImpl.java @@ -0,0 +1,775 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.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.Response; +import com.azure.core.http.rest.RestProxy; +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.loganalytics.fluent.SavedSearchesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchInner; +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchesListResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SavedSearchesClient. */ +public final class SavedSearchesClientImpl implements SavedSearchesClient { + private final ClientLogger logger = new ClientLogger(SavedSearchesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SavedSearchesService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of SavedSearchesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SavedSearchesClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(SavedSearchesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientSavedSearches to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface SavedSearchesService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/savedSearches/{savedSearchId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("savedSearchId") String savedSearchId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/savedSearches/{savedSearchId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("savedSearchId") String savedSearchId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SavedSearchInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/savedSearches/{savedSearchId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("savedSearchId") String savedSearchId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/savedSearches") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String savedSearchId) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (savedSearchId == null) { + return Mono.error(new IllegalArgumentException("Parameter savedSearchId is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + savedSearchId, + this.client.getApiVersion(), + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String savedSearchId, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (savedSearchId == null) { + return Mono.error(new IllegalArgumentException("Parameter savedSearchId is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + savedSearchId, + this.client.getApiVersion(), + context); + } + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String savedSearchId) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, savedSearchId) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 workspaceName, String savedSearchId) { + deleteAsync(resourceGroupName, workspaceName, savedSearchId).block(); + } + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, String savedSearchId, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, savedSearchId, context).block(); + } + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters Value object for saved search results. + * @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 value object for saved search results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, String savedSearchId, SavedSearchInner parameters) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (savedSearchId == null) { + return Mono.error(new IllegalArgumentException("Parameter savedSearchId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + savedSearchId, + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters Value object for saved search results. + * @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 value object for saved search results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String workspaceName, + String savedSearchId, + SavedSearchInner parameters, + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (savedSearchId == null) { + return Mono.error(new IllegalArgumentException("Parameter savedSearchId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + savedSearchId, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters Value object for saved search results. + * @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 value object for saved search results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String workspaceName, String savedSearchId, SavedSearchInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, savedSearchId, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters Value object for saved search results. + * @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 value object for saved search results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SavedSearchInner createOrUpdate( + String resourceGroupName, String workspaceName, String savedSearchId, SavedSearchInner parameters) { + return createOrUpdateAsync(resourceGroupName, workspaceName, savedSearchId, parameters).block(); + } + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters Value object for saved search results. + * @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 value object for saved search results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String workspaceName, + String savedSearchId, + SavedSearchInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, savedSearchId, parameters, context) + .block(); + } + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 specified saved search for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String savedSearchId) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (savedSearchId == null) { + return Mono.error(new IllegalArgumentException("Parameter savedSearchId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + savedSearchId, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 specified saved search for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String savedSearchId, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (savedSearchId == null) { + return Mono.error(new IllegalArgumentException("Parameter savedSearchId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + savedSearchId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 specified saved search for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String savedSearchId) { + return getWithResponseAsync(resourceGroupName, workspaceName, savedSearchId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 specified saved search for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SavedSearchInner get(String resourceGroupName, String workspaceName, String savedSearchId) { + return getAsync(resourceGroupName, workspaceName, savedSearchId).block(); + } + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 specified saved search for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String workspaceName, String savedSearchId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, savedSearchId, context).block(); + } + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 saved searches for a given Log Analytics Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceWithResponseAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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"; + return FluxUtil + .withContext( + context -> + service + .listByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 saved searches for a given Log Analytics Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceWithResponseAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 + .listByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 saved searches for a given Log Analytics Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithResponseAsync(resourceGroupName, workspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 saved searches for a given Log Analytics Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SavedSearchesListResultInner listByWorkspace(String resourceGroupName, String workspaceName) { + return listByWorkspaceAsync(resourceGroupName, workspaceName).block(); + } + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 saved searches for a given Log Analytics Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, Context context) { + return listByWorkspaceWithResponseAsync(resourceGroupName, workspaceName, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesImpl.java new file mode 100644 index 0000000000000..c39b9a46c6ae4 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesImpl.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.SavedSearchesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchInner; +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchesListResultInner; +import com.azure.resourcemanager.loganalytics.models.SavedSearch; +import com.azure.resourcemanager.loganalytics.models.SavedSearches; +import com.azure.resourcemanager.loganalytics.models.SavedSearchesListResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SavedSearchesImpl implements SavedSearches { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SavedSearchesImpl.class); + + private final SavedSearchesClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public SavedSearchesImpl(SavedSearchesClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String workspaceName, String savedSearchId) { + this.serviceClient().delete(resourceGroupName, workspaceName, savedSearchId); + } + + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, String savedSearchId, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, savedSearchId, context); + } + + public SavedSearch get(String resourceGroupName, String workspaceName, String savedSearchId) { + SavedSearchInner inner = this.serviceClient().get(resourceGroupName, workspaceName, savedSearchId); + if (inner != null) { + return new SavedSearchImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String workspaceName, String savedSearchId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, workspaceName, savedSearchId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SavedSearchImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SavedSearchesListResult listByWorkspace(String resourceGroupName, String workspaceName) { + SavedSearchesListResultInner inner = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + if (inner != null) { + return new SavedSearchesListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, Context context) { + Response inner = + this.serviceClient().listByWorkspaceWithResponse(resourceGroupName, workspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SavedSearchesListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SavedSearch getById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String savedSearchId = Utils.getValueFromIdByName(id, "savedSearches"); + if (savedSearchId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'savedSearches'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, savedSearchId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String savedSearchId = Utils.getValueFromIdByName(id, "savedSearches"); + if (savedSearchId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'savedSearches'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, savedSearchId, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String savedSearchId = Utils.getValueFromIdByName(id, "savedSearches"); + if (savedSearchId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'savedSearches'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, savedSearchId, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String savedSearchId = Utils.getValueFromIdByName(id, "savedSearches"); + if (savedSearchId == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'savedSearches'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, savedSearchId, context); + } + + private SavedSearchesClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + public SavedSearchImpl define(String name) { + return new SavedSearchImpl(name, this.manager()); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesListResultImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesListResultImpl.java new file mode 100644 index 0000000000000..12eea2a09b0e3 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SavedSearchesListResultImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchInner; +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchesListResultInner; +import com.azure.resourcemanager.loganalytics.models.SavedSearch; +import com.azure.resourcemanager.loganalytics.models.SavedSearchesListResult; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class SavedSearchesListResultImpl implements SavedSearchesListResult { + private SavedSearchesListResultInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public SavedSearchesListResultImpl(SavedSearchesListResultInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new SavedSearchImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public SavedSearchesListResultInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SchemasClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SchemasClientImpl.java new file mode 100644 index 0000000000000..a5e6cc6ce7ca3 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SchemasClientImpl.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.PathParam; +import com.azure.core.annotation.Post; +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.Response; +import com.azure.core.http.rest.RestProxy; +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.loganalytics.fluent.SchemasClient; +import com.azure.resourcemanager.loganalytics.fluent.models.SearchGetSchemaResponseInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SchemasClient. */ +public final class SchemasClientImpl implements SchemasClient { + private final ClientLogger logger = new ClientLogger(SchemasClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SchemasService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of SchemasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SchemasClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = RestProxy.create(SchemasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientSchemas to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface SchemasService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/schema") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 schema for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 schema for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 schema for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName) { + return getWithResponseAsync(resourceGroupName, workspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 schema for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SearchGetSchemaResponseInner get(String resourceGroupName, String workspaceName) { + return getAsync(resourceGroupName, workspaceName).block(); + } + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 schema for a given workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String workspaceName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SchemasImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SchemasImpl.java new file mode 100644 index 0000000000000..c24790b731846 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SchemasImpl.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.loganalytics.implementation; + +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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.SchemasClient; +import com.azure.resourcemanager.loganalytics.fluent.models.SearchGetSchemaResponseInner; +import com.azure.resourcemanager.loganalytics.models.Schemas; +import com.azure.resourcemanager.loganalytics.models.SearchGetSchemaResponse; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SchemasImpl implements Schemas { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SchemasImpl.class); + + private final SchemasClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public SchemasImpl(SchemasClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SearchGetSchemaResponse get(String resourceGroupName, String workspaceName) { + SearchGetSchemaResponseInner inner = this.serviceClient().get(resourceGroupName, workspaceName); + if (inner != null) { + return new SearchGetSchemaResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String workspaceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, workspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SearchGetSchemaResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SchemasClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SearchGetSchemaResponseImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SearchGetSchemaResponseImpl.java new file mode 100644 index 0000000000000..8568b6f46f81d --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SearchGetSchemaResponseImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.SearchGetSchemaResponseInner; +import com.azure.resourcemanager.loganalytics.models.SearchGetSchemaResponse; +import com.azure.resourcemanager.loganalytics.models.SearchMetadata; +import com.azure.resourcemanager.loganalytics.models.SearchSchemaValue; +import java.util.Collections; +import java.util.List; + +public final class SearchGetSchemaResponseImpl implements SearchGetSchemaResponse { + private SearchGetSchemaResponseInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public SearchGetSchemaResponseImpl(SearchGetSchemaResponseInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SearchMetadata metadata() { + return this.innerModel().metadata(); + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SearchGetSchemaResponseInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysImpl.java new file mode 100644 index 0000000000000..dd43f4b14b334 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.SharedKeysInner; +import com.azure.resourcemanager.loganalytics.models.SharedKeys; + +public final class SharedKeysImpl implements SharedKeys { + private SharedKeysInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public SharedKeysImpl(SharedKeysInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String primarySharedKey() { + return this.innerModel().primarySharedKey(); + } + + public String secondarySharedKey() { + return this.innerModel().secondarySharedKey(); + } + + public SharedKeysInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysOperationsClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysOperationsClientImpl.java new file mode 100644 index 0000000000000..736da36f9e6a3 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysOperationsClientImpl.java @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.PathParam; +import com.azure.core.annotation.Post; +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.Response; +import com.azure.core.http.rest.RestProxy; +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.loganalytics.fluent.SharedKeysOperationsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.SharedKeysInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SharedKeysOperationsClient. */ +public final class SharedKeysOperationsClientImpl implements SharedKeysOperationsClient { + private final ClientLogger logger = new ClientLogger(SharedKeysOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SharedKeysOperationsService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of SharedKeysOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SharedKeysOperationsClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy + .create(SharedKeysOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientSharedKeysOperations to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface SharedKeysOperationsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/sharedKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getSharedKeys( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/regenerateSharedKey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> regenerate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSharedKeysWithResponseAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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"; + return FluxUtil + .withContext( + context -> + service + .getSharedKeys( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getSharedKeysWithResponseAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 + .getSharedKeys( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getSharedKeysAsync(String resourceGroupName, String workspaceName) { + return getSharedKeysWithResponseAsync(resourceGroupName, workspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedKeysInner getSharedKeys(String resourceGroupName, String workspaceName) { + return getSharedKeysAsync(resourceGroupName, workspaceName).block(); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSharedKeysWithResponse( + String resourceGroupName, String workspaceName, Context context) { + return getSharedKeysWithResponseAsync(resourceGroupName, workspaceName, context).block(); + } + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational + * Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateWithResponseAsync( + String resourceGroupName, String workspaceName) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .regenerate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational + * Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateWithResponseAsync( + String resourceGroupName, String workspaceName, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .regenerate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational + * Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateAsync(String resourceGroupName, String workspaceName) { + return regenerateWithResponseAsync(resourceGroupName, workspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational + * Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedKeysInner regenerate(String resourceGroupName, String workspaceName) { + return regenerateAsync(resourceGroupName, workspaceName).block(); + } + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational + * Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response regenerateWithResponse( + String resourceGroupName, String workspaceName, Context context) { + return regenerateWithResponseAsync(resourceGroupName, workspaceName, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysOperationsImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysOperationsImpl.java new file mode 100644 index 0000000000000..e8bb3fccd38fe --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/SharedKeysOperationsImpl.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.SharedKeysOperationsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.SharedKeysInner; +import com.azure.resourcemanager.loganalytics.models.SharedKeys; +import com.azure.resourcemanager.loganalytics.models.SharedKeysOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SharedKeysOperationsImpl implements SharedKeysOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedKeysOperationsImpl.class); + + private final SharedKeysOperationsClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public SharedKeysOperationsImpl(SharedKeysOperationsClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SharedKeys getSharedKeys(String resourceGroupName, String workspaceName) { + SharedKeysInner inner = this.serviceClient().getSharedKeys(resourceGroupName, workspaceName); + if (inner != null) { + return new SharedKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getSharedKeysWithResponse( + String resourceGroupName, String workspaceName, Context context) { + Response inner = + this.serviceClient().getSharedKeysWithResponse(resourceGroupName, workspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SharedKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SharedKeys regenerate(String resourceGroupName, String workspaceName) { + SharedKeysInner inner = this.serviceClient().regenerate(resourceGroupName, workspaceName); + if (inner != null) { + return new SharedKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response regenerateWithResponse( + String resourceGroupName, String workspaceName, Context context) { + Response inner = + this.serviceClient().regenerateWithResponse(resourceGroupName, workspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SharedKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SharedKeysOperationsClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightConfigsClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightConfigsClientImpl.java new file mode 100644 index 0000000000000..e66719d0ad5bc --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightConfigsClientImpl.java @@ -0,0 +1,901 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.StorageInsightConfigsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.StorageInsightInner; +import com.azure.resourcemanager.loganalytics.models.StorageInsightListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in StorageInsightConfigsClient. */ +public final class StorageInsightConfigsClientImpl implements StorageInsightConfigsClient { + private final ClientLogger logger = new ClientLogger(StorageInsightConfigsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final StorageInsightConfigsService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of StorageInsightConfigsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageInsightConfigsClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy + .create(StorageInsightConfigsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientStorageInsightConfigs to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface StorageInsightConfigsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("storageInsightName") String storageInsightName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") StorageInsightInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("storageInsightName") String storageInsightName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @PathParam("storageInsightName") String storageInsightName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/storageInsightConfigs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspaceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @param parameters The top level storage insight resource container. + * @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 top level storage insight resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, String storageInsightName, StorageInsightInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (storageInsightName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageInsightName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + storageInsightName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @param parameters The top level storage insight resource container. + * @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 top level storage insight resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String workspaceName, + String storageInsightName, + StorageInsightInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (storageInsightName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageInsightName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + storageInsightName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @param parameters The top level storage insight resource container. + * @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 top level storage insight resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String workspaceName, String storageInsightName, StorageInsightInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, storageInsightName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @param parameters The top level storage insight resource container. + * @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 top level storage insight resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageInsightInner createOrUpdate( + String resourceGroupName, String workspaceName, String storageInsightName, StorageInsightInner parameters) { + return createOrUpdateAsync(resourceGroupName, workspaceName, storageInsightName, parameters).block(); + } + + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @param parameters The top level storage insight resource container. + * @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 top level storage insight resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String workspaceName, + String storageInsightName, + StorageInsightInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, workspaceName, storageInsightName, parameters, context) + .block(); + } + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs 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 a storage insight instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String storageInsightName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (storageInsightName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageInsightName 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"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + storageInsightName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 storage insight instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String storageInsightName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (storageInsightName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageInsightName 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 + .get( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + storageInsightName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs 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 a storage insight instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String workspaceName, String storageInsightName) { + return getWithResponseAsync(resourceGroupName, workspaceName, storageInsightName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs 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 a storage insight instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageInsightInner get(String resourceGroupName, String workspaceName, String storageInsightName) { + return getAsync(resourceGroupName, workspaceName, storageInsightName).block(); + } + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 storage insight instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String workspaceName, String storageInsightName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, storageInsightName, context).block(); + } + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String storageInsightName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (storageInsightName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageInsightName 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.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + storageInsightName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, String storageInsightName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (storageInsightName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageInsightName 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.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + storageInsightName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context); + } + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String storageInsightName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, storageInsightName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String storageInsightName) { + deleteAsync(resourceGroupName, workspaceName, storageInsightName).block(); + } + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, String storageInsightName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, storageInsightName, context).block(); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 storage insights operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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"; + return FluxUtil + .withContext( + context -> + service + .listByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 storage insights operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 + .listByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 storage insights operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>( + () -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 storage insights operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync( + String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>( + () -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, context), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 storage insights operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName)); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 storage insights operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list storage insights operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceNextSinglePageAsync(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.listByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 list storage insights operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceNextSinglePageAsync( + String nextLink, Context context) { + 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"; + context = this.client.mergeContext(context); + return service + .listByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().odataNextLink(), + null)); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightConfigsImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightConfigsImpl.java new file mode 100644 index 0000000000000..fd7d4991897f6 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightConfigsImpl.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.StorageInsightConfigsClient; +import com.azure.resourcemanager.loganalytics.fluent.models.StorageInsightInner; +import com.azure.resourcemanager.loganalytics.models.StorageInsight; +import com.azure.resourcemanager.loganalytics.models.StorageInsightConfigs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class StorageInsightConfigsImpl implements StorageInsightConfigs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageInsightConfigsImpl.class); + + private final StorageInsightConfigsClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public StorageInsightConfigsImpl(StorageInsightConfigsClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public StorageInsight get(String resourceGroupName, String workspaceName, String storageInsightName) { + StorageInsightInner inner = this.serviceClient().get(resourceGroupName, workspaceName, storageInsightName); + if (inner != null) { + return new StorageInsightImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String workspaceName, String storageInsightName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, workspaceName, storageInsightName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new StorageInsightImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String workspaceName, String storageInsightName) { + this.serviceClient().delete(resourceGroupName, workspaceName, storageInsightName); + } + + public Response deleteWithResponse( + String resourceGroupName, String workspaceName, String storageInsightName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, storageInsightName, context); + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + return inner.mapPage(inner1 -> new StorageInsightImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context); + return inner.mapPage(inner1 -> new StorageInsightImpl(inner1, this.manager())); + } + + public StorageInsight getById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String storageInsightName = Utils.getValueFromIdByName(id, "storageInsightConfigs"); + if (storageInsightName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storageInsightConfigs'.", + id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, storageInsightName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String storageInsightName = Utils.getValueFromIdByName(id, "storageInsightConfigs"); + if (storageInsightName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storageInsightConfigs'.", + id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, storageInsightName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String storageInsightName = Utils.getValueFromIdByName(id, "storageInsightConfigs"); + if (storageInsightName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storageInsightConfigs'.", + id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, storageInsightName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String storageInsightName = Utils.getValueFromIdByName(id, "storageInsightConfigs"); + if (storageInsightName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'storageInsightConfigs'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, storageInsightName, context); + } + + private StorageInsightConfigsClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + public StorageInsightImpl define(String name) { + return new StorageInsightImpl(name, this.manager()); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightImpl.java new file mode 100644 index 0000000000000..b18635dade9cc --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/StorageInsightImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.StorageInsightInner; +import com.azure.resourcemanager.loganalytics.models.StorageAccount; +import com.azure.resourcemanager.loganalytics.models.StorageInsight; +import com.azure.resourcemanager.loganalytics.models.StorageInsightStatus; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class StorageInsightImpl implements StorageInsight, StorageInsight.Definition, StorageInsight.Update { + private StorageInsightInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public List containers() { + List inner = this.innerModel().containers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List tables() { + List inner = this.innerModel().tables(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public StorageAccount storageAccount() { + return this.innerModel().storageAccount(); + } + + public StorageInsightStatus status() { + return this.innerModel().status(); + } + + public StorageInsightInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String storageInsightName; + + public StorageInsightImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public StorageInsight create() { + this.innerObject = + serviceManager + .serviceClient() + .getStorageInsightConfigs() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, storageInsightName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public StorageInsight create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getStorageInsightConfigs() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, storageInsightName, this.innerModel(), context) + .getValue(); + return this; + } + + public StorageInsightImpl(String name, LogAnalyticsManager serviceManager) { + this.innerObject = new StorageInsightInner(); + this.serviceManager = serviceManager; + this.storageInsightName = name; + } + + public StorageInsightImpl update() { + return this; + } + + public StorageInsight apply() { + this.innerObject = + serviceManager + .serviceClient() + .getStorageInsightConfigs() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, storageInsightName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public StorageInsight apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getStorageInsightConfigs() + .createOrUpdateWithResponse( + resourceGroupName, workspaceName, storageInsightName, this.innerModel(), context) + .getValue(); + return this; + } + + public StorageInsightImpl(StorageInsightInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.storageInsightName = Utils.getValueFromIdByName(innerObject.id(), "storageInsightConfigs"); + } + + public StorageInsight refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getStorageInsightConfigs() + .getWithResponse(resourceGroupName, workspaceName, storageInsightName, Context.NONE) + .getValue(); + return this; + } + + public StorageInsight refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getStorageInsightConfigs() + .getWithResponse(resourceGroupName, workspaceName, storageInsightName, context) + .getValue(); + return this; + } + + public StorageInsightImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public StorageInsightImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public StorageInsightImpl withContainers(List containers) { + this.innerModel().withContainers(containers); + return this; + } + + public StorageInsightImpl withTables(List tables) { + this.innerModel().withTables(tables); + return this; + } + + public StorageInsightImpl withStorageAccount(StorageAccount storageAccount) { + this.innerModel().withStorageAccount(storageAccount); + return this; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TableImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TableImpl.java new file mode 100644 index 0000000000000..7c824f9b29110 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TableImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.TableInner; +import com.azure.resourcemanager.loganalytics.models.Table; + +public final class TableImpl implements Table { + private TableInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public TableImpl(TableInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer retentionInDays() { + return this.innerModel().retentionInDays(); + } + + public TableInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TablesClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TablesClientImpl.java new file mode 100644 index 0000000000000..87c194b949b09 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TablesClientImpl.java @@ -0,0 +1,618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.annotation.BodyParam; +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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.TablesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.TableInner; +import com.azure.resourcemanager.loganalytics.models.TablesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TablesClient. */ +public final class TablesClientImpl implements TablesClient { + private final ClientLogger logger = new ClientLogger(TablesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TablesService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of TablesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TablesClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = RestProxy.create(TablesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientTables to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface TablesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/tables") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/tables/{tableName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("tableName") String tableName, + @BodyParam("application/json") TableInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/tables/{tableName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("tableName") String tableName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all the tables for the specified Log Analytics workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByWorkspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all the tables for the specified Log Analytics workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByWorkspace( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all the tables for the specified Log Analytics workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all the tables for the specified Log Analytics workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync( + String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all the tables for the specified Log Analytics workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all the tables for the specified Log Analytics workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param parameters Workspace data table definition. + * @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 workspace data table definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String workspaceName, String tableName, TableInner parameters) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + tableName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param parameters Workspace data table definition. + * @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 workspace data table definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String workspaceName, String tableName, TableInner parameters, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + tableName, + parameters, + accept, + context); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param parameters Workspace data table definition. + * @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 workspace data table definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String workspaceName, String tableName, TableInner parameters) { + return updateWithResponseAsync(resourceGroupName, workspaceName, tableName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param parameters Workspace data table definition. + * @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 workspace data table definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TableInner update(String resourceGroupName, String workspaceName, String tableName, TableInner parameters) { + return updateAsync(resourceGroupName, workspaceName, tableName, parameters).block(); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param parameters Workspace data table definition. + * @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 workspace data table definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String workspaceName, String tableName, TableInner parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, workspaceName, tableName, parameters, context).block(); + } + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 Log Analytics workspace table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String tableName) { + 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + tableName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 Log Analytics workspace table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String workspaceName, String tableName, 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + tableName, + accept, + context); + } + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 Log Analytics workspace table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String tableName) { + return getWithResponseAsync(resourceGroupName, workspaceName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 Log Analytics workspace table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TableInner get(String resourceGroupName, String workspaceName, String tableName) { + return getAsync(resourceGroupName, workspaceName, tableName).block(); + } + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 Log Analytics workspace table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String workspaceName, String tableName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, tableName, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TablesImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TablesImpl.java new file mode 100644 index 0000000000000..23b880a3364e4 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/TablesImpl.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.TablesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.TableInner; +import com.azure.resourcemanager.loganalytics.models.Table; +import com.azure.resourcemanager.loganalytics.models.Tables; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TablesImpl implements Tables { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TablesImpl.class); + + private final TablesClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public TablesImpl(TablesClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + return inner.mapPage(inner1 -> new TableImpl(inner1, this.manager())); + } + + public PagedIterable
listByWorkspace(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context); + return inner.mapPage(inner1 -> new TableImpl(inner1, this.manager())); + } + + public Table update(String resourceGroupName, String workspaceName, String tableName, TableInner parameters) { + TableInner inner = this.serviceClient().update(resourceGroupName, workspaceName, tableName, parameters); + if (inner != null) { + return new TableImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response
updateWithResponse( + String resourceGroupName, String workspaceName, String tableName, TableInner parameters, Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, workspaceName, tableName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TableImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Table get(String resourceGroupName, String workspaceName, String tableName) { + TableInner inner = this.serviceClient().get(resourceGroupName, workspaceName, tableName); + if (inner != null) { + return new TableImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response
getWithResponse( + String resourceGroupName, String workspaceName, String tableName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, workspaceName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TableImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private TablesClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsageMetricImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsageMetricImpl.java new file mode 100644 index 0000000000000..a71459ea40d84 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsageMetricImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.UsageMetricInner; +import com.azure.resourcemanager.loganalytics.models.MetricName; +import com.azure.resourcemanager.loganalytics.models.UsageMetric; +import java.time.OffsetDateTime; + +public final class UsageMetricImpl implements UsageMetric { + private UsageMetricInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public UsageMetricImpl(UsageMetricInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public MetricName name() { + return this.innerModel().name(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public Double currentValue() { + return this.innerModel().currentValue(); + } + + public Double limit() { + return this.innerModel().limit(); + } + + public OffsetDateTime nextResetTime() { + return this.innerModel().nextResetTime(); + } + + public String quotaPeriod() { + return this.innerModel().quotaPeriod(); + } + + public UsageMetricInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsagesClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsagesClientImpl.java new file mode 100644 index 0000000000000..dce15f1372646 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsagesClientImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.PathParam; +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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.UsagesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.UsageMetricInner; +import com.azure.resourcemanager.loganalytics.models.WorkspaceListUsagesResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in UsagesClient. */ +public final class UsagesClientImpl implements UsagesClient { + private final ClientLogger logger = new ClientLogger(UsagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final UsagesService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of UsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UsagesClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = RestProxy.create(UsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientUsages to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface UsagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 usage metrics for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 usage metrics for a workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 usage metrics for a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 usage metrics for a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 usage metrics for a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 usage metrics for a workspace. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, context)); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsagesImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsagesImpl.java new file mode 100644 index 0000000000000..427bdeb9fb007 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/UsagesImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.UsagesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.UsageMetricInner; +import com.azure.resourcemanager.loganalytics.models.UsageMetric; +import com.azure.resourcemanager.loganalytics.models.Usages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class UsagesImpl implements Usages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsagesImpl.class); + + private final UsagesClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public UsagesImpl(UsagesClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return inner.mapPage(inner1 -> new UsageMetricImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName, context); + return inner.mapPage(inner1 -> new UsageMetricImpl(inner1, this.manager())); + } + + private UsagesClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/Utils.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/Utils.java new file mode 100644 index 0000000000000..a261431f8d887 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/Utils.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import java.util.Arrays; +import java.util.Iterator; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspaceImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspaceImpl.java new file mode 100644 index 0000000000000..c8292bb3b1ed8 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspaceImpl.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.loganalytics.models.PrivateLinkScopedResource; +import com.azure.resourcemanager.loganalytics.models.PublicNetworkAccessType; +import com.azure.resourcemanager.loganalytics.models.Workspace; +import com.azure.resourcemanager.loganalytics.models.WorkspaceCapping; +import com.azure.resourcemanager.loganalytics.models.WorkspaceEntityStatus; +import com.azure.resourcemanager.loganalytics.models.WorkspacePatch; +import com.azure.resourcemanager.loganalytics.models.WorkspaceSku; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class WorkspaceImpl implements Workspace, Workspace.Definition, Workspace.Update { + private WorkspaceInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public WorkspaceEntityStatus provisioningState() { + return this.innerModel().provisioningState(); + } + + public String customerId() { + return this.innerModel().customerId(); + } + + public WorkspaceSku sku() { + return this.innerModel().sku(); + } + + public Integer retentionInDays() { + return this.innerModel().retentionInDays(); + } + + public WorkspaceCapping workspaceCapping() { + return this.innerModel().workspaceCapping(); + } + + public PublicNetworkAccessType publicNetworkAccessForIngestion() { + return this.innerModel().publicNetworkAccessForIngestion(); + } + + public PublicNetworkAccessType publicNetworkAccessForQuery() { + return this.innerModel().publicNetworkAccessForQuery(); + } + + public List privateLinkScopedResources() { + List inner = this.innerModel().privateLinkScopedResources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public WorkspaceInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private WorkspacePatch updateParameters; + + public WorkspaceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Workspace create() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .createOrUpdate(resourceGroupName, workspaceName, this.innerModel(), Context.NONE); + return this; + } + + public Workspace create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .createOrUpdate(resourceGroupName, workspaceName, this.innerModel(), context); + return this; + } + + public WorkspaceImpl(String name, LogAnalyticsManager serviceManager) { + this.innerObject = new WorkspaceInner(); + this.serviceManager = serviceManager; + this.workspaceName = name; + } + + public WorkspaceImpl update() { + this.updateParameters = new WorkspacePatch(); + return this; + } + + public Workspace apply() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .updateWithResponse(resourceGroupName, workspaceName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public Workspace apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .updateWithResponse(resourceGroupName, workspaceName, updateParameters, context) + .getValue(); + return this; + } + + public WorkspaceImpl(WorkspaceInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + } + + public Workspace refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, workspaceName, Context.NONE) + .getValue(); + return this; + } + + public Workspace refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, workspaceName, context) + .getValue(); + return this; + } + + public WorkspaceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public WorkspaceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public WorkspaceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public WorkspaceImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public WorkspaceImpl withProvisioningState(WorkspaceEntityStatus provisioningState) { + if (isInCreateMode()) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } else { + this.updateParameters.withProvisioningState(provisioningState); + return this; + } + } + + public WorkspaceImpl withSku(WorkspaceSku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public WorkspaceImpl withRetentionInDays(Integer retentionInDays) { + if (isInCreateMode()) { + this.innerModel().withRetentionInDays(retentionInDays); + return this; + } else { + this.updateParameters.withRetentionInDays(retentionInDays); + return this; + } + } + + public WorkspaceImpl withWorkspaceCapping(WorkspaceCapping workspaceCapping) { + if (isInCreateMode()) { + this.innerModel().withWorkspaceCapping(workspaceCapping); + return this; + } else { + this.updateParameters.withWorkspaceCapping(workspaceCapping); + return this; + } + } + + public WorkspaceImpl withPublicNetworkAccessForIngestion(PublicNetworkAccessType publicNetworkAccessForIngestion) { + if (isInCreateMode()) { + this.innerModel().withPublicNetworkAccessForIngestion(publicNetworkAccessForIngestion); + return this; + } else { + this.updateParameters.withPublicNetworkAccessForIngestion(publicNetworkAccessForIngestion); + return this; + } + } + + public WorkspaceImpl withPublicNetworkAccessForQuery(PublicNetworkAccessType publicNetworkAccessForQuery) { + if (isInCreateMode()) { + this.innerModel().withPublicNetworkAccessForQuery(publicNetworkAccessForQuery); + return this; + } else { + this.updateParameters.withPublicNetworkAccessForQuery(publicNetworkAccessForQuery); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgeResponseImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgeResponseImpl.java new file mode 100644 index 0000000000000..109479a01ac57 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgeResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeResponseInner; +import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeResponse; + +public final class WorkspacePurgeResponseImpl implements WorkspacePurgeResponse { + private WorkspacePurgeResponseInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public WorkspacePurgeResponseImpl(WorkspacePurgeResponseInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String operationId() { + return this.innerModel().operationId(); + } + + public WorkspacePurgeResponseInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgeStatusResponseImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgeStatusResponseImpl.java new file mode 100644 index 0000000000000..6fa6b91000ab4 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgeStatusResponseImpl.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.resourcemanager.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeStatusResponseInner; +import com.azure.resourcemanager.loganalytics.models.PurgeState; +import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeStatusResponse; + +public final class WorkspacePurgeStatusResponseImpl implements WorkspacePurgeStatusResponse { + private WorkspacePurgeStatusResponseInner innerObject; + + private final LogAnalyticsManager serviceManager; + + public WorkspacePurgeStatusResponseImpl( + WorkspacePurgeStatusResponseInner innerObject, LogAnalyticsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public PurgeState status() { + return this.innerModel().status(); + } + + public WorkspacePurgeStatusResponseInner innerModel() { + return this.innerObject; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgesClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgesClientImpl.java new file mode 100644 index 0000000000000..86dcc50c3d60f --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgesClientImpl.java @@ -0,0 +1,450 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +import com.azure.core.annotation.BodyParam; +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.PathParam; +import com.azure.core.annotation.Post; +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.Response; +import com.azure.core.http.rest.RestProxy; +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.loganalytics.fluent.WorkspacePurgesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeResponseInner; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeStatusResponseInner; +import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeBody; +import com.azure.resourcemanager.loganalytics.models.WorkspacePurgesPurgeResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WorkspacePurgesClient. */ +public final class WorkspacePurgesClientImpl implements WorkspacePurgesClient { + private final ClientLogger logger = new ClientLogger(WorkspacePurgesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final WorkspacePurgesService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of WorkspacePurgesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspacePurgesClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(WorkspacePurgesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientWorkspacePurges to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface WorkspacePurgesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/purge") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono purge( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @BodyParam("application/json") WorkspacePurgeBody body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}/operations/{purgeId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getPurgeStatus( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @PathParam("purgeId") String purgeId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + * + *

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch + * the execution of purge requests by sending a single command whose predicate includes all user identities that + * require purging. Use the in operator to specify multiple identities. You should run the query prior to using for + * a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a purge request for an App Insights Workspace. + * @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 containing operationId for a specific purge action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono purgeWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspacePurgeBody body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 + .purge( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + * + *

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch + * the execution of purge requests by sending a single command whose predicate includes all user identities that + * require purging. Use the in operator to specify multiple identities. You should run the query prior to using for + * a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a purge request for an App Insights Workspace. + * @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 containing operationId for a specific purge action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono purgeWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspacePurgeBody body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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"; + context = this.client.mergeContext(context); + return service + .purge( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + body, + accept, + context); + } + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + * + *

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch + * the execution of purge requests by sending a single command whose predicate includes all user identities that + * require purging. Use the in operator to specify multiple identities. You should run the query prior to using for + * a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a purge request for an App Insights Workspace. + * @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 containing operationId for a specific purge action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono purgeAsync( + String resourceGroupName, String workspaceName, WorkspacePurgeBody body) { + return purgeWithResponseAsync(resourceGroupName, workspaceName, body) + .flatMap( + (WorkspacePurgesPurgeResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + * + *

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch + * the execution of purge requests by sending a single command whose predicate includes all user identities that + * require purging. Use the in operator to specify multiple identities. You should run the query prior to using for + * a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a purge request for an App Insights Workspace. + * @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 containing operationId for a specific purge action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspacePurgeResponseInner purge(String resourceGroupName, String workspaceName, WorkspacePurgeBody body) { + return purgeAsync(resourceGroupName, workspaceName, body).block(); + } + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + * + *

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch + * the execution of purge requests by sending a single command whose predicate includes all user identities that + * require purging. Use the in operator to specify multiple identities. You should run the query prior to using for + * a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a purge request for an App Insights Workspace. + * @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 containing operationId for a specific purge action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response purgeWithResponse( + String resourceGroupName, String workspaceName, WorkspacePurgeBody body, Context context) { + return purgeWithResponseAsync(resourceGroupName, workspaceName, body, context).block(); + } + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is 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 status of an ongoing purge operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPurgeStatusWithResponseAsync( + String resourceGroupName, String workspaceName, String purgeId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (purgeId == null) { + return Mono.error(new IllegalArgumentException("Parameter purgeId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getPurgeStatus( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + purgeId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @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 status of an ongoing purge operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPurgeStatusWithResponseAsync( + String resourceGroupName, String workspaceName, String purgeId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (purgeId == null) { + return Mono.error(new IllegalArgumentException("Parameter purgeId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getPurgeStatus( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + purgeId, + accept, + context); + } + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is 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 status of an ongoing purge operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getPurgeStatusAsync( + String resourceGroupName, String workspaceName, String purgeId) { + return getPurgeStatusWithResponseAsync(resourceGroupName, workspaceName, purgeId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is 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 status of an ongoing purge operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspacePurgeStatusResponseInner getPurgeStatus( + String resourceGroupName, String workspaceName, String purgeId) { + return getPurgeStatusAsync(resourceGroupName, workspaceName, purgeId).block(); + } + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @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 status of an ongoing purge operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPurgeStatusWithResponse( + String resourceGroupName, String workspaceName, String purgeId, Context context) { + return getPurgeStatusWithResponseAsync(resourceGroupName, workspaceName, purgeId, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgesImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgesImpl.java new file mode 100644 index 0000000000000..d772ad96f4062 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacePurgesImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.implementation; + +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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.WorkspacePurgesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeResponseInner; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeStatusResponseInner; +import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeBody; +import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeResponse; +import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeStatusResponse; +import com.azure.resourcemanager.loganalytics.models.WorkspacePurges; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class WorkspacePurgesImpl implements WorkspacePurges { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacePurgesImpl.class); + + private final WorkspacePurgesClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public WorkspacePurgesImpl(WorkspacePurgesClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public WorkspacePurgeResponse purge(String resourceGroupName, String workspaceName, WorkspacePurgeBody body) { + WorkspacePurgeResponseInner inner = this.serviceClient().purge(resourceGroupName, workspaceName, body); + if (inner != null) { + return new WorkspacePurgeResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response purgeWithResponse( + String resourceGroupName, String workspaceName, WorkspacePurgeBody body, Context context) { + Response inner = + this.serviceClient().purgeWithResponse(resourceGroupName, workspaceName, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkspacePurgeResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkspacePurgeStatusResponse getPurgeStatus(String resourceGroupName, String workspaceName, String purgeId) { + WorkspacePurgeStatusResponseInner inner = + this.serviceClient().getPurgeStatus(resourceGroupName, workspaceName, purgeId); + if (inner != null) { + return new WorkspacePurgeStatusResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getPurgeStatusWithResponse( + String resourceGroupName, String workspaceName, String purgeId, Context context) { + Response inner = + this.serviceClient().getPurgeStatusWithResponse(resourceGroupName, workspaceName, purgeId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkspacePurgeStatusResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private WorkspacePurgesClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacesClientImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacesClientImpl.java new file mode 100644 index 0000000000000..b38ee67ae4aca --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacesClientImpl.java @@ -0,0 +1,1322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.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.loganalytics.fluent.WorkspacesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.loganalytics.models.WorkspaceListResult; +import com.azure.resourcemanager.loganalytics.models.WorkspacePatch; +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 WorkspacesClient. */ +public final class WorkspacesClientImpl implements WorkspacesClient { + private final ClientLogger logger = new ClientLogger(WorkspacesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final WorkspacesService service; + + /** The service client containing this operation class. */ + private final OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of WorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspacesClientImpl(OperationalInsightsManagementClientImpl client) { + this.service = + RestProxy.create(WorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationalInsightsManagementClientWorkspaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "OperationalInsightsM") + private interface WorkspacesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @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.OperationalInsights" + + "/workspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") WorkspaceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("force") Boolean force, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights" + + "/workspaces/{workspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") WorkspacePatch parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the workspaces in a subscription. + * + * @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 workspaces in a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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"; + return FluxUtil + .withContext( + context -> + 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(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the workspaces in a 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 the workspaces in a subscription. + */ + @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(), null, null)); + } + + /** + * Gets the workspaces in a subscription. + * + * @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 workspaces in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Gets the workspaces in a 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 the workspaces in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Gets the workspaces in a subscription. + * + * @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 workspaces in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the workspaces in a 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 the workspaces in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 workspaces in a resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets workspaces in a 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 workspaces in a resource group. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 workspaces in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * Gets workspaces in a 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 workspaces in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 workspaces in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets workspaces in a 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 workspaces in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspaceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, WorkspaceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), WorkspaceInner.class, WorkspaceInner.class, Context.NONE); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, WorkspaceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String workspaceName, WorkspaceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), WorkspaceInner.class, WorkspaceInner.class, context); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, WorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, parameters).getSyncPoller(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, WorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, String workspaceName, WorkspaceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, parameters, context).getSyncPoller(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String workspaceName, WorkspaceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner createOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return createOrUpdateAsync(resourceGroupName, workspaceName, parameters).block(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner createOrUpdate( + String resourceGroupName, String workspaceName, WorkspaceInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, workspaceName, parameters, context).block(); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, Boolean force) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + force, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, Boolean force, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + force, + context); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String workspaceName, Boolean force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, workspaceName, force); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String workspaceName, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, workspaceName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String workspaceName, Boolean force) { + return beginDeleteAsync(resourceGroupName, workspaceName, force).getSyncPoller(); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String workspaceName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, workspaceName, force, context).getSyncPoller(); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, Boolean force) { + return beginDeleteAsync(resourceGroupName, workspaceName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, workspaceName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, workspaceName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 workspaceName, Boolean force) { + deleteAsync(resourceGroupName, workspaceName, force).block(); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspaceName) { + final Boolean force = null; + deleteAsync(resourceGroupName, workspaceName, force).block(); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 workspaceName, Boolean force, Context context) { + deleteAsync(resourceGroupName, workspaceName, force, context).block(); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String workspaceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, workspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner getByResourceGroup(String resourceGroupName, String workspaceName) { + return getByResourceGroupAsync(resourceGroupName, workspaceName).block(); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, workspaceName, context).block(); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspacePatch parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspacePatch parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + workspaceName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String workspaceName, WorkspacePatch parameters) { + return updateWithResponseAsync(resourceGroupName, workspaceName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner update(String resourceGroupName, String workspaceName, WorkspacePatch parameters) { + return updateAsync(resourceGroupName, workspaceName, parameters).block(); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The top level Workspace resource container. + * @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 top level Workspace resource container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String workspaceName, WorkspacePatch parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, workspaceName, parameters, context).block(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacesImpl.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacesImpl.java new file mode 100644 index 0000000000000..17c45bab455c4 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/WorkspacesImpl.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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.loganalytics.LogAnalyticsManager; +import com.azure.resourcemanager.loganalytics.fluent.WorkspacesClient; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.loganalytics.models.Workspace; +import com.azure.resourcemanager.loganalytics.models.Workspaces; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class WorkspacesImpl implements Workspaces { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacesImpl.class); + + private final WorkspacesClient innerClient; + + private final LogAnalyticsManager serviceManager; + + public WorkspacesImpl(WorkspacesClient innerClient, LogAnalyticsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public void delete(String resourceGroupName, String workspaceName, Boolean force) { + this.serviceClient().delete(resourceGroupName, workspaceName, force); + } + + public void delete(String resourceGroupName, String workspaceName) { + this.serviceClient().delete(resourceGroupName, workspaceName); + } + + public void delete(String resourceGroupName, String workspaceName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, workspaceName, force, context); + } + + public Workspace getByResourceGroup(String resourceGroupName, String workspaceName) { + WorkspaceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, workspaceName); + if (inner != null) { + return new WorkspaceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, workspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkspaceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Workspace getById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, workspaceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, workspaceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + Boolean localForce = null; + this.delete(resourceGroupName, workspaceName, localForce, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Boolean force, Context context) { + String resourceGroupName = Utils.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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + this.delete(resourceGroupName, workspaceName, force, context); + } + + private WorkspacesClient serviceClient() { + return this.innerClient; + } + + private LogAnalyticsManager manager() { + return this.serviceManager; + } + + public WorkspaceImpl define(String name) { + return new WorkspaceImpl(name, this.manager()); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/package-info.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/package-info.java new file mode 100644 index 0000000000000..bfbdd01d85460 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for OperationalInsightsManagementClient. Operational Insights Client. */ +package com.azure.resourcemanager.loganalytics.implementation; diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AvailableServiceTier.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AvailableServiceTier.java new file mode 100644 index 0000000000000..4fb56c83e160b --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AvailableServiceTier.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.AvailableServiceTierInner; + +/** An immutable client-side representation of AvailableServiceTier. */ +public interface AvailableServiceTier { + /** + * Gets the serviceTier property: The name of the Service Tier. + * + * @return the serviceTier value. + */ + SkuNameEnum serviceTier(); + + /** + * Gets the enabled property: True if the Service Tier is enabled for the workspace. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the minimumRetention property: The minimum retention for the Service Tier, in days. + * + * @return the minimumRetention value. + */ + Long minimumRetention(); + + /** + * Gets the maximumRetention property: The maximum retention for the Service Tier, in days. + * + * @return the maximumRetention value. + */ + Long maximumRetention(); + + /** + * Gets the defaultRetention property: The default retention for the Service Tier, in days. + * + * @return the defaultRetention value. + */ + Long defaultRetention(); + + /** + * Gets the capacityReservationLevel property: The capacity reservation level in GB per day. Returned for the + * Capacity Reservation Service Tier. + * + * @return the capacityReservationLevel value. + */ + Long capacityReservationLevel(); + + /** + * Gets the lastSkuUpdate property: Time when the sku was last updated for the workspace. Returned for the Capacity + * Reservation Service Tier. + * + * @return the lastSkuUpdate value. + */ + String lastSkuUpdate(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.AvailableServiceTierInner object. + * + * @return the inner object. + */ + AvailableServiceTierInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AvailableServiceTiers.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AvailableServiceTiers.java new file mode 100644 index 0000000000000..6ff50322465ce --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AvailableServiceTiers.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of AvailableServiceTiers. */ +public interface AvailableServiceTiers { + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 available service tiers for the workspace. + */ + List listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 available service tiers for the workspace. + */ + Response> listByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AzureEntityResource.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AzureEntityResource.java new file mode 100644 index 0000000000000..19249bec3ddd3 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/AzureEntityResource.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource model definition for an Azure Resource Manager resource with an etag. */ +@Immutable +public class AzureEntityResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureEntityResource.class); + + /* + * Resource Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the etag property: Resource Etag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Cluster.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Cluster.java new file mode 100644 index 0000000000000..6cd5fe9911757 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Cluster.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.ClusterInner; +import java.util.Map; + +/** An immutable client-side representation of Cluster. */ +public interface Cluster { + /** + * 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 location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The identity of the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the sku property: The sku properties. + * + * @return the sku value. + */ + ClusterSku sku(); + + /** + * Gets the nextLink property: The link used to get the next page of recommendations. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the clusterId property: The ID associated with the cluster. + * + * @return the clusterId value. + */ + String clusterId(); + + /** + * Gets the provisioningState property: The provisioning state of the cluster. + * + * @return the provisioningState value. + */ + ClusterEntityStatus provisioningState(); + + /** + * Gets the keyVaultProperties property: The associated key properties. + * + * @return the keyVaultProperties value. + */ + KeyVaultProperties keyVaultProperties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.ClusterInner object. + * + * @return the inner object. + */ + ClusterInner innerModel(); + + /** The entirety of the Cluster definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Cluster definition stages. */ + interface DefinitionStages { + /** The first stage of the Cluster definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Cluster definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Cluster definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Cluster 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.WithIdentity, + DefinitionStages.WithSku, + DefinitionStages.WithNextLink, + DefinitionStages.WithKeyVaultProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Cluster create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Cluster create(Context context); + } + /** The stage of the Cluster definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Cluster definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + /** The stage of the Cluster definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The sku properties.. + * + * @param sku The sku properties. + * @return the next definition stage. + */ + WithCreate withSku(ClusterSku sku); + } + /** The stage of the Cluster definition allowing to specify nextLink. */ + interface WithNextLink { + /** + * Specifies the nextLink property: The link used to get the next page of recommendations.. + * + * @param nextLink The link used to get the next page of recommendations. + * @return the next definition stage. + */ + WithCreate withNextLink(String nextLink); + } + /** The stage of the Cluster definition allowing to specify keyVaultProperties. */ + interface WithKeyVaultProperties { + /** + * Specifies the keyVaultProperties property: The associated key properties.. + * + * @param keyVaultProperties The associated key properties. + * @return the next definition stage. + */ + WithCreate withKeyVaultProperties(KeyVaultProperties keyVaultProperties); + } + } + /** + * Begins update for the Cluster resource. + * + * @return the stage of resource update. + */ + Cluster.Update update(); + + /** The template for Cluster update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku, UpdateStages.WithKeyVaultProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Cluster apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Cluster apply(Context context); + } + /** The Cluster update stages. */ + interface UpdateStages { + /** The stage of the Cluster update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Cluster update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The sku properties.. + * + * @param sku The sku properties. + * @return the next definition stage. + */ + Update withSku(ClusterSku sku); + } + /** The stage of the Cluster update allowing to specify keyVaultProperties. */ + interface WithKeyVaultProperties { + /** + * Specifies the keyVaultProperties property: The associated key properties.. + * + * @param keyVaultProperties The associated key properties. + * @return the next definition stage. + */ + Update withKeyVaultProperties(KeyVaultProperties keyVaultProperties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Cluster refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Cluster refresh(Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterEntityStatus.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterEntityStatus.java new file mode 100644 index 0000000000000..c7a242109ca4d --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterEntityStatus.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ClusterEntityStatus. */ +public final class ClusterEntityStatus extends ExpandableStringEnum { + /** Static value Creating for ClusterEntityStatus. */ + public static final ClusterEntityStatus CREATING = fromString("Creating"); + + /** Static value Succeeded for ClusterEntityStatus. */ + public static final ClusterEntityStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ClusterEntityStatus. */ + public static final ClusterEntityStatus FAILED = fromString("Failed"); + + /** Static value Canceled for ClusterEntityStatus. */ + public static final ClusterEntityStatus CANCELED = fromString("Canceled"); + + /** Static value Deleting for ClusterEntityStatus. */ + public static final ClusterEntityStatus DELETING = fromString("Deleting"); + + /** Static value ProvisioningAccount for ClusterEntityStatus. */ + public static final ClusterEntityStatus PROVISIONING_ACCOUNT = fromString("ProvisioningAccount"); + + /** Static value Updating for ClusterEntityStatus. */ + public static final ClusterEntityStatus UPDATING = fromString("Updating"); + + /** + * Creates or finds a ClusterEntityStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ClusterEntityStatus. + */ + @JsonCreator + public static ClusterEntityStatus fromString(String name) { + return fromString(name, ClusterEntityStatus.class); + } + + /** @return known ClusterEntityStatus values. */ + public static Collection values() { + return values(ClusterEntityStatus.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterListResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterListResult.java new file mode 100644 index 0000000000000..14b2d8b6e02f7 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.ClusterInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list clusters operation response. */ +@Fluent +public final class ClusterListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterListResult.class); + + /* + * The link used to get the next page of recommendations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * A list of Log Analytics clusters. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the nextLink property: The link used to get the next page of recommendations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of recommendations. + * + * @param nextLink the nextLink value to set. + * @return the ClusterListResult object itself. + */ + public ClusterListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: A list of Log Analytics clusters. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of Log Analytics clusters. + * + * @param value the value value to set. + * @return the ClusterListResult object itself. + */ + public ClusterListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterPatch.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterPatch.java new file mode 100644 index 0000000000000..34be5ae9d38f6 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterPatch.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The top level Log Analytics cluster resource container. */ +@JsonFlatten +@Fluent +public class ClusterPatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterPatch.class); + + /* + * The sku properties. + */ + @JsonProperty(value = "sku") + private ClusterSku sku; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The associated key properties. + */ + @JsonProperty(value = "properties.keyVaultProperties") + private KeyVaultProperties keyVaultProperties; + + /** + * Get the sku property: The sku properties. + * + * @return the sku value. + */ + public ClusterSku sku() { + return this.sku; + } + + /** + * Set the sku property: The sku properties. + * + * @param sku the sku value to set. + * @return the ClusterPatch object itself. + */ + public ClusterPatch withSku(ClusterSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ClusterPatch object itself. + */ + public ClusterPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the keyVaultProperties property: The associated key properties. + * + * @return the keyVaultProperties value. + */ + public KeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the keyVaultProperties property: The associated key properties. + * + * @param keyVaultProperties the keyVaultProperties value to set. + * @return the ClusterPatch object itself. + */ + public ClusterPatch withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (keyVaultProperties() != null) { + keyVaultProperties().validate(); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterSku.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterSku.java new file mode 100644 index 0000000000000..1b2fb5bcba651 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterSku.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The cluster sku definition. */ +@Fluent +public final class ClusterSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterSku.class); + + /* + * The capacity value + */ + @JsonProperty(value = "capacity") + private Long capacity; + + /* + * The name of the SKU. + */ + @JsonProperty(value = "name") + private ClusterSkuNameEnum name; + + /** + * Get the capacity property: The capacity value. + * + * @return the capacity value. + */ + public Long capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The capacity value. + * + * @param capacity the capacity value to set. + * @return the ClusterSku object itself. + */ + public ClusterSku withCapacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the name property: The name of the SKU. + * + * @return the name value. + */ + public ClusterSkuNameEnum name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. + * + * @param name the name value to set. + * @return the ClusterSku object itself. + */ + public ClusterSku withName(ClusterSkuNameEnum name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterSkuNameEnum.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterSkuNameEnum.java new file mode 100644 index 0000000000000..74de6675f4314 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ClusterSkuNameEnum.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ClusterSkuNameEnum. */ +public final class ClusterSkuNameEnum extends ExpandableStringEnum { + /** Static value CapacityReservation for ClusterSkuNameEnum. */ + public static final ClusterSkuNameEnum CAPACITY_RESERVATION = fromString("CapacityReservation"); + + /** + * Creates or finds a ClusterSkuNameEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding ClusterSkuNameEnum. + */ + @JsonCreator + public static ClusterSkuNameEnum fromString(String name) { + return fromString(name, ClusterSkuNameEnum.class); + } + + /** @return known ClusterSkuNameEnum values. */ + public static Collection values() { + return values(ClusterSkuNameEnum.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Clusters.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Clusters.java new file mode 100644 index 0000000000000..67ccdb42fd95d --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Clusters.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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 Clusters. */ +public interface Clusters { + /** + * Gets Log Analytics clusters in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 log Analytics clusters in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets Log Analytics clusters in a 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 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 log Analytics clusters in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @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 Log Analytics clusters in a subscription. + */ + PagedIterable list(); + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @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 Log Analytics clusters in a subscription. + */ + PagedIterable list(Context context); + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 clusterName); + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 clusterName, Context context); + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 Log Analytics cluster instance. + */ + Cluster getByResourceGroup(String resourceGroupName, String clusterName); + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 Log Analytics cluster instance. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String clusterName, Context context); + + /** + * Gets a Log Analytics cluster instance. + * + * @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 a Log Analytics cluster instance. + */ + Cluster getById(String id); + + /** + * Gets a Log Analytics cluster instance. + * + * @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 a Log Analytics cluster instance. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a cluster instance. + * + * @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); + + /** + * Deletes a cluster instance. + * + * @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 Cluster resource. + * + * @param name resource name. + * @return the first stage of the new Cluster definition. + */ + Cluster.DefinitionStages.Blank define(String name); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/CoreSummary.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/CoreSummary.java new file mode 100644 index 0000000000000..c8fd34ef27a20 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/CoreSummary.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The core summary of a search. */ +@Fluent +public final class CoreSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CoreSummary.class); + + /* + * The status of a core summary. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The number of documents of a core summary. + */ + @JsonProperty(value = "numberOfDocuments", required = true) + private long numberOfDocuments; + + /** + * Get the status property: The status of a core summary. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of a core summary. + * + * @param status the status value to set. + * @return the CoreSummary object itself. + */ + public CoreSummary withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the numberOfDocuments property: The number of documents of a core summary. + * + * @return the numberOfDocuments value. + */ + public long numberOfDocuments() { + return this.numberOfDocuments; + } + + /** + * Set the numberOfDocuments property: The number of documents of a core summary. + * + * @param numberOfDocuments the numberOfDocuments value to set. + * @return the CoreSummary object itself. + */ + public CoreSummary withNumberOfDocuments(long numberOfDocuments) { + this.numberOfDocuments = numberOfDocuments; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExport.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExport.java new file mode 100644 index 0000000000000..a45b17f9f3da8 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExport.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.DataExportInner; +import java.util.List; + +/** An immutable client-side representation of DataExport. */ +public interface DataExport { + /** + * 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 dataExportId property: The data export rule ID. + * + * @return the dataExportId value. + */ + String dataExportId(); + + /** + * Gets the tableNames property: An array of tables to export, for example: [“Heartbeat, SecurityEvent”]. + * + * @return the tableNames value. + */ + List tableNames(); + + /** + * Gets the enable property: Active when enabled. + * + * @return the enable value. + */ + Boolean enable(); + + /** + * Gets the createdDate property: The latest data export rule modification time. + * + * @return the createdDate value. + */ + String createdDate(); + + /** + * Gets the lastModifiedDate property: Date and time when the export was last modified. + * + * @return the lastModifiedDate value. + */ + String lastModifiedDate(); + + /** + * Gets the resourceId property: The destination resource ID. This can be copied from the Properties entry of the + * destination resource in Azure. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the typePropertiesDestinationType property: The type of the destination resource. + * + * @return the typePropertiesDestinationType value. + */ + Type typePropertiesDestinationType(); + + /** + * Gets the eventHubName property: Optional. Allows to define an Event Hub name. Not applicable when destination is + * Storage Account. + * + * @return the eventHubName value. + */ + String eventHubName(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.DataExportInner object. + * + * @return the inner object. + */ + DataExportInner innerModel(); + + /** The entirety of the DataExport definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DataExport definition stages. */ + interface DefinitionStages { + /** The first stage of the DataExport definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DataExport definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + /** + * The stage of the DataExport 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.WithDataExportId, + DefinitionStages.WithTableNames, + DefinitionStages.WithEnable, + DefinitionStages.WithCreatedDate, + DefinitionStages.WithLastModifiedDate, + DefinitionStages.WithResourceId, + DefinitionStages.WithEventHubName { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataExport create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataExport create(Context context); + } + /** The stage of the DataExport definition allowing to specify dataExportId. */ + interface WithDataExportId { + /** + * Specifies the dataExportId property: The data export rule ID.. + * + * @param dataExportId The data export rule ID. + * @return the next definition stage. + */ + WithCreate withDataExportId(String dataExportId); + } + /** The stage of the DataExport definition allowing to specify tableNames. */ + interface WithTableNames { + /** + * Specifies the tableNames property: An array of tables to export, for example: [“Heartbeat, + * SecurityEvent”].. + * + * @param tableNames An array of tables to export, for example: [“Heartbeat, SecurityEvent”]. + * @return the next definition stage. + */ + WithCreate withTableNames(List tableNames); + } + /** The stage of the DataExport definition allowing to specify enable. */ + interface WithEnable { + /** + * Specifies the enable property: Active when enabled.. + * + * @param enable Active when enabled. + * @return the next definition stage. + */ + WithCreate withEnable(Boolean enable); + } + /** The stage of the DataExport definition allowing to specify createdDate. */ + interface WithCreatedDate { + /** + * Specifies the createdDate property: The latest data export rule modification time.. + * + * @param createdDate The latest data export rule modification time. + * @return the next definition stage. + */ + WithCreate withCreatedDate(String createdDate); + } + /** The stage of the DataExport definition allowing to specify lastModifiedDate. */ + interface WithLastModifiedDate { + /** + * Specifies the lastModifiedDate property: Date and time when the export was last modified.. + * + * @param lastModifiedDate Date and time when the export was last modified. + * @return the next definition stage. + */ + WithCreate withLastModifiedDate(String lastModifiedDate); + } + /** The stage of the DataExport definition allowing to specify resourceId. */ + interface WithResourceId { + /** + * Specifies the resourceId property: The destination resource ID. This can be copied from the Properties + * entry of the destination resource in Azure.. + * + * @param resourceId The destination resource ID. This can be copied from the Properties entry of the + * destination resource in Azure. + * @return the next definition stage. + */ + WithCreate withResourceId(String resourceId); + } + /** The stage of the DataExport definition allowing to specify eventHubName. */ + interface WithEventHubName { + /** + * Specifies the eventHubName property: Optional. Allows to define an Event Hub name. Not applicable when + * destination is Storage Account.. + * + * @param eventHubName Optional. Allows to define an Event Hub name. Not applicable when destination is + * Storage Account. + * @return the next definition stage. + */ + WithCreate withEventHubName(String eventHubName); + } + } + /** + * Begins update for the DataExport resource. + * + * @return the stage of resource update. + */ + DataExport.Update update(); + + /** The template for DataExport update. */ + interface Update + extends UpdateStages.WithDataExportId, + UpdateStages.WithTableNames, + UpdateStages.WithEnable, + UpdateStages.WithCreatedDate, + UpdateStages.WithLastModifiedDate, + UpdateStages.WithResourceId, + UpdateStages.WithEventHubName { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataExport apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataExport apply(Context context); + } + /** The DataExport update stages. */ + interface UpdateStages { + /** The stage of the DataExport update allowing to specify dataExportId. */ + interface WithDataExportId { + /** + * Specifies the dataExportId property: The data export rule ID.. + * + * @param dataExportId The data export rule ID. + * @return the next definition stage. + */ + Update withDataExportId(String dataExportId); + } + /** The stage of the DataExport update allowing to specify tableNames. */ + interface WithTableNames { + /** + * Specifies the tableNames property: An array of tables to export, for example: [“Heartbeat, + * SecurityEvent”].. + * + * @param tableNames An array of tables to export, for example: [“Heartbeat, SecurityEvent”]. + * @return the next definition stage. + */ + Update withTableNames(List tableNames); + } + /** The stage of the DataExport update allowing to specify enable. */ + interface WithEnable { + /** + * Specifies the enable property: Active when enabled.. + * + * @param enable Active when enabled. + * @return the next definition stage. + */ + Update withEnable(Boolean enable); + } + /** The stage of the DataExport update allowing to specify createdDate. */ + interface WithCreatedDate { + /** + * Specifies the createdDate property: The latest data export rule modification time.. + * + * @param createdDate The latest data export rule modification time. + * @return the next definition stage. + */ + Update withCreatedDate(String createdDate); + } + /** The stage of the DataExport update allowing to specify lastModifiedDate. */ + interface WithLastModifiedDate { + /** + * Specifies the lastModifiedDate property: Date and time when the export was last modified.. + * + * @param lastModifiedDate Date and time when the export was last modified. + * @return the next definition stage. + */ + Update withLastModifiedDate(String lastModifiedDate); + } + /** The stage of the DataExport update allowing to specify resourceId. */ + interface WithResourceId { + /** + * Specifies the resourceId property: The destination resource ID. This can be copied from the Properties + * entry of the destination resource in Azure.. + * + * @param resourceId The destination resource ID. This can be copied from the Properties entry of the + * destination resource in Azure. + * @return the next definition stage. + */ + Update withResourceId(String resourceId); + } + /** The stage of the DataExport update allowing to specify eventHubName. */ + interface WithEventHubName { + /** + * Specifies the eventHubName property: Optional. Allows to define an Event Hub name. Not applicable when + * destination is Storage Account.. + * + * @param eventHubName Optional. Allows to define an Event Hub name. Not applicable when destination is + * Storage Account. + * @return the next definition stage. + */ + Update withEventHubName(String eventHubName); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataExport refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataExport refresh(Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExportListResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExportListResult.java new file mode 100644 index 0000000000000..f13038ca5cd3e --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExportListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.DataExportInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the request to list data exports. */ +@Fluent +public final class DataExportListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataExportListResult.class); + + /* + * List of data export instances within a workspace.. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of data export instances within a workspace.. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of data export instances within a workspace.. + * + * @param value the value value to set. + * @return the DataExportListResult object itself. + */ + public DataExportListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExports.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExports.java new file mode 100644 index 0000000000000..f3053b608d352 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataExports.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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 DataExports. */ +public interface DataExports { + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 the request to list data exports. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 the request to list data exports. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 a data export instance. + */ + DataExport get(String resourceGroupName, String workspaceName, String dataExportName); + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 a data export instance. + */ + Response getWithResponse( + String resourceGroupName, String workspaceName, String dataExportName, Context context); + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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. + */ + void delete(String resourceGroupName, String workspaceName, String dataExportName); + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule 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 the response. + */ + Response deleteWithResponse( + String resourceGroupName, String workspaceName, String dataExportName, Context context); + + /** + * Gets a data export instance. + * + * @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 a data export instance. + */ + DataExport getById(String id); + + /** + * Gets a data export instance. + * + * @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 a data export instance. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified data export in a given workspace.. + * + * @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); + + /** + * Deletes the specified data export in a given workspace.. + * + * @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 response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DataExport resource. + * + * @param name resource name. + * @return the first stage of the new DataExport definition. + */ + DataExport.DefinitionStages.Blank define(String name); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataIngestionStatus.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataIngestionStatus.java new file mode 100644 index 0000000000000..6f50da4f255d7 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataIngestionStatus.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DataIngestionStatus. */ +public final class DataIngestionStatus extends ExpandableStringEnum { + /** Static value RespectQuota for DataIngestionStatus. */ + public static final DataIngestionStatus RESPECT_QUOTA = fromString("RespectQuota"); + + /** Static value ForceOn for DataIngestionStatus. */ + public static final DataIngestionStatus FORCE_ON = fromString("ForceOn"); + + /** Static value ForceOff for DataIngestionStatus. */ + public static final DataIngestionStatus FORCE_OFF = fromString("ForceOff"); + + /** Static value OverQuota for DataIngestionStatus. */ + public static final DataIngestionStatus OVER_QUOTA = fromString("OverQuota"); + + /** Static value SubscriptionSuspended for DataIngestionStatus. */ + public static final DataIngestionStatus SUBSCRIPTION_SUSPENDED = fromString("SubscriptionSuspended"); + + /** Static value ApproachingQuota for DataIngestionStatus. */ + public static final DataIngestionStatus APPROACHING_QUOTA = fromString("ApproachingQuota"); + + /** + * Creates or finds a DataIngestionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataIngestionStatus. + */ + @JsonCreator + public static DataIngestionStatus fromString(String name) { + return fromString(name, DataIngestionStatus.class); + } + + /** @return known DataIngestionStatus values. */ + public static Collection values() { + return values(DataIngestionStatus.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSource.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSource.java new file mode 100644 index 0000000000000..79cc5495c9696 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSource.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.DataSourceInner; +import java.util.Map; + +/** An immutable client-side representation of DataSource. */ +public interface DataSource { + /** + * 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 data source properties in raw json format, each kind of data source have it's + * own schema. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the etag property: The ETag of the data source. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the kind property: The kind of the DataSource. + * + * @return the kind value. + */ + DataSourceKind kind(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.DataSourceInner object. + * + * @return the inner object. + */ + DataSourceInner innerModel(); + + /** The entirety of the DataSource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithProperties, + DefinitionStages.WithKind, + DefinitionStages.WithCreate { + } + /** The DataSource definition stages. */ + interface DefinitionStages { + /** The first stage of the DataSource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DataSource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithProperties withExistingWorkspace(String resourceGroupName, String workspaceName); + } + /** The stage of the DataSource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The data source properties in raw json format, each kind of data + * source have it's own schema.. + * + * @param properties The data source properties in raw json format, each kind of data source have it's own + * schema. + * @return the next definition stage. + */ + WithKind withProperties(Object properties); + } + /** The stage of the DataSource definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The kind of the DataSource.. + * + * @param kind The kind of the DataSource. + * @return the next definition stage. + */ + WithCreate withKind(DataSourceKind kind); + } + /** + * The stage of the DataSource 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.WithEtag { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataSource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataSource create(Context context); + } + /** The stage of the DataSource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the DataSource definition allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: The ETag of the data source.. + * + * @param etag The ETag of the data source. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + } + /** + * Begins update for the DataSource resource. + * + * @return the stage of resource update. + */ + DataSource.Update update(); + + /** The template for DataSource update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithProperties, UpdateStages.WithEtag, UpdateStages.WithKind { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataSource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataSource apply(Context context); + } + /** The DataSource update stages. */ + interface UpdateStages { + /** The stage of the DataSource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the DataSource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The data source properties in raw json format, each kind of data + * source have it's own schema.. + * + * @param properties The data source properties in raw json format, each kind of data source have it's own + * schema. + * @return the next definition stage. + */ + Update withProperties(Object properties); + } + /** The stage of the DataSource update allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: The ETag of the data source.. + * + * @param etag The ETag of the data source. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + /** The stage of the DataSource update allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The kind of the DataSource.. + * + * @param kind The kind of the DataSource. + * @return the next definition stage. + */ + Update withKind(DataSourceKind kind); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataSource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataSource refresh(Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceKind.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceKind.java new file mode 100644 index 0000000000000..7f76895d1ca62 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceKind.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DataSourceKind. */ +public final class DataSourceKind extends ExpandableStringEnum { + /** Static value WindowsEvent for DataSourceKind. */ + public static final DataSourceKind WINDOWS_EVENT = fromString("WindowsEvent"); + + /** Static value WindowsPerformanceCounter for DataSourceKind. */ + public static final DataSourceKind WINDOWS_PERFORMANCE_COUNTER = fromString("WindowsPerformanceCounter"); + + /** Static value IISLogs for DataSourceKind. */ + public static final DataSourceKind IISLOGS = fromString("IISLogs"); + + /** Static value LinuxSyslog for DataSourceKind. */ + public static final DataSourceKind LINUX_SYSLOG = fromString("LinuxSyslog"); + + /** Static value LinuxSyslogCollection for DataSourceKind. */ + public static final DataSourceKind LINUX_SYSLOG_COLLECTION = fromString("LinuxSyslogCollection"); + + /** Static value LinuxPerformanceObject for DataSourceKind. */ + public static final DataSourceKind LINUX_PERFORMANCE_OBJECT = fromString("LinuxPerformanceObject"); + + /** Static value LinuxPerformanceCollection for DataSourceKind. */ + public static final DataSourceKind LINUX_PERFORMANCE_COLLECTION = fromString("LinuxPerformanceCollection"); + + /** Static value CustomLog for DataSourceKind. */ + public static final DataSourceKind CUSTOM_LOG = fromString("CustomLog"); + + /** Static value CustomLogCollection for DataSourceKind. */ + public static final DataSourceKind CUSTOM_LOG_COLLECTION = fromString("CustomLogCollection"); + + /** Static value AzureAuditLog for DataSourceKind. */ + public static final DataSourceKind AZURE_AUDIT_LOG = fromString("AzureAuditLog"); + + /** Static value AzureActivityLog for DataSourceKind. */ + public static final DataSourceKind AZURE_ACTIVITY_LOG = fromString("AzureActivityLog"); + + /** Static value GenericDataSource for DataSourceKind. */ + public static final DataSourceKind GENERIC_DATA_SOURCE = fromString("GenericDataSource"); + + /** Static value ChangeTrackingCustomPath for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_CUSTOM_PATH = fromString("ChangeTrackingCustomPath"); + + /** Static value ChangeTrackingPath for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_PATH = fromString("ChangeTrackingPath"); + + /** Static value ChangeTrackingServices for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_SERVICES = fromString("ChangeTrackingServices"); + + /** Static value ChangeTrackingDataTypeConfiguration for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_DATA_TYPE_CONFIGURATION = + fromString("ChangeTrackingDataTypeConfiguration"); + + /** Static value ChangeTrackingDefaultRegistry for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_DEFAULT_REGISTRY = fromString("ChangeTrackingDefaultRegistry"); + + /** Static value ChangeTrackingRegistry for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_REGISTRY = fromString("ChangeTrackingRegistry"); + + /** Static value ChangeTrackingLinuxPath for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_LINUX_PATH = fromString("ChangeTrackingLinuxPath"); + + /** Static value LinuxChangeTrackingPath for DataSourceKind. */ + public static final DataSourceKind LINUX_CHANGE_TRACKING_PATH = fromString("LinuxChangeTrackingPath"); + + /** Static value ChangeTrackingContentLocation for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_CONTENT_LOCATION = fromString("ChangeTrackingContentLocation"); + + /** Static value WindowsTelemetry for DataSourceKind. */ + public static final DataSourceKind WINDOWS_TELEMETRY = fromString("WindowsTelemetry"); + + /** Static value Office365 for DataSourceKind. */ + public static final DataSourceKind OFFICE365 = fromString("Office365"); + + /** Static value SecurityWindowsBaselineConfiguration for DataSourceKind. */ + public static final DataSourceKind SECURITY_WINDOWS_BASELINE_CONFIGURATION = + fromString("SecurityWindowsBaselineConfiguration"); + + /** Static value SecurityCenterSecurityWindowsBaselineConfiguration for DataSourceKind. */ + public static final DataSourceKind SECURITY_CENTER_SECURITY_WINDOWS_BASELINE_CONFIGURATION = + fromString("SecurityCenterSecurityWindowsBaselineConfiguration"); + + /** Static value SecurityEventCollectionConfiguration for DataSourceKind. */ + public static final DataSourceKind SECURITY_EVENT_COLLECTION_CONFIGURATION = + fromString("SecurityEventCollectionConfiguration"); + + /** Static value SecurityInsightsSecurityEventCollectionConfiguration for DataSourceKind. */ + public static final DataSourceKind SECURITY_INSIGHTS_SECURITY_EVENT_COLLECTION_CONFIGURATION = + fromString("SecurityInsightsSecurityEventCollectionConfiguration"); + + /** Static value ImportComputerGroup for DataSourceKind. */ + public static final DataSourceKind IMPORT_COMPUTER_GROUP = fromString("ImportComputerGroup"); + + /** Static value NetworkMonitoring for DataSourceKind. */ + public static final DataSourceKind NETWORK_MONITORING = fromString("NetworkMonitoring"); + + /** Static value Itsm for DataSourceKind. */ + public static final DataSourceKind ITSM = fromString("Itsm"); + + /** Static value DnsAnalytics for DataSourceKind. */ + public static final DataSourceKind DNS_ANALYTICS = fromString("DnsAnalytics"); + + /** Static value ApplicationInsights for DataSourceKind. */ + public static final DataSourceKind APPLICATION_INSIGHTS = fromString("ApplicationInsights"); + + /** Static value SqlDataClassification for DataSourceKind. */ + public static final DataSourceKind SQL_DATA_CLASSIFICATION = fromString("SqlDataClassification"); + + /** + * Creates or finds a DataSourceKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataSourceKind. + */ + @JsonCreator + public static DataSourceKind fromString(String name) { + return fromString(name, DataSourceKind.class); + } + + /** @return known DataSourceKind values. */ + public static Collection values() { + return values(DataSourceKind.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceListResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceListResult.java new file mode 100644 index 0000000000000..af0f454a097c3 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.DataSourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list data source by workspace operation response. */ +@Fluent +public final class DataSourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataSourceListResult.class); + + /* + * A list of datasources. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link (url) to the next page of datasources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A list of datasources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of datasources. + * + * @param value the value value to set. + * @return the DataSourceListResult object itself. + */ + public DataSourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link (url) to the next page of datasources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link (url) to the next page of datasources. + * + * @param nextLink the nextLink value to set. + * @return the DataSourceListResult object itself. + */ + public DataSourceListResult 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) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceType.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceType.java new file mode 100644 index 0000000000000..f97fb30521ab0 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSourceType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DataSourceType. */ +public enum DataSourceType { + /** Enum value CustomLogs. */ + CUSTOM_LOGS("CustomLogs"), + + /** Enum value AzureWatson. */ + AZURE_WATSON("AzureWatson"), + + /** Enum value Query. */ + QUERY("Query"), + + /** Enum value Alerts. */ + ALERTS("Alerts"); + + /** The actual serialized value for a DataSourceType instance. */ + private final String value; + + DataSourceType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataSourceType instance. + * + * @param value the serialized value to parse. + * @return the parsed DataSourceType object, or null if unable to parse. + */ + @JsonCreator + public static DataSourceType fromString(String value) { + DataSourceType[] items = DataSourceType.values(); + for (DataSourceType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSources.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSources.java new file mode 100644 index 0000000000000..0782abff02fb4 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DataSources.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.loganalytics.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 DataSources. */ +public interface DataSources { + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 workspaceName, String dataSourceName); + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 response. + */ + Response deleteWithResponse( + String resourceGroupName, String workspaceName, String dataSourceName, Context context); + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 datasource instance. + */ + DataSource get(String resourceGroupName, String workspaceName, String dataSourceName); + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 datasource instance. + */ + Response getWithResponse( + String resourceGroupName, String workspaceName, String dataSourceName, Context context); + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the 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 first page of data source instances in a workspace with the link to the next page. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, String filter); + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @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 first page of data source instances in a workspace with the link to the next page. + */ + PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, String filter, String skiptoken, Context context); + + /** + * Gets a datasource instance. + * + * @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 a datasource instance. + */ + DataSource getById(String id); + + /** + * Gets a datasource instance. + * + * @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 a datasource instance. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a data source instance. + * + * @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); + + /** + * Deletes a data source instance. + * + * @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 response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DataSource resource. + * + * @param name resource name. + * @return the first stage of the new DataSource definition. + */ + DataSource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DeletedWorkspaces.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DeletedWorkspaces.java new file mode 100644 index 0000000000000..7a7dff1680dc1 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/DeletedWorkspaces.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DeletedWorkspaces. */ +public interface DeletedWorkspaces { + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @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 recently deleted workspaces in a subscription, available for recovery. + */ + PagedIterable list(); + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @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 recently deleted workspaces in a subscription, available for recovery. + */ + PagedIterable list(Context context); + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 recently deleted workspaces in a resource group, available for recovery. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @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 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 recently deleted workspaces in a resource group, available for recovery. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ErrorAdditionalInfo.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ErrorAdditionalInfo.java new file mode 100644 index 0000000000000..697ee10baa222 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ErrorAdditionalInfo.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource management error additional info. */ +@Immutable +public final class ErrorAdditionalInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorAdditionalInfo.class); + + /* + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + public Object info() { + return this.info; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Gateways.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Gateways.java new file mode 100644 index 0000000000000..6a6b1bd67b191 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Gateways.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Gateways. */ +public interface Gateways { + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway 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 delete(String resourceGroupName, String workspaceName, String gatewayId); + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway 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 response. + */ + Response deleteWithResponse( + String resourceGroupName, String workspaceName, String gatewayId, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Identity.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Identity.java new file mode 100644 index 0000000000000..2115f49ea7fa1 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Identity.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Identity for the resource. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The identity type. + */ + @JsonProperty(value = "type", required = true) + private IdentityType type; + + /** + * Get the principalId property: The principal ID of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property type in model Identity")); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IdentityType.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IdentityType.java new file mode 100644 index 0000000000000..457f03780ba35 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IdentityType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IdentityType. */ +public enum IdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a IdentityType instance. */ + private final String value; + + IdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed IdentityType object, or null if unable to parse. + */ + @JsonCreator + public static IdentityType fromString(String value) { + IdentityType[] items = IdentityType.values(); + for (IdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IntelligencePack.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IntelligencePack.java new file mode 100644 index 0000000000000..04ba4c2b30173 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IntelligencePack.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.IntelligencePackInner; + +/** An immutable client-side representation of IntelligencePack. */ +public interface IntelligencePack { + /** + * Gets the name property: The name of the intelligence pack. + * + * @return the name value. + */ + String name(); + + /** + * Gets the enabled property: The enabled boolean for the intelligence pack. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the displayName property: The display name of the intelligence pack. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.IntelligencePackInner object. + * + * @return the inner object. + */ + IntelligencePackInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IntelligencePacks.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IntelligencePacks.java new file mode 100644 index 0000000000000..61b4af9fec412 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/IntelligencePacks.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of IntelligencePacks. */ +public interface IntelligencePacks { + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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 disable(String resourceGroupName, String workspaceName, String intelligencePackName); + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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 response. + */ + Response disableWithResponse( + String resourceGroupName, String workspaceName, String intelligencePackName, Context context); + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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 enable(String resourceGroupName, String workspaceName, String intelligencePackName); + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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 response. + */ + Response enableWithResponse( + String resourceGroupName, String workspaceName, String intelligencePackName, Context context); + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 array of IntelligencePack. + */ + List list(String resourceGroupName, String workspaceName); + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 array of IntelligencePack. + */ + Response> listWithResponse(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/KeyVaultProperties.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/KeyVaultProperties.java new file mode 100644 index 0000000000000..ac2c6827af82d --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/KeyVaultProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The key vault properties. */ +@Fluent +public final class KeyVaultProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultProperties.class); + + /* + * The Key Vault uri which holds they key associated with the Log Analytics + * cluster. + */ + @JsonProperty(value = "keyVaultUri") + private String keyVaultUri; + + /* + * The name of the key associated with the Log Analytics cluster. + */ + @JsonProperty(value = "keyName") + private String keyName; + + /* + * The version of the key associated with the Log Analytics cluster. + */ + @JsonProperty(value = "keyVersion") + private String keyVersion; + + /** + * Get the keyVaultUri property: The Key Vault uri which holds they key associated with the Log Analytics cluster. + * + * @return the keyVaultUri value. + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the keyVaultUri property: The Key Vault uri which holds they key associated with the Log Analytics cluster. + * + * @param keyVaultUri the keyVaultUri value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Get the keyName property: The name of the key associated with the Log Analytics cluster. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: The name of the key associated with the Log Analytics cluster. + * + * @param keyName the keyName value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the keyVersion property: The version of the key associated with the Log Analytics cluster. + * + * @return the keyVersion value. + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set the keyVersion property: The version of the key associated with the Log Analytics cluster. + * + * @param keyVersion the keyVersion value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedService.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedService.java new file mode 100644 index 0000000000000..20410a6f8dcb8 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedService.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedServiceInner; +import java.util.Map; + +/** An immutable client-side representation of LinkedService. */ +public interface LinkedService { + /** + * 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 tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the resourceId property: The resource id of the resource that will be linked to the workspace. This should + * be used for linking resources which require read access. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the writeAccessResourceId property: The resource id of the resource that will be linked to the workspace. + * This should be used for linking resources which require write access. + * + * @return the writeAccessResourceId value. + */ + String writeAccessResourceId(); + + /** + * Gets the provisioningState property: The provisioning state of the linked service. + * + * @return the provisioningState value. + */ + LinkedServiceEntityStatus provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.LinkedServiceInner object. + * + * @return the inner object. + */ + LinkedServiceInner innerModel(); + + /** The entirety of the LinkedService definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The LinkedService definition stages. */ + interface DefinitionStages { + /** The first stage of the LinkedService definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the LinkedService definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + /** + * The stage of the LinkedService 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.WithResourceId, + DefinitionStages.WithWriteAccessResourceId, + DefinitionStages.WithProvisioningState { + /** + * Executes the create request. + * + * @return the created resource. + */ + LinkedService create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LinkedService create(Context context); + } + /** The stage of the LinkedService definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the LinkedService definition allowing to specify resourceId. */ + interface WithResourceId { + /** + * Specifies the resourceId property: The resource id of the resource that will be linked to the workspace. + * This should be used for linking resources which require read access. + * + * @param resourceId The resource id of the resource that will be linked to the workspace. This should be + * used for linking resources which require read access. + * @return the next definition stage. + */ + WithCreate withResourceId(String resourceId); + } + /** The stage of the LinkedService definition allowing to specify writeAccessResourceId. */ + interface WithWriteAccessResourceId { + /** + * Specifies the writeAccessResourceId property: The resource id of the resource that will be linked to the + * workspace. This should be used for linking resources which require write access. + * + * @param writeAccessResourceId The resource id of the resource that will be linked to the workspace. This + * should be used for linking resources which require write access. + * @return the next definition stage. + */ + WithCreate withWriteAccessResourceId(String writeAccessResourceId); + } + /** The stage of the LinkedService definition allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: The provisioning state of the linked service.. + * + * @param provisioningState The provisioning state of the linked service. + * @return the next definition stage. + */ + WithCreate withProvisioningState(LinkedServiceEntityStatus provisioningState); + } + } + /** + * Begins update for the LinkedService resource. + * + * @return the stage of resource update. + */ + LinkedService.Update update(); + + /** The template for LinkedService update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithResourceId, + UpdateStages.WithWriteAccessResourceId, + UpdateStages.WithProvisioningState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LinkedService apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LinkedService apply(Context context); + } + /** The LinkedService update stages. */ + interface UpdateStages { + /** The stage of the LinkedService update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the LinkedService update allowing to specify resourceId. */ + interface WithResourceId { + /** + * Specifies the resourceId property: The resource id of the resource that will be linked to the workspace. + * This should be used for linking resources which require read access. + * + * @param resourceId The resource id of the resource that will be linked to the workspace. This should be + * used for linking resources which require read access. + * @return the next definition stage. + */ + Update withResourceId(String resourceId); + } + /** The stage of the LinkedService update allowing to specify writeAccessResourceId. */ + interface WithWriteAccessResourceId { + /** + * Specifies the writeAccessResourceId property: The resource id of the resource that will be linked to the + * workspace. This should be used for linking resources which require write access. + * + * @param writeAccessResourceId The resource id of the resource that will be linked to the workspace. This + * should be used for linking resources which require write access. + * @return the next definition stage. + */ + Update withWriteAccessResourceId(String writeAccessResourceId); + } + /** The stage of the LinkedService update allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: The provisioning state of the linked service.. + * + * @param provisioningState The provisioning state of the linked service. + * @return the next definition stage. + */ + Update withProvisioningState(LinkedServiceEntityStatus provisioningState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LinkedService refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LinkedService refresh(Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServiceEntityStatus.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServiceEntityStatus.java new file mode 100644 index 0000000000000..2fa8b620bad44 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServiceEntityStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LinkedServiceEntityStatus. */ +public final class LinkedServiceEntityStatus extends ExpandableStringEnum { + /** Static value Succeeded for LinkedServiceEntityStatus. */ + public static final LinkedServiceEntityStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for LinkedServiceEntityStatus. */ + public static final LinkedServiceEntityStatus DELETING = fromString("Deleting"); + + /** Static value ProvisioningAccount for LinkedServiceEntityStatus. */ + public static final LinkedServiceEntityStatus PROVISIONING_ACCOUNT = fromString("ProvisioningAccount"); + + /** Static value Updating for LinkedServiceEntityStatus. */ + public static final LinkedServiceEntityStatus UPDATING = fromString("Updating"); + + /** + * Creates or finds a LinkedServiceEntityStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinkedServiceEntityStatus. + */ + @JsonCreator + public static LinkedServiceEntityStatus fromString(String name) { + return fromString(name, LinkedServiceEntityStatus.class); + } + + /** @return known LinkedServiceEntityStatus values. */ + public static Collection values() { + return values(LinkedServiceEntityStatus.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServiceListResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServiceListResult.java new file mode 100644 index 0000000000000..73eda72cb0885 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServiceListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedServiceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list linked service operation response. */ +@Fluent +public final class LinkedServiceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkedServiceListResult.class); + + /* + * The list of linked service instances + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of linked service instances. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of linked service instances. + * + * @param value the value value to set. + * @return the LinkedServiceListResult object itself. + */ + public LinkedServiceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServices.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServices.java new file mode 100644 index 0000000000000..b977b6b149097 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServices.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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 LinkedServices. */ +public interface LinkedServices { + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + LinkedService delete(String resourceGroupName, String workspaceName, String linkedServiceName); + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 top level Linked service resource container. + */ + LinkedService delete(String resourceGroupName, String workspaceName, String linkedServiceName, Context context); + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 linked service instance. + */ + LinkedService get(String resourceGroupName, String workspaceName, String linkedServiceName); + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 linked service instance. + */ + Response getWithResponse( + String resourceGroupName, String workspaceName, String linkedServiceName, Context context); + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 linked services instances in a workspace. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 linked services instances in a workspace. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a linked service instance. + * + * @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 a linked service instance. + */ + LinkedService getById(String id); + + /** + * Gets a linked service instance. + * + * @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 a linked service instance. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LinkedService resource. + * + * @param name resource name. + * @return the first stage of the new LinkedService definition. + */ + LinkedService.DefinitionStages.Blank define(String name); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccounts.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccounts.java new file mode 100644 index 0000000000000..5ea9e3617d4fc --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccounts.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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 LinkedStorageAccounts. */ +public interface LinkedStorageAccounts { + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 workspaceName, DataSourceType dataSourceType); + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 response. + */ + Response deleteWithResponse( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType, Context context); + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + LinkedStorageAccountsResource get(String resourceGroupName, String workspaceName, DataSourceType dataSourceType); + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + Response getWithResponse( + String resourceGroupName, String workspaceName, DataSourceType dataSourceType, Context context); + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all linked storage accounts associated with the specified workspace, storage accounts will be sorted by + * their data source type. + */ + PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context); + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + LinkedStorageAccountsResource getById(String id); + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @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 all linked storage account of a specific data source type associated with the specified workspace. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @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); + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @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 response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LinkedStorageAccountsResource resource. + * + * @param name resource name. + * @return the first stage of the new LinkedStorageAccountsResource definition. + */ + LinkedStorageAccountsResource.DefinitionStages.Blank define(DataSourceType name); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccountsListResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccountsListResult.java new file mode 100644 index 0000000000000..e6e12b4ed0e0c --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccountsListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedStorageAccountsResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list linked storage accounts service operation response. */ +@Fluent +public final class LinkedStorageAccountsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkedStorageAccountsListResult.class); + + /* + * A list of linked storage accounts instances. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: A list of linked storage accounts instances. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of linked storage accounts instances. + * + * @param value the value value to set. + * @return the LinkedStorageAccountsListResult object itself. + */ + public LinkedStorageAccountsListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccountsResource.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccountsResource.java new file mode 100644 index 0000000000000..7b28870579403 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedStorageAccountsResource.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.LinkedStorageAccountsResourceInner; +import java.util.List; + +/** An immutable client-side representation of LinkedStorageAccountsResource. */ +public interface LinkedStorageAccountsResource { + /** + * 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 dataSourceType property: Linked storage accounts type. + * + * @return the dataSourceType value. + */ + DataSourceType dataSourceType(); + + /** + * Gets the storageAccountIds property: Linked storage accounts resources ids. + * + * @return the storageAccountIds value. + */ + List storageAccountIds(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.LinkedStorageAccountsResourceInner object. + * + * @return the inner object. + */ + LinkedStorageAccountsResourceInner innerModel(); + + /** The entirety of the LinkedStorageAccountsResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The LinkedStorageAccountsResource definition stages. */ + interface DefinitionStages { + /** The first stage of the LinkedStorageAccountsResource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the LinkedStorageAccountsResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + /** + * The stage of the LinkedStorageAccountsResource 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.WithStorageAccountIds { + /** + * Executes the create request. + * + * @return the created resource. + */ + LinkedStorageAccountsResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LinkedStorageAccountsResource create(Context context); + } + /** The stage of the LinkedStorageAccountsResource definition allowing to specify storageAccountIds. */ + interface WithStorageAccountIds { + /** + * Specifies the storageAccountIds property: Linked storage accounts resources ids.. + * + * @param storageAccountIds Linked storage accounts resources ids. + * @return the next definition stage. + */ + WithCreate withStorageAccountIds(List storageAccountIds); + } + } + /** + * Begins update for the LinkedStorageAccountsResource resource. + * + * @return the stage of resource update. + */ + LinkedStorageAccountsResource.Update update(); + + /** The template for LinkedStorageAccountsResource update. */ + interface Update extends UpdateStages.WithStorageAccountIds { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LinkedStorageAccountsResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LinkedStorageAccountsResource apply(Context context); + } + /** The LinkedStorageAccountsResource update stages. */ + interface UpdateStages { + /** The stage of the LinkedStorageAccountsResource update allowing to specify storageAccountIds. */ + interface WithStorageAccountIds { + /** + * Specifies the storageAccountIds property: Linked storage accounts resources ids.. + * + * @param storageAccountIds Linked storage accounts resources ids. + * @return the next definition stage. + */ + Update withStorageAccountIds(List storageAccountIds); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LinkedStorageAccountsResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LinkedStorageAccountsResource refresh(Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ManagementGroup.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ManagementGroup.java new file mode 100644 index 0000000000000..3124692b6405d --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ManagementGroup.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.ManagementGroupInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ManagementGroup. */ +public interface ManagementGroup { + /** + * Gets the serverCount property: The number of servers connected to the management group. + * + * @return the serverCount value. + */ + Integer serverCount(); + + /** + * Gets the isGateway property: Gets or sets a value indicating whether the management group is a gateway. + * + * @return the isGateway value. + */ + Boolean isGateway(); + + /** + * Gets the name property: The name of the management group. + * + * @return the name value. + */ + String name(); + + /** + * Gets the id property: The unique ID of the management group. + * + * @return the id value. + */ + String id(); + + /** + * Gets the created property: The datetime that the management group was created. + * + * @return the created value. + */ + OffsetDateTime created(); + + /** + * Gets the dataReceived property: The last datetime that the management group received data. + * + * @return the dataReceived value. + */ + OffsetDateTime dataReceived(); + + /** + * Gets the version property: The version of System Center that is managing the management group. + * + * @return the version value. + */ + String version(); + + /** + * Gets the sku property: The SKU of System Center that is managing the management group. + * + * @return the sku value. + */ + String sku(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.ManagementGroupInner object. + * + * @return the inner object. + */ + ManagementGroupInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ManagementGroups.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ManagementGroups.java new file mode 100644 index 0000000000000..615d4d1f8cda2 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/ManagementGroups.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ManagementGroups. */ +public interface ManagementGroups { + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list of management groups connected to a workspace. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list of management groups connected to a workspace. + */ + PagedIterable list(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/MetricName.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/MetricName.java new file mode 100644 index 0000000000000..6fef09c845bf8 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/MetricName.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The name of a metric. */ +@Fluent +public final class MetricName { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricName.class); + + /* + * The system name of the metric. + */ + @JsonProperty(value = "value") + private String value; + + /* + * The localized name of the metric. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the value property: The system name of the metric. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The system name of the metric. + * + * @param value the value value to set. + * @return the MetricName object itself. + */ + public MetricName withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: The localized name of the metric. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: The localized name of the metric. + * + * @param localizedValue the localizedValue value to set. + * @return the MetricName object itself. + */ + public MetricName withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Operation.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Operation.java new file mode 100644 index 0000000000000..19df3b8901a1a --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Operation.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationDisplay.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationDisplay.java new file mode 100644 index 0000000000000..4fa288f62b892 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft OperationsManagement. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of operation + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Service provider: Microsoft OperationsManagement. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft OperationsManagement. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed etc. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Type of operation: get, read, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Type of operation: get, read, delete, etc. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationListResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationListResult.java new file mode 100644 index 0000000000000..ae992bf0e0cf6 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationListResult.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the request to list solution operations. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of solution operations supported by the OperationsManagement + * resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of solution operations supported by the OperationsManagement resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of solution operations supported by the OperationsManagement resource provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationStatus.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationStatus.java new file mode 100644 index 0000000000000..1d13df86d3f51 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationStatus.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.loganalytics.fluent.models.OperationStatusInner; + +/** An immutable client-side representation of OperationStatus. */ +public interface OperationStatus { + /** + * Gets the id property: The operation Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The operation name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + String startTime(); + + /** + * Gets the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + String endTime(); + + /** + * Gets the status property: The status of the operation. + * + * @return the status value. + */ + String status(); + + /** + * Gets the error property: The error detail of the operation if any. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.OperationStatusInner object. + * + * @return the inner object. + */ + OperationStatusInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationStatuses.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationStatuses.java new file mode 100644 index 0000000000000..6df3a591f1834 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/OperationStatuses.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of OperationStatuses. */ +public interface OperationStatuses { + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation 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 status of a long running azure asynchronous operation. + */ + OperationStatus get(String location, String asyncOperationId); + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation 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 status of a long running azure asynchronous operation. + */ + Response getWithResponse(String location, String asyncOperationId, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Operations.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Operations.java new file mode 100644 index 0000000000000..14912b653fe2d --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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 the request to list solution operations. + */ + PagedIterable list(); + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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 the request to list solution operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PrivateLinkScopedResource.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PrivateLinkScopedResource.java new file mode 100644 index 0000000000000..083fc84e8e993 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PrivateLinkScopedResource.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private link scope resource reference. */ +@Fluent +public final class PrivateLinkScopedResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkScopedResource.class); + + /* + * The full resource Id of the private link scope resource. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The private link scope unique Identifier. + */ + @JsonProperty(value = "scopeId") + private String scopeId; + + /** + * Get the resourceId property: The full resource Id of the private link scope resource. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The full resource Id of the private link scope resource. + * + * @param resourceId the resourceId value to set. + * @return the PrivateLinkScopedResource object itself. + */ + public PrivateLinkScopedResource withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the scopeId property: The private link scope unique Identifier. + * + * @return the scopeId value. + */ + public String scopeId() { + return this.scopeId; + } + + /** + * Set the scopeId property: The private link scope unique Identifier. + * + * @param scopeId the scopeId value to set. + * @return the PrivateLinkScopedResource object itself. + */ + public PrivateLinkScopedResource withScopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PublicNetworkAccessType.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PublicNetworkAccessType.java new file mode 100644 index 0000000000000..fa171fa9d2a85 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PublicNetworkAccessType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicNetworkAccessType. */ +public final class PublicNetworkAccessType extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccessType. */ + public static final PublicNetworkAccessType ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccessType. */ + public static final PublicNetworkAccessType DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccessType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccessType. + */ + @JsonCreator + public static PublicNetworkAccessType fromString(String name) { + return fromString(name, PublicNetworkAccessType.class); + } + + /** @return known PublicNetworkAccessType values. */ + public static Collection values() { + return values(PublicNetworkAccessType.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PurgeState.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PurgeState.java new file mode 100644 index 0000000000000..b92fd83d59739 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/PurgeState.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PurgeState. */ +public final class PurgeState extends ExpandableStringEnum { + /** Static value pending for PurgeState. */ + public static final PurgeState PENDING = fromString("pending"); + + /** Static value completed for PurgeState. */ + public static final PurgeState COMPLETED = fromString("completed"); + + /** + * Creates or finds a PurgeState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PurgeState. + */ + @JsonCreator + public static PurgeState fromString(String name) { + return fromString(name, PurgeState.class); + } + + /** @return known PurgeState values. */ + public static Collection values() { + return values(PurgeState.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearch.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearch.java new file mode 100644 index 0000000000000..7724013b89165 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearch.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchInner; +import java.util.List; + +/** An immutable client-side representation of SavedSearch. */ +public interface SavedSearch { + /** + * 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 etag property: The ETag of the saved search. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the category property: The category of the saved search. This helps the user to find a saved search faster. + * + * @return the category value. + */ + String category(); + + /** + * Gets the displayName property: Saved search display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the query property: The query expression for the saved search. + * + * @return the query value. + */ + String query(); + + /** + * Gets the functionAlias property: The function alias if query serves as a function. + * + * @return the functionAlias value. + */ + String functionAlias(); + + /** + * Gets the functionParameters property: The optional function parameters if query serves as a function. Value + * should be in the following format: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. For + * more examples and proper syntax please refer to + * https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + * + * @return the functionParameters value. + */ + String functionParameters(); + + /** + * Gets the version property: The version number of the query language. The current version is 2 and is the default. + * + * @return the version value. + */ + Long version(); + + /** + * Gets the tags property: The tags attached to the saved search. + * + * @return the tags value. + */ + List tags(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchInner object. + * + * @return the inner object. + */ + SavedSearchInner innerModel(); + + /** The entirety of the SavedSearch definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithCategory, + DefinitionStages.WithDisplayName, + DefinitionStages.WithQuery, + DefinitionStages.WithCreate { + } + /** The SavedSearch definition stages. */ + interface DefinitionStages { + /** The first stage of the SavedSearch definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SavedSearch definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCategory withExistingWorkspace(String resourceGroupName, String workspaceName); + } + /** The stage of the SavedSearch definition allowing to specify category. */ + interface WithCategory { + /** + * Specifies the category property: The category of the saved search. This helps the user to find a saved + * search faster. . + * + * @param category The category of the saved search. This helps the user to find a saved search faster. + * @return the next definition stage. + */ + WithDisplayName withCategory(String category); + } + /** The stage of the SavedSearch definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: Saved search display name.. + * + * @param displayName Saved search display name. + * @return the next definition stage. + */ + WithQuery withDisplayName(String displayName); + } + /** The stage of the SavedSearch definition allowing to specify query. */ + interface WithQuery { + /** + * Specifies the query property: The query expression for the saved search.. + * + * @param query The query expression for the saved search. + * @return the next definition stage. + */ + WithCreate withQuery(String query); + } + /** + * The stage of the SavedSearch 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.WithEtag, + DefinitionStages.WithFunctionAlias, + DefinitionStages.WithFunctionParameters, + DefinitionStages.WithVersion { + /** + * Executes the create request. + * + * @return the created resource. + */ + SavedSearch create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SavedSearch create(Context context); + } + /** The stage of the SavedSearch definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags attached to the saved search.. + * + * @param tags The tags attached to the saved search. + * @return the next definition stage. + */ + WithCreate withTags(List tags); + } + /** The stage of the SavedSearch definition allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: The ETag of the saved search.. + * + * @param etag The ETag of the saved search. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + /** The stage of the SavedSearch definition allowing to specify functionAlias. */ + interface WithFunctionAlias { + /** + * Specifies the functionAlias property: The function alias if query serves as a function.. + * + * @param functionAlias The function alias if query serves as a function. + * @return the next definition stage. + */ + WithCreate withFunctionAlias(String functionAlias); + } + /** The stage of the SavedSearch definition allowing to specify functionParameters. */ + interface WithFunctionParameters { + /** + * Specifies the functionParameters property: The optional function parameters if query serves as a + * function. Value should be in the following format: 'param-name1:type1 = default_value1, param-name2:type2 + * = default_value2'. For more examples and proper syntax please refer to + * https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions.. + * + * @param functionParameters The optional function parameters if query serves as a function. Value should be + * in the following format: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. + * For more examples and proper syntax please refer to + * https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + * @return the next definition stage. + */ + WithCreate withFunctionParameters(String functionParameters); + } + /** The stage of the SavedSearch definition allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: The version number of the query language. The current version is 2 and is + * the default.. + * + * @param version The version number of the query language. The current version is 2 and is the default. + * @return the next definition stage. + */ + WithCreate withVersion(Long version); + } + } + /** + * Begins update for the SavedSearch resource. + * + * @return the stage of resource update. + */ + SavedSearch.Update update(); + + /** The template for SavedSearch update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithEtag, + UpdateStages.WithCategory, + UpdateStages.WithDisplayName, + UpdateStages.WithQuery, + UpdateStages.WithFunctionAlias, + UpdateStages.WithFunctionParameters, + UpdateStages.WithVersion { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SavedSearch apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SavedSearch apply(Context context); + } + /** The SavedSearch update stages. */ + interface UpdateStages { + /** The stage of the SavedSearch update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags attached to the saved search.. + * + * @param tags The tags attached to the saved search. + * @return the next definition stage. + */ + Update withTags(List tags); + } + /** The stage of the SavedSearch update allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: The ETag of the saved search.. + * + * @param etag The ETag of the saved search. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + /** The stage of the SavedSearch update allowing to specify category. */ + interface WithCategory { + /** + * Specifies the category property: The category of the saved search. This helps the user to find a saved + * search faster. . + * + * @param category The category of the saved search. This helps the user to find a saved search faster. + * @return the next definition stage. + */ + Update withCategory(String category); + } + /** The stage of the SavedSearch update allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: Saved search display name.. + * + * @param displayName Saved search display name. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + /** The stage of the SavedSearch update allowing to specify query. */ + interface WithQuery { + /** + * Specifies the query property: The query expression for the saved search.. + * + * @param query The query expression for the saved search. + * @return the next definition stage. + */ + Update withQuery(String query); + } + /** The stage of the SavedSearch update allowing to specify functionAlias. */ + interface WithFunctionAlias { + /** + * Specifies the functionAlias property: The function alias if query serves as a function.. + * + * @param functionAlias The function alias if query serves as a function. + * @return the next definition stage. + */ + Update withFunctionAlias(String functionAlias); + } + /** The stage of the SavedSearch update allowing to specify functionParameters. */ + interface WithFunctionParameters { + /** + * Specifies the functionParameters property: The optional function parameters if query serves as a + * function. Value should be in the following format: 'param-name1:type1 = default_value1, param-name2:type2 + * = default_value2'. For more examples and proper syntax please refer to + * https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions.. + * + * @param functionParameters The optional function parameters if query serves as a function. Value should be + * in the following format: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. + * For more examples and proper syntax please refer to + * https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + * @return the next definition stage. + */ + Update withFunctionParameters(String functionParameters); + } + /** The stage of the SavedSearch update allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: The version number of the query language. The current version is 2 and is + * the default.. + * + * @param version The version number of the query language. The current version is 2 and is the default. + * @return the next definition stage. + */ + Update withVersion(Long version); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SavedSearch refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SavedSearch refresh(Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearches.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearches.java new file mode 100644 index 0000000000000..5a3cf45239d59 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearches.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SavedSearches. */ +public interface SavedSearches { + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 workspaceName, String savedSearchId); + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 response. + */ + Response deleteWithResponse( + String resourceGroupName, String workspaceName, String savedSearchId, Context context); + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 specified saved search for a given workspace. + */ + SavedSearch get(String resourceGroupName, String workspaceName, String savedSearchId); + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 specified saved search for a given workspace. + */ + Response getWithResponse( + String resourceGroupName, String workspaceName, String savedSearchId, Context context); + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 saved searches for a given Log Analytics Workspace. + */ + SavedSearchesListResult listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 saved searches for a given Log Analytics Workspace. + */ + Response listByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, Context context); + + /** + * Gets the specified saved search for a given workspace. + * + * @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 specified saved search for a given workspace. + */ + SavedSearch getById(String id); + + /** + * Gets the specified saved search for a given workspace. + * + * @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 specified saved search for a given workspace. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified saved search in a given workspace. + * + * @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); + + /** + * Deletes the specified saved search in a given workspace. + * + * @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 response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SavedSearch resource. + * + * @param name resource name. + * @return the first stage of the new SavedSearch definition. + */ + SavedSearch.DefinitionStages.Blank define(String name); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearchesListResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearchesListResult.java new file mode 100644 index 0000000000000..23b87b323b11c --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SavedSearchesListResult.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchesListResultInner; +import java.util.List; + +/** An immutable client-side representation of SavedSearchesListResult. */ +public interface SavedSearchesListResult { + /** + * Gets the value property: The array of result values. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.SavedSearchesListResultInner object. + * + * @return the inner object. + */ + SavedSearchesListResultInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Schemas.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Schemas.java new file mode 100644 index 0000000000000..b7d84735a0ab8 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Schemas.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Schemas. */ +public interface Schemas { + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 schema for a given workspace. + */ + SearchGetSchemaResponse get(String resourceGroupName, String workspaceName); + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 schema for a given workspace. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchGetSchemaResponse.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchGetSchemaResponse.java new file mode 100644 index 0000000000000..86f53b72e3665 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchGetSchemaResponse.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.SearchGetSchemaResponseInner; +import java.util.List; + +/** An immutable client-side representation of SearchGetSchemaResponse. */ +public interface SearchGetSchemaResponse { + /** + * Gets the metadata property: The metadata from search results. + * + * @return the metadata value. + */ + SearchMetadata metadata(); + + /** + * Gets the value property: The array of result values. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.SearchGetSchemaResponseInner object. + * + * @return the inner object. + */ + SearchGetSchemaResponseInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchMetadata.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchMetadata.java new file mode 100644 index 0000000000000..d133fe8b634f9 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchMetadata.java @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Metadata for search results. */ +@Fluent +public final class SearchMetadata { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SearchMetadata.class); + + /* + * The request id of the search. + */ + @JsonProperty(value = "requestId") + private String searchId; + + /* + * The search result type. + */ + @JsonProperty(value = "resultType") + private String resultType; + + /* + * The total number of search results. + */ + @JsonProperty(value = "total") + private Long total; + + /* + * The number of top search results. + */ + @JsonProperty(value = "top") + private Long top; + + /* + * The id of the search results request. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The core summaries. + */ + @JsonProperty(value = "coreSummaries") + private List coreSummaries; + + /* + * The status of the search results. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The start time for the search. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * The time of last update. + */ + @JsonProperty(value = "lastUpdated") + private OffsetDateTime lastUpdated; + + /* + * The ETag of the search results. + */ + @JsonProperty(value = "eTag") + private String etag; + + /* + * How the results are sorted. + */ + @JsonProperty(value = "sort") + private List sort; + + /* + * The request time. + */ + @JsonProperty(value = "requestTime") + private Long requestTime; + + /* + * The aggregated value field. + */ + @JsonProperty(value = "aggregatedValueField") + private String aggregatedValueField; + + /* + * The aggregated grouping fields. + */ + @JsonProperty(value = "aggregatedGroupingFields") + private String aggregatedGroupingFields; + + /* + * The sum of all aggregates returned in the result set. + */ + @JsonProperty(value = "sum") + private Long sum; + + /* + * The max of all aggregates returned in the result set. + */ + @JsonProperty(value = "max") + private Long max; + + /* + * The schema. + */ + @JsonProperty(value = "schema") + private SearchMetadataSchema schema; + + /** + * Get the searchId property: The request id of the search. + * + * @return the searchId value. + */ + public String searchId() { + return this.searchId; + } + + /** + * Set the searchId property: The request id of the search. + * + * @param searchId the searchId value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withSearchId(String searchId) { + this.searchId = searchId; + return this; + } + + /** + * Get the resultType property: The search result type. + * + * @return the resultType value. + */ + public String resultType() { + return this.resultType; + } + + /** + * Set the resultType property: The search result type. + * + * @param resultType the resultType value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withResultType(String resultType) { + this.resultType = resultType; + return this; + } + + /** + * Get the total property: The total number of search results. + * + * @return the total value. + */ + public Long total() { + return this.total; + } + + /** + * Set the total property: The total number of search results. + * + * @param total the total value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withTotal(Long total) { + this.total = total; + return this; + } + + /** + * Get the top property: The number of top search results. + * + * @return the top value. + */ + public Long top() { + return this.top; + } + + /** + * Set the top property: The number of top search results. + * + * @param top the top value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withTop(Long top) { + this.top = top; + return this; + } + + /** + * Get the id property: The id of the search results request. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The id of the search results request. + * + * @param id the id value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withId(String id) { + this.id = id; + return this; + } + + /** + * Get the coreSummaries property: The core summaries. + * + * @return the coreSummaries value. + */ + public List coreSummaries() { + return this.coreSummaries; + } + + /** + * Set the coreSummaries property: The core summaries. + * + * @param coreSummaries the coreSummaries value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withCoreSummaries(List coreSummaries) { + this.coreSummaries = coreSummaries; + return this; + } + + /** + * Get the status property: The status of the search results. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the search results. + * + * @param status the status value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the startTime property: The start time for the search. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time for the search. + * + * @param startTime the startTime value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the lastUpdated property: The time of last update. + * + * @return the lastUpdated value. + */ + public OffsetDateTime lastUpdated() { + return this.lastUpdated; + } + + /** + * Set the lastUpdated property: The time of last update. + * + * @param lastUpdated the lastUpdated value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withLastUpdated(OffsetDateTime lastUpdated) { + this.lastUpdated = lastUpdated; + return this; + } + + /** + * Get the etag property: The ETag of the search results. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The ETag of the search results. + * + * @param etag the etag value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the sort property: How the results are sorted. + * + * @return the sort value. + */ + public List sort() { + return this.sort; + } + + /** + * Set the sort property: How the results are sorted. + * + * @param sort the sort value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withSort(List sort) { + this.sort = sort; + return this; + } + + /** + * Get the requestTime property: The request time. + * + * @return the requestTime value. + */ + public Long requestTime() { + return this.requestTime; + } + + /** + * Set the requestTime property: The request time. + * + * @param requestTime the requestTime value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withRequestTime(Long requestTime) { + this.requestTime = requestTime; + return this; + } + + /** + * Get the aggregatedValueField property: The aggregated value field. + * + * @return the aggregatedValueField value. + */ + public String aggregatedValueField() { + return this.aggregatedValueField; + } + + /** + * Set the aggregatedValueField property: The aggregated value field. + * + * @param aggregatedValueField the aggregatedValueField value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withAggregatedValueField(String aggregatedValueField) { + this.aggregatedValueField = aggregatedValueField; + return this; + } + + /** + * Get the aggregatedGroupingFields property: The aggregated grouping fields. + * + * @return the aggregatedGroupingFields value. + */ + public String aggregatedGroupingFields() { + return this.aggregatedGroupingFields; + } + + /** + * Set the aggregatedGroupingFields property: The aggregated grouping fields. + * + * @param aggregatedGroupingFields the aggregatedGroupingFields value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withAggregatedGroupingFields(String aggregatedGroupingFields) { + this.aggregatedGroupingFields = aggregatedGroupingFields; + return this; + } + + /** + * Get the sum property: The sum of all aggregates returned in the result set. + * + * @return the sum value. + */ + public Long sum() { + return this.sum; + } + + /** + * Set the sum property: The sum of all aggregates returned in the result set. + * + * @param sum the sum value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withSum(Long sum) { + this.sum = sum; + return this; + } + + /** + * Get the max property: The max of all aggregates returned in the result set. + * + * @return the max value. + */ + public Long max() { + return this.max; + } + + /** + * Set the max property: The max of all aggregates returned in the result set. + * + * @param max the max value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withMax(Long max) { + this.max = max; + return this; + } + + /** + * Get the schema property: The schema. + * + * @return the schema value. + */ + public SearchMetadataSchema schema() { + return this.schema; + } + + /** + * Set the schema property: The schema. + * + * @param schema the schema value to set. + * @return the SearchMetadata object itself. + */ + public SearchMetadata withSchema(SearchMetadataSchema schema) { + this.schema = schema; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (coreSummaries() != null) { + coreSummaries().forEach(e -> e.validate()); + } + if (sort() != null) { + sort().forEach(e -> e.validate()); + } + if (schema() != null) { + schema().validate(); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchMetadataSchema.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchMetadataSchema.java new file mode 100644 index 0000000000000..18e2da11b27bf --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchMetadataSchema.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Schema metadata for search. */ +@Fluent +public final class SearchMetadataSchema { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SearchMetadataSchema.class); + + /* + * The name of the metadata schema. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The version of the metadata schema. + */ + @JsonProperty(value = "version") + private Integer version; + + /** + * Get the name property: The name of the metadata schema. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the metadata schema. + * + * @param name the name value to set. + * @return the SearchMetadataSchema object itself. + */ + public SearchMetadataSchema withName(String name) { + this.name = name; + return this; + } + + /** + * Get the version property: The version of the metadata schema. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Set the version property: The version of the metadata schema. + * + * @param version the version value to set. + * @return the SearchMetadataSchema object itself. + */ + public SearchMetadataSchema withVersion(Integer version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSchemaValue.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSchemaValue.java new file mode 100644 index 0000000000000..438d17a294e0a --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSchemaValue.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Value object for schema results. */ +@Fluent +public final class SearchSchemaValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SearchSchemaValue.class); + + /* + * The name of the schema. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The display name of the schema. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The type. + */ + @JsonProperty(value = "type") + private String type; + + /* + * The boolean that indicates the field is searchable as free text. + */ + @JsonProperty(value = "indexed", required = true) + private boolean indexed; + + /* + * The boolean that indicates whether or not the field is stored. + */ + @JsonProperty(value = "stored", required = true) + private boolean stored; + + /* + * The boolean that indicates whether or not the field is a facet. + */ + @JsonProperty(value = "facet", required = true) + private boolean facet; + + /* + * The array of workflows containing the field. + */ + @JsonProperty(value = "ownerType") + private List ownerType; + + /** + * Get the name property: The name of the schema. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the schema. + * + * @param name the name value to set. + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: The display name of the schema. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the schema. + * + * @param displayName the displayName value to set. + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the type property: The type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type. + * + * @param type the type value to set. + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withType(String type) { + this.type = type; + return this; + } + + /** + * Get the indexed property: The boolean that indicates the field is searchable as free text. + * + * @return the indexed value. + */ + public boolean indexed() { + return this.indexed; + } + + /** + * Set the indexed property: The boolean that indicates the field is searchable as free text. + * + * @param indexed the indexed value to set. + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withIndexed(boolean indexed) { + this.indexed = indexed; + return this; + } + + /** + * Get the stored property: The boolean that indicates whether or not the field is stored. + * + * @return the stored value. + */ + public boolean stored() { + return this.stored; + } + + /** + * Set the stored property: The boolean that indicates whether or not the field is stored. + * + * @param stored the stored value to set. + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withStored(boolean stored) { + this.stored = stored; + return this; + } + + /** + * Get the facet property: The boolean that indicates whether or not the field is a facet. + * + * @return the facet value. + */ + public boolean facet() { + return this.facet; + } + + /** + * Set the facet property: The boolean that indicates whether or not the field is a facet. + * + * @param facet the facet value to set. + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withFacet(boolean facet) { + this.facet = facet; + return this; + } + + /** + * Get the ownerType property: The array of workflows containing the field. + * + * @return the ownerType value. + */ + public List ownerType() { + return this.ownerType; + } + + /** + * Set the ownerType property: The array of workflows containing the field. + * + * @param ownerType the ownerType value to set. + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withOwnerType(List ownerType) { + this.ownerType = ownerType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSort.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSort.java new file mode 100644 index 0000000000000..3cefd04041d6b --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSort.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The sort parameters for search. */ +@Fluent +public final class SearchSort { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SearchSort.class); + + /* + * The name of the field the search query is sorted on. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The sort order of the search. + */ + @JsonProperty(value = "order") + private SearchSortEnum order; + + /** + * Get the name property: The name of the field the search query is sorted on. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the field the search query is sorted on. + * + * @param name the name value to set. + * @return the SearchSort object itself. + */ + public SearchSort withName(String name) { + this.name = name; + return this; + } + + /** + * Get the order property: The sort order of the search. + * + * @return the order value. + */ + public SearchSortEnum order() { + return this.order; + } + + /** + * Set the order property: The sort order of the search. + * + * @param order the order value to set. + * @return the SearchSort object itself. + */ + public SearchSort withOrder(SearchSortEnum order) { + this.order = order; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSortEnum.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSortEnum.java new file mode 100644 index 0000000000000..f29c8cee80e39 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SearchSortEnum.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SearchSortEnum. */ +public final class SearchSortEnum extends ExpandableStringEnum { + /** Static value asc for SearchSortEnum. */ + public static final SearchSortEnum ASC = fromString("asc"); + + /** Static value desc for SearchSortEnum. */ + public static final SearchSortEnum DESC = fromString("desc"); + + /** + * Creates or finds a SearchSortEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding SearchSortEnum. + */ + @JsonCreator + public static SearchSortEnum fromString(String name) { + return fromString(name, SearchSortEnum.class); + } + + /** @return known SearchSortEnum values. */ + public static Collection values() { + return values(SearchSortEnum.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SharedKeys.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SharedKeys.java new file mode 100644 index 0000000000000..1f058fa6bdbba --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SharedKeys.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.SharedKeysInner; + +/** An immutable client-side representation of SharedKeys. */ +public interface SharedKeys { + /** + * Gets the primarySharedKey property: The primary shared key of a workspace. + * + * @return the primarySharedKey value. + */ + String primarySharedKey(); + + /** + * Gets the secondarySharedKey property: The secondary shared key of a workspace. + * + * @return the secondarySharedKey value. + */ + String secondarySharedKey(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.SharedKeysInner object. + * + * @return the inner object. + */ + SharedKeysInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SharedKeysOperations.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SharedKeysOperations.java new file mode 100644 index 0000000000000..e5f115d160cce --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SharedKeysOperations.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SharedKeysOperations. */ +public interface SharedKeysOperations { + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + SharedKeys getSharedKeys(String resourceGroupName, String workspaceName); + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + Response getSharedKeysWithResponse(String resourceGroupName, String workspaceName, Context context); + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational + * Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + SharedKeys regenerate(String resourceGroupName, String workspaceName); + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational + * Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 shared keys for a workspace. + */ + Response regenerateWithResponse(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SkuNameEnum.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SkuNameEnum.java new file mode 100644 index 0000000000000..b8a8c026fdad8 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/SkuNameEnum.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SkuNameEnum. */ +public final class SkuNameEnum extends ExpandableStringEnum { + /** Static value Free for SkuNameEnum. */ + public static final SkuNameEnum FREE = fromString("Free"); + + /** Static value Standard for SkuNameEnum. */ + public static final SkuNameEnum STANDARD = fromString("Standard"); + + /** Static value Premium for SkuNameEnum. */ + public static final SkuNameEnum PREMIUM = fromString("Premium"); + + /** Static value PerNode for SkuNameEnum. */ + public static final SkuNameEnum PER_NODE = fromString("PerNode"); + + /** Static value PerGB2018 for SkuNameEnum. */ + public static final SkuNameEnum PER_GB2018 = fromString("PerGB2018"); + + /** Static value Standalone for SkuNameEnum. */ + public static final SkuNameEnum STANDALONE = fromString("Standalone"); + + /** Static value CapacityReservation for SkuNameEnum. */ + public static final SkuNameEnum CAPACITY_RESERVATION = fromString("CapacityReservation"); + + /** + * Creates or finds a SkuNameEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuNameEnum. + */ + @JsonCreator + public static SkuNameEnum fromString(String name) { + return fromString(name, SkuNameEnum.class); + } + + /** @return known SkuNameEnum values. */ + public static Collection values() { + return values(SkuNameEnum.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageAccount.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageAccount.java new file mode 100644 index 0000000000000..dc42fad949219 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageAccount.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a storage account connection. */ +@Fluent +public final class StorageAccount { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageAccount.class); + + /* + * The Azure Resource Manager ID of the storage account resource. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The storage account key. + */ + @JsonProperty(value = "key", required = true) + private String key; + + /** + * Get the id property: The Azure Resource Manager ID of the storage account resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The Azure Resource Manager ID of the storage account resource. + * + * @param id the id value to set. + * @return the StorageAccount object itself. + */ + public StorageAccount withId(String id) { + this.id = id; + return this; + } + + /** + * Get the key property: The storage account key. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: The storage account key. + * + * @param key the key value to set. + * @return the StorageAccount object itself. + */ + public StorageAccount withKey(String key) { + this.key = key; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model StorageAccount")); + } + if (key() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property key in model StorageAccount")); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsight.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsight.java new file mode 100644 index 0000000000000..1dade7415c16a --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsight.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.StorageInsightInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of StorageInsight. */ +public interface StorageInsight { + /** + * 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 etag property: The ETag of the storage insight. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the containers property: The names of the blob containers that the workspace should read. + * + * @return the containers value. + */ + List containers(); + + /** + * Gets the tables property: The names of the Azure tables that the workspace should read. + * + * @return the tables value. + */ + List tables(); + + /** + * Gets the storageAccount property: The storage account connection details. + * + * @return the storageAccount value. + */ + StorageAccount storageAccount(); + + /** + * Gets the status property: The status of the storage insight. + * + * @return the status value. + */ + StorageInsightStatus status(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.StorageInsightInner object. + * + * @return the inner object. + */ + StorageInsightInner innerModel(); + + /** The entirety of the StorageInsight definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The StorageInsight definition stages. */ + interface DefinitionStages { + /** The first stage of the StorageInsight definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the StorageInsight definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + /** + * The stage of the StorageInsight 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.WithEtag, + DefinitionStages.WithContainers, + DefinitionStages.WithTables, + DefinitionStages.WithStorageAccount { + /** + * Executes the create request. + * + * @return the created resource. + */ + StorageInsight create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + StorageInsight create(Context context); + } + /** The stage of the StorageInsight definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the StorageInsight definition allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: The ETag of the storage insight.. + * + * @param etag The ETag of the storage insight. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + /** The stage of the StorageInsight definition allowing to specify containers. */ + interface WithContainers { + /** + * Specifies the containers property: The names of the blob containers that the workspace should read. + * + * @param containers The names of the blob containers that the workspace should read. + * @return the next definition stage. + */ + WithCreate withContainers(List containers); + } + /** The stage of the StorageInsight definition allowing to specify tables. */ + interface WithTables { + /** + * Specifies the tables property: The names of the Azure tables that the workspace should read. + * + * @param tables The names of the Azure tables that the workspace should read. + * @return the next definition stage. + */ + WithCreate withTables(List tables); + } + /** The stage of the StorageInsight definition allowing to specify storageAccount. */ + interface WithStorageAccount { + /** + * Specifies the storageAccount property: The storage account connection details. + * + * @param storageAccount The storage account connection details. + * @return the next definition stage. + */ + WithCreate withStorageAccount(StorageAccount storageAccount); + } + } + /** + * Begins update for the StorageInsight resource. + * + * @return the stage of resource update. + */ + StorageInsight.Update update(); + + /** The template for StorageInsight update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithEtag, + UpdateStages.WithContainers, + UpdateStages.WithTables, + UpdateStages.WithStorageAccount { + /** + * Executes the update request. + * + * @return the updated resource. + */ + StorageInsight apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + StorageInsight apply(Context context); + } + /** The StorageInsight update stages. */ + interface UpdateStages { + /** The stage of the StorageInsight update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the StorageInsight update allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: The ETag of the storage insight.. + * + * @param etag The ETag of the storage insight. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + /** The stage of the StorageInsight update allowing to specify containers. */ + interface WithContainers { + /** + * Specifies the containers property: The names of the blob containers that the workspace should read. + * + * @param containers The names of the blob containers that the workspace should read. + * @return the next definition stage. + */ + Update withContainers(List containers); + } + /** The stage of the StorageInsight update allowing to specify tables. */ + interface WithTables { + /** + * Specifies the tables property: The names of the Azure tables that the workspace should read. + * + * @param tables The names of the Azure tables that the workspace should read. + * @return the next definition stage. + */ + Update withTables(List tables); + } + /** The stage of the StorageInsight update allowing to specify storageAccount. */ + interface WithStorageAccount { + /** + * Specifies the storageAccount property: The storage account connection details. + * + * @param storageAccount The storage account connection details. + * @return the next definition stage. + */ + Update withStorageAccount(StorageAccount storageAccount); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + StorageInsight refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + StorageInsight refresh(Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightConfigs.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightConfigs.java new file mode 100644 index 0000000000000..09b6dca63aef6 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightConfigs.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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 StorageInsightConfigs. */ +public interface StorageInsightConfigs { + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 storage insight instance. + */ + StorageInsight get(String resourceGroupName, String workspaceName, String storageInsightName); + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 storage insight instance. + */ + Response getWithResponse( + String resourceGroupName, String workspaceName, String storageInsightName, Context context); + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 workspaceName, String storageInsightName); + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource. + * @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 response. + */ + Response deleteWithResponse( + String resourceGroupName, String workspaceName, String storageInsightName, Context context); + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list storage insights operation response. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list storage insights operation response. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a storage insight instance. + * + * @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 a storage insight instance. + */ + StorageInsight getById(String id); + + /** + * Gets a storage insight instance. + * + * @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 a storage insight instance. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a storageInsightsConfigs 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); + + /** + * Deletes a storageInsightsConfigs 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 response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new StorageInsight resource. + * + * @param name resource name. + * @return the first stage of the new StorageInsight definition. + */ + StorageInsight.DefinitionStages.Blank define(String name); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightListResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightListResult.java new file mode 100644 index 0000000000000..d41d3a29bb055 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.StorageInsightInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list storage insights operation response. */ +@Fluent +public final class StorageInsightListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageInsightListResult.class); + + /* + * A list of storage insight items. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "@odata.nextLink") + private String odataNextLink; + + /** + * Get the value property: A list of storage insight items. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of storage insight items. + * + * @param value the value value to set. + * @return the StorageInsightListResult object itself. + */ + public StorageInsightListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the odataNextLink property: The link (url) to the next page of results. + * + * @return the odataNextLink value. + */ + public String odataNextLink() { + return this.odataNextLink; + } + + /** + * Set the odataNextLink property: The link (url) to the next page of results. + * + * @param odataNextLink the odataNextLink value to set. + * @return the StorageInsightListResult object itself. + */ + public StorageInsightListResult withOdataNextLink(String odataNextLink) { + this.odataNextLink = odataNextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightState.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightState.java new file mode 100644 index 0000000000000..3d3f9b8946592 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightState.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageInsightState. */ +public final class StorageInsightState extends ExpandableStringEnum { + /** Static value OK for StorageInsightState. */ + public static final StorageInsightState OK = fromString("OK"); + + /** Static value ERROR for StorageInsightState. */ + public static final StorageInsightState ERROR = fromString("ERROR"); + + /** + * Creates or finds a StorageInsightState from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageInsightState. + */ + @JsonCreator + public static StorageInsightState fromString(String name) { + return fromString(name, StorageInsightState.class); + } + + /** @return known StorageInsightState values. */ + public static Collection values() { + return values(StorageInsightState.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightStatus.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightStatus.java new file mode 100644 index 0000000000000..faad012f25e2a --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/StorageInsightStatus.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The status of the storage insight. */ +@Fluent +public final class StorageInsightStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageInsightStatus.class); + + /* + * The state of the storage insight connection to the workspace + */ + @JsonProperty(value = "state", required = true) + private StorageInsightState state; + + /* + * Description of the state of the storage insight. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the state property: The state of the storage insight connection to the workspace. + * + * @return the state value. + */ + public StorageInsightState state() { + return this.state; + } + + /** + * Set the state property: The state of the storage insight connection to the workspace. + * + * @param state the state value to set. + * @return the StorageInsightStatus object itself. + */ + public StorageInsightStatus withState(StorageInsightState state) { + this.state = state; + return this; + } + + /** + * Get the description property: Description of the state of the storage insight. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the state of the storage insight. + * + * @param description the description value to set. + * @return the StorageInsightStatus object itself. + */ + public StorageInsightStatus withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property state in model StorageInsightStatus")); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Table.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Table.java new file mode 100644 index 0000000000000..c4a2fa65b8f66 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Table.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.TableInner; + +/** An immutable client-side representation of Table. */ +public interface Table { + /** + * 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 retentionInDays property: The data table data retention in days, between 30 and 730. Setting this + * property to null will default to the workspace retention. + * + * @return the retentionInDays value. + */ + Integer retentionInDays(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.TableInner object. + * + * @return the inner object. + */ + TableInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Tables.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Tables.java new file mode 100644 index 0000000000000..e697d20096aed --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Tables.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.TableInner; + +/** Resource collection API of Tables. */ +public interface Tables { + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all the tables for the specified Log Analytics workspace. + */ + PagedIterable

listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 all the tables for the specified Log Analytics workspace. + */ + PagedIterable
listByWorkspace(String resourceGroupName, String workspaceName, Context context); + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param parameters Workspace data table definition. + * @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 workspace data table definition. + */ + Table update(String resourceGroupName, String workspaceName, String tableName, TableInner parameters); + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param parameters Workspace data table definition. + * @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 workspace data table definition. + */ + Response
updateWithResponse( + String resourceGroupName, String workspaceName, String tableName, TableInner parameters, Context context); + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 Log Analytics workspace table. + */ + Table get(String resourceGroupName, String workspaceName, String tableName); + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 Log Analytics workspace table. + */ + Response
getWithResponse(String resourceGroupName, String workspaceName, String tableName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/TablesListResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/TablesListResult.java new file mode 100644 index 0000000000000..1d0ee2771506e --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/TablesListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.TableInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list tables operation response. */ +@Fluent +public final class TablesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TablesListResult.class); + + /* + * A list of data tables. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: A list of data tables. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of data tables. + * + * @param value the value value to set. + * @return the TablesListResult object itself. + */ + public TablesListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Tag.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Tag.java new file mode 100644 index 0000000000000..fa9f41ed37398 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Tag.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A tag of a saved search. */ +@Fluent +public final class Tag { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Tag.class); + + /* + * The tag name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The tag value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the name property: The tag name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The tag name. + * + * @param name the name value to set. + * @return the Tag object itself. + */ + public Tag withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The tag value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The tag value. + * + * @param value the value value to set. + * @return the Tag object itself. + */ + public Tag withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Tag")); + } + if (value() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property value in model Tag")); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Type.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Type.java new file mode 100644 index 0000000000000..f35aa48b48f72 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Type.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Type. */ +public final class Type extends ExpandableStringEnum { + /** Static value StorageAccount for Type. */ + public static final Type STORAGE_ACCOUNT = fromString("StorageAccount"); + + /** Static value EventHub for Type. */ + public static final Type EVENT_HUB = fromString("EventHub"); + + /** + * Creates or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + @JsonCreator + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** @return known Type values. */ + public static Collection values() { + return values(Type.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/UsageMetric.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/UsageMetric.java new file mode 100644 index 0000000000000..992f017ace478 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/UsageMetric.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.UsageMetricInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of UsageMetric. */ +public interface UsageMetric { + /** + * Gets the name property: The name of the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the unit property: The units used for the metric. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the currentValue property: The current value of the metric. + * + * @return the currentValue value. + */ + Double currentValue(); + + /** + * Gets the limit property: The quota limit for the metric. + * + * @return the limit value. + */ + Double limit(); + + /** + * Gets the nextResetTime property: The time that the metric's value will reset. + * + * @return the nextResetTime value. + */ + OffsetDateTime nextResetTime(); + + /** + * Gets the quotaPeriod property: The quota period that determines the length of time between value resets. + * + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.UsageMetricInner object. + * + * @return the inner object. + */ + UsageMetricInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Usages.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Usages.java new file mode 100644 index 0000000000000..0439331421f37 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Usages.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Usages. */ +public interface Usages { + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list of usage metrics for a workspace. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 list of usage metrics for a workspace. + */ + PagedIterable list(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Workspace.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Workspace.java new file mode 100644 index 0000000000000..3fa7e9ee11f11 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Workspace.java @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspaceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Workspace. */ +public interface Workspace { + /** + * 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 location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the etag property: The ETag of the workspace. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the provisioningState property: The provisioning state of the workspace. + * + * @return the provisioningState value. + */ + WorkspaceEntityStatus provisioningState(); + + /** + * Gets the customerId property: This is a read-only property. Represents the ID associated with the workspace. + * + * @return the customerId value. + */ + String customerId(); + + /** + * Gets the sku property: The SKU of the workspace. + * + * @return the sku value. + */ + WorkspaceSku sku(); + + /** + * Gets the retentionInDays property: The workspace data retention in days, between 30 and 730. + * + * @return the retentionInDays value. + */ + Integer retentionInDays(); + + /** + * Gets the workspaceCapping property: The daily volume cap for ingestion. + * + * @return the workspaceCapping value. + */ + WorkspaceCapping workspaceCapping(); + + /** + * Gets the publicNetworkAccessForIngestion property: The network access type for accessing Log Analytics ingestion. + * + * @return the publicNetworkAccessForIngestion value. + */ + PublicNetworkAccessType publicNetworkAccessForIngestion(); + + /** + * Gets the publicNetworkAccessForQuery property: The network access type for accessing Log Analytics query. + * + * @return the publicNetworkAccessForQuery value. + */ + PublicNetworkAccessType publicNetworkAccessForQuery(); + + /** + * Gets the privateLinkScopedResources property: List of linked private link scope resources. + * + * @return the privateLinkScopedResources value. + */ + List privateLinkScopedResources(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.WorkspaceInner object. + * + * @return the inner object. + */ + WorkspaceInner innerModel(); + + /** The entirety of the Workspace definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Workspace definition stages. */ + interface DefinitionStages { + /** The first stage of the Workspace definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Workspace definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Workspace definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Workspace 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.WithEtag, + DefinitionStages.WithProvisioningState, + DefinitionStages.WithSku, + DefinitionStages.WithRetentionInDays, + DefinitionStages.WithWorkspaceCapping, + DefinitionStages.WithPublicNetworkAccessForIngestion, + DefinitionStages.WithPublicNetworkAccessForQuery { + /** + * Executes the create request. + * + * @return the created resource. + */ + Workspace create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Workspace create(Context context); + } + /** The stage of the Workspace definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Workspace definition allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: The ETag of the workspace.. + * + * @param etag The ETag of the workspace. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + /** The stage of the Workspace definition allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: The provisioning state of the workspace.. + * + * @param provisioningState The provisioning state of the workspace. + * @return the next definition stage. + */ + WithCreate withProvisioningState(WorkspaceEntityStatus provisioningState); + } + /** The stage of the Workspace definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU of the workspace.. + * + * @param sku The SKU of the workspace. + * @return the next definition stage. + */ + WithCreate withSku(WorkspaceSku sku); + } + /** The stage of the Workspace definition allowing to specify retentionInDays. */ + interface WithRetentionInDays { + /** + * Specifies the retentionInDays property: The workspace data retention in days, between 30 and 730.. + * + * @param retentionInDays The workspace data retention in days, between 30 and 730. + * @return the next definition stage. + */ + WithCreate withRetentionInDays(Integer retentionInDays); + } + /** The stage of the Workspace definition allowing to specify workspaceCapping. */ + interface WithWorkspaceCapping { + /** + * Specifies the workspaceCapping property: The daily volume cap for ingestion.. + * + * @param workspaceCapping The daily volume cap for ingestion. + * @return the next definition stage. + */ + WithCreate withWorkspaceCapping(WorkspaceCapping workspaceCapping); + } + /** The stage of the Workspace definition allowing to specify publicNetworkAccessForIngestion. */ + interface WithPublicNetworkAccessForIngestion { + /** + * Specifies the publicNetworkAccessForIngestion property: The network access type for accessing Log + * Analytics ingestion.. + * + * @param publicNetworkAccessForIngestion The network access type for accessing Log Analytics ingestion. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccessForIngestion(PublicNetworkAccessType publicNetworkAccessForIngestion); + } + /** The stage of the Workspace definition allowing to specify publicNetworkAccessForQuery. */ + interface WithPublicNetworkAccessForQuery { + /** + * Specifies the publicNetworkAccessForQuery property: The network access type for accessing Log Analytics + * query.. + * + * @param publicNetworkAccessForQuery The network access type for accessing Log Analytics query. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccessForQuery(PublicNetworkAccessType publicNetworkAccessForQuery); + } + } + /** + * Begins update for the Workspace resource. + * + * @return the stage of resource update. + */ + Workspace.Update update(); + + /** The template for Workspace update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithProvisioningState, + UpdateStages.WithSku, + UpdateStages.WithRetentionInDays, + UpdateStages.WithWorkspaceCapping, + UpdateStages.WithPublicNetworkAccessForIngestion, + UpdateStages.WithPublicNetworkAccessForQuery { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Workspace apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Workspace apply(Context context); + } + /** The Workspace update stages. */ + interface UpdateStages { + /** The stage of the Workspace update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. Optional.. + * + * @param tags Resource tags. Optional. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Workspace update allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: The provisioning state of the workspace.. + * + * @param provisioningState The provisioning state of the workspace. + * @return the next definition stage. + */ + Update withProvisioningState(WorkspaceEntityStatus provisioningState); + } + /** The stage of the Workspace update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU of the workspace.. + * + * @param sku The SKU of the workspace. + * @return the next definition stage. + */ + Update withSku(WorkspaceSku sku); + } + /** The stage of the Workspace update allowing to specify retentionInDays. */ + interface WithRetentionInDays { + /** + * Specifies the retentionInDays property: The workspace data retention in days, between 30 and 730.. + * + * @param retentionInDays The workspace data retention in days, between 30 and 730. + * @return the next definition stage. + */ + Update withRetentionInDays(Integer retentionInDays); + } + /** The stage of the Workspace update allowing to specify workspaceCapping. */ + interface WithWorkspaceCapping { + /** + * Specifies the workspaceCapping property: The daily volume cap for ingestion.. + * + * @param workspaceCapping The daily volume cap for ingestion. + * @return the next definition stage. + */ + Update withWorkspaceCapping(WorkspaceCapping workspaceCapping); + } + /** The stage of the Workspace update allowing to specify publicNetworkAccessForIngestion. */ + interface WithPublicNetworkAccessForIngestion { + /** + * Specifies the publicNetworkAccessForIngestion property: The network access type for accessing Log + * Analytics ingestion.. + * + * @param publicNetworkAccessForIngestion The network access type for accessing Log Analytics ingestion. + * @return the next definition stage. + */ + Update withPublicNetworkAccessForIngestion(PublicNetworkAccessType publicNetworkAccessForIngestion); + } + /** The stage of the Workspace update allowing to specify publicNetworkAccessForQuery. */ + interface WithPublicNetworkAccessForQuery { + /** + * Specifies the publicNetworkAccessForQuery property: The network access type for accessing Log Analytics + * query.. + * + * @param publicNetworkAccessForQuery The network access type for accessing Log Analytics query. + * @return the next definition stage. + */ + Update withPublicNetworkAccessForQuery(PublicNetworkAccessType publicNetworkAccessForQuery); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Workspace refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Workspace refresh(Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceCapping.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceCapping.java new file mode 100644 index 0000000000000..74dccada2e53e --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceCapping.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The daily volume cap for ingestion. */ +@Fluent +public final class WorkspaceCapping { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceCapping.class); + + /* + * The workspace daily quota for ingestion. + */ + @JsonProperty(value = "dailyQuotaGb") + private Double dailyQuotaGb; + + /* + * The time when the quota will be rest. + */ + @JsonProperty(value = "quotaNextResetTime", access = JsonProperty.Access.WRITE_ONLY) + private String quotaNextResetTime; + + /* + * The status of data ingestion for this workspace. + */ + @JsonProperty(value = "dataIngestionStatus", access = JsonProperty.Access.WRITE_ONLY) + private DataIngestionStatus dataIngestionStatus; + + /** + * Get the dailyQuotaGb property: The workspace daily quota for ingestion. + * + * @return the dailyQuotaGb value. + */ + public Double dailyQuotaGb() { + return this.dailyQuotaGb; + } + + /** + * Set the dailyQuotaGb property: The workspace daily quota for ingestion. + * + * @param dailyQuotaGb the dailyQuotaGb value to set. + * @return the WorkspaceCapping object itself. + */ + public WorkspaceCapping withDailyQuotaGb(Double dailyQuotaGb) { + this.dailyQuotaGb = dailyQuotaGb; + return this; + } + + /** + * Get the quotaNextResetTime property: The time when the quota will be rest. + * + * @return the quotaNextResetTime value. + */ + public String quotaNextResetTime() { + return this.quotaNextResetTime; + } + + /** + * Get the dataIngestionStatus property: The status of data ingestion for this workspace. + * + * @return the dataIngestionStatus value. + */ + public DataIngestionStatus dataIngestionStatus() { + return this.dataIngestionStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceEntityStatus.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceEntityStatus.java new file mode 100644 index 0000000000000..72804719b401f --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceEntityStatus.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for WorkspaceEntityStatus. */ +public final class WorkspaceEntityStatus extends ExpandableStringEnum { + /** Static value Creating for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus CREATING = fromString("Creating"); + + /** Static value Succeeded for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus FAILED = fromString("Failed"); + + /** Static value Canceled for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus CANCELED = fromString("Canceled"); + + /** Static value Deleting for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus DELETING = fromString("Deleting"); + + /** Static value ProvisioningAccount for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus PROVISIONING_ACCOUNT = fromString("ProvisioningAccount"); + + /** Static value Updating for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus UPDATING = fromString("Updating"); + + /** + * Creates or finds a WorkspaceEntityStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding WorkspaceEntityStatus. + */ + @JsonCreator + public static WorkspaceEntityStatus fromString(String name) { + return fromString(name, WorkspaceEntityStatus.class); + } + + /** @return known WorkspaceEntityStatus values. */ + public static Collection values() { + return values(WorkspaceEntityStatus.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListManagementGroupsResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListManagementGroupsResult.java new file mode 100644 index 0000000000000..e1d45aefd7b20 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListManagementGroupsResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.ManagementGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list workspace management groups operation response. */ +@Fluent +public final class WorkspaceListManagementGroupsResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceListManagementGroupsResult.class); + + /* + * Gets or sets a list of management groups attached to the workspace. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Gets or sets a list of management groups attached to the workspace. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets a list of management groups attached to the workspace. + * + * @param value the value value to set. + * @return the WorkspaceListManagementGroupsResult object itself. + */ + public WorkspaceListManagementGroupsResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListResult.java new file mode 100644 index 0000000000000..c96e76526cbe9 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspaceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list workspaces operation response. */ +@Fluent +public final class WorkspaceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceListResult.class); + + /* + * A list of workspaces. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: A list of workspaces. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of workspaces. + * + * @param value the value value to set. + * @return the WorkspaceListResult object itself. + */ + public WorkspaceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListUsagesResult.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListUsagesResult.java new file mode 100644 index 0000000000000..4171d149f14b5 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceListUsagesResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loganalytics.fluent.models.UsageMetricInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list workspace usages operation response. */ +@Fluent +public final class WorkspaceListUsagesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceListUsagesResult.class); + + /* + * Gets or sets a list of usage metrics for a workspace. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Gets or sets a list of usage metrics for a workspace. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets a list of usage metrics for a workspace. + * + * @param value the value value to set. + * @return the WorkspaceListUsagesResult object itself. + */ + public WorkspaceListUsagesResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePatch.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePatch.java new file mode 100644 index 0000000000000..e278476f35ad1 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePatch.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The top level Workspace resource container. */ +@JsonFlatten +@Fluent +public class WorkspacePatch extends AzureEntityResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacePatch.class); + + /* + * Resource tags. Optional. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The provisioning state of the workspace. + */ + @JsonProperty(value = "properties.provisioningState") + private WorkspaceEntityStatus provisioningState; + + /* + * This is a read-only property. Represents the ID associated with the + * workspace. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /* + * The SKU of the workspace. + */ + @JsonProperty(value = "properties.sku") + private WorkspaceSku sku; + + /* + * The workspace data retention in days, between 30 and 730. + */ + @JsonProperty(value = "properties.retentionInDays") + private Integer retentionInDays; + + /* + * The daily volume cap for ingestion. + */ + @JsonProperty(value = "properties.workspaceCapping") + private WorkspaceCapping workspaceCapping; + + /* + * The network access type for accessing Log Analytics ingestion. + */ + @JsonProperty(value = "properties.publicNetworkAccessForIngestion") + private PublicNetworkAccessType publicNetworkAccessForIngestion; + + /* + * The network access type for accessing Log Analytics query. + */ + @JsonProperty(value = "properties.publicNetworkAccessForQuery") + private PublicNetworkAccessType publicNetworkAccessForQuery; + + /* + * List of linked private link scope resources. + */ + @JsonProperty(value = "properties.privateLinkScopedResources", access = JsonProperty.Access.WRITE_ONLY) + private List privateLinkScopedResources; + + /** + * Get the tags property: Resource tags. Optional. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. Optional. + * + * @param tags the tags value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the workspace. + * + * @return the provisioningState value. + */ + public WorkspaceEntityStatus provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The provisioning state of the workspace. + * + * @param provisioningState the provisioningState value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withProvisioningState(WorkspaceEntityStatus provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the customerId property: This is a read-only property. Represents the ID associated with the workspace. + * + * @return the customerId value. + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the sku property: The SKU of the workspace. + * + * @return the sku value. + */ + public WorkspaceSku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of the workspace. + * + * @param sku the sku value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withSku(WorkspaceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the retentionInDays property: The workspace data retention in days, between 30 and 730. + * + * @return the retentionInDays value. + */ + public Integer retentionInDays() { + return this.retentionInDays; + } + + /** + * Set the retentionInDays property: The workspace data retention in days, between 30 and 730. + * + * @param retentionInDays the retentionInDays value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withRetentionInDays(Integer retentionInDays) { + this.retentionInDays = retentionInDays; + return this; + } + + /** + * Get the workspaceCapping property: The daily volume cap for ingestion. + * + * @return the workspaceCapping value. + */ + public WorkspaceCapping workspaceCapping() { + return this.workspaceCapping; + } + + /** + * Set the workspaceCapping property: The daily volume cap for ingestion. + * + * @param workspaceCapping the workspaceCapping value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withWorkspaceCapping(WorkspaceCapping workspaceCapping) { + this.workspaceCapping = workspaceCapping; + return this; + } + + /** + * Get the publicNetworkAccessForIngestion property: The network access type for accessing Log Analytics ingestion. + * + * @return the publicNetworkAccessForIngestion value. + */ + public PublicNetworkAccessType publicNetworkAccessForIngestion() { + return this.publicNetworkAccessForIngestion; + } + + /** + * Set the publicNetworkAccessForIngestion property: The network access type for accessing Log Analytics ingestion. + * + * @param publicNetworkAccessForIngestion the publicNetworkAccessForIngestion value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withPublicNetworkAccessForIngestion(PublicNetworkAccessType publicNetworkAccessForIngestion) { + this.publicNetworkAccessForIngestion = publicNetworkAccessForIngestion; + return this; + } + + /** + * Get the publicNetworkAccessForQuery property: The network access type for accessing Log Analytics query. + * + * @return the publicNetworkAccessForQuery value. + */ + public PublicNetworkAccessType publicNetworkAccessForQuery() { + return this.publicNetworkAccessForQuery; + } + + /** + * Set the publicNetworkAccessForQuery property: The network access type for accessing Log Analytics query. + * + * @param publicNetworkAccessForQuery the publicNetworkAccessForQuery value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withPublicNetworkAccessForQuery(PublicNetworkAccessType publicNetworkAccessForQuery) { + this.publicNetworkAccessForQuery = publicNetworkAccessForQuery; + return this; + } + + /** + * Get the privateLinkScopedResources property: List of linked private link scope resources. + * + * @return the privateLinkScopedResources value. + */ + public List privateLinkScopedResources() { + return this.privateLinkScopedResources; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sku() != null) { + sku().validate(); + } + if (workspaceCapping() != null) { + workspaceCapping().validate(); + } + if (privateLinkScopedResources() != null) { + privateLinkScopedResources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeBody.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeBody.java new file mode 100644 index 0000000000000..5c5af249f80bb --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeBody.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the body of a purge request for an App Insights Workspace. */ +@Fluent +public final class WorkspacePurgeBody { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacePurgeBody.class); + + /* + * Table from which to purge data. + */ + @JsonProperty(value = "table", required = true) + private String table; + + /* + * The set of columns and filters (queries) to run over them to purge the + * resulting data. + */ + @JsonProperty(value = "filters", required = true) + private List filters; + + /** + * Get the table property: Table from which to purge data. + * + * @return the table value. + */ + public String table() { + return this.table; + } + + /** + * Set the table property: Table from which to purge data. + * + * @param table the table value to set. + * @return the WorkspacePurgeBody object itself. + */ + public WorkspacePurgeBody withTable(String table) { + this.table = table; + return this; + } + + /** + * Get the filters property: The set of columns and filters (queries) to run over them to purge the resulting data. + * + * @return the filters value. + */ + public List filters() { + return this.filters; + } + + /** + * Set the filters property: The set of columns and filters (queries) to run over them to purge the resulting data. + * + * @param filters the filters value to set. + * @return the WorkspacePurgeBody object itself. + */ + public WorkspacePurgeBody withFilters(List filters) { + this.filters = filters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (table() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property table in model WorkspacePurgeBody")); + } + if (filters() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property filters in model WorkspacePurgeBody")); + } else { + filters().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeBodyFilters.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeBodyFilters.java new file mode 100644 index 0000000000000..b6870c2de7f59 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeBodyFilters.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** User-defined filters to return data which will be purged from the table. */ +@Fluent +public final class WorkspacePurgeBodyFilters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacePurgeBodyFilters.class); + + /* + * The column of the table over which the given query should run + */ + @JsonProperty(value = "column") + private String column; + + /* + * A query operator to evaluate over the provided column and value(s). + * Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have + * the same behavior as they would in a KQL query. + */ + @JsonProperty(value = "operator") + private String operator; + + /* + * the value for the operator to function over. This can be a number (e.g., + * > 100), a string (timestamp >= '2017-09-01') or array of values. + */ + @JsonProperty(value = "value") + private Object value; + + /* + * When filtering over custom dimensions, this key will be used as the name + * of the custom dimension. + */ + @JsonProperty(value = "key") + private String key; + + /** + * Get the column property: The column of the table over which the given query should run. + * + * @return the column value. + */ + public String column() { + return this.column; + } + + /** + * Set the column property: The column of the table over which the given query should run. + * + * @param column the column value to set. + * @return the WorkspacePurgeBodyFilters object itself. + */ + public WorkspacePurgeBodyFilters withColumn(String column) { + this.column = column; + return this; + } + + /** + * Get the operator property: A query operator to evaluate over the provided column and value(s). Supported + * operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would in a + * KQL query. + * + * @return the operator value. + */ + public String operator() { + return this.operator; + } + + /** + * Set the operator property: A query operator to evaluate over the provided column and value(s). Supported + * operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would in a + * KQL query. + * + * @param operator the operator value to set. + * @return the WorkspacePurgeBodyFilters object itself. + */ + public WorkspacePurgeBodyFilters withOperator(String operator) { + this.operator = operator; + return this; + } + + /** + * Get the value property: the value for the operator to function over. This can be a number (e.g., > 100), a + * string (timestamp >= '2017-09-01') or array of values. + * + * @return the value value. + */ + public Object value() { + return this.value; + } + + /** + * Set the value property: the value for the operator to function over. This can be a number (e.g., > 100), a + * string (timestamp >= '2017-09-01') or array of values. + * + * @param value the value value to set. + * @return the WorkspacePurgeBodyFilters object itself. + */ + public WorkspacePurgeBodyFilters withValue(Object value) { + this.value = value; + return this; + } + + /** + * Get the key property: When filtering over custom dimensions, this key will be used as the name of the custom + * dimension. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: When filtering over custom dimensions, this key will be used as the name of the custom + * dimension. + * + * @param key the key value to set. + * @return the WorkspacePurgeBodyFilters object itself. + */ + public WorkspacePurgeBodyFilters withKey(String key) { + this.key = key; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeResponse.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeResponse.java new file mode 100644 index 0000000000000..ecd429336383f --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeResponse.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.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeResponseInner; + +/** An immutable client-side representation of WorkspacePurgeResponse. */ +public interface WorkspacePurgeResponse { + /** + * Gets the operationId property: Id to use when querying for status for a particular purge operation. + * + * @return the operationId value. + */ + String operationId(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeResponseInner object. + * + * @return the inner object. + */ + WorkspacePurgeResponseInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeStatusResponse.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeStatusResponse.java new file mode 100644 index 0000000000000..68a786dc80b22 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgeStatusResponse.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.loganalytics.models; + +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeStatusResponseInner; + +/** An immutable client-side representation of WorkspacePurgeStatusResponse. */ +public interface WorkspacePurgeStatusResponse { + /** + * Gets the status property: Status of the operation represented by the requested Id. + * + * @return the status value. + */ + PurgeState status(); + + /** + * Gets the inner com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeStatusResponseInner object. + * + * @return the inner object. + */ + WorkspacePurgeStatusResponseInner innerModel(); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurges.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurges.java new file mode 100644 index 0000000000000..288afd189bfc3 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurges.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of WorkspacePurges. */ +public interface WorkspacePurges { + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + * + *

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch + * the execution of purge requests by sending a single command whose predicate includes all user identities that + * require purging. Use the in operator to specify multiple identities. You should run the query prior to using for + * a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a purge request for an App Insights Workspace. + * @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 response containing operationId for a specific purge action. + */ + WorkspacePurgeResponse purge(String resourceGroupName, String workspaceName, WorkspacePurgeBody body); + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + * + *

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch + * the execution of purge requests by sending a single command whose predicate includes all user identities that + * require purging. Use the in operator to specify multiple identities. You should run the query prior to using for + * a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a purge request for an App Insights Workspace. + * @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 response containing operationId for a specific purge action. + */ + Response purgeWithResponse( + String resourceGroupName, String workspaceName, WorkspacePurgeBody body, Context context); + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @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 status of an ongoing purge operation. + */ + WorkspacePurgeStatusResponse getPurgeStatus(String resourceGroupName, String workspaceName, String purgeId); + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @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 status of an ongoing purge operation. + */ + Response getPurgeStatusWithResponse( + String resourceGroupName, String workspaceName, String purgeId, Context context); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgesPurgeHeaders.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgesPurgeHeaders.java new file mode 100644 index 0000000000000..8cd928bff6bde --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgesPurgeHeaders.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The WorkspacePurgesPurgeHeaders model. */ +@Fluent +public final class WorkspacePurgesPurgeHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacePurgesPurgeHeaders.class); + + /* + * The x-ms-status-location property. + */ + @JsonProperty(value = "x-ms-status-location") + private String xMsStatusLocation; + + /** + * Get the xMsStatusLocation property: The x-ms-status-location property. + * + * @return the xMsStatusLocation value. + */ + public String xMsStatusLocation() { + return this.xMsStatusLocation; + } + + /** + * Set the xMsStatusLocation property: The x-ms-status-location property. + * + * @param xMsStatusLocation the xMsStatusLocation value to set. + * @return the WorkspacePurgesPurgeHeaders object itself. + */ + public WorkspacePurgesPurgeHeaders withXMsStatusLocation(String xMsStatusLocation) { + this.xMsStatusLocation = xMsStatusLocation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgesPurgeResponse.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgesPurgeResponse.java new file mode 100644 index 0000000000000..fd2237191d2d0 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspacePurgesPurgeResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.loganalytics.fluent.models.WorkspacePurgeResponseInner; + +/** Contains all response data for the purge operation. */ +public final class WorkspacePurgesPurgeResponse + extends ResponseBase { + /** + * Creates an instance of WorkspacePurgesPurgeResponse. + * + * @param request the request which resulted in this WorkspacePurgesPurgeResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public WorkspacePurgesPurgeResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + WorkspacePurgeResponseInner value, + WorkspacePurgesPurgeHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public WorkspacePurgeResponseInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceSku.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceSku.java new file mode 100644 index 0000000000000..798779b881d43 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceSku.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SKU (tier) of a workspace. */ +@Fluent +public final class WorkspaceSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceSku.class); + + /* + * The name of the SKU. + */ + @JsonProperty(value = "name", required = true) + private WorkspaceSkuNameEnum name; + + /* + * The capacity reservation level for this workspace, when + * CapacityReservation sku is selected. + */ + @JsonProperty(value = "capacityReservationLevel") + private Integer capacityReservationLevel; + + /* + * The maximum capacity reservation level available for this workspace, + * when CapacityReservation sku is selected. + */ + @JsonProperty(value = "maxCapacityReservationLevel", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxCapacityReservationLevel; + + /* + * The last time when the sku was updated. + */ + @JsonProperty(value = "lastSkuUpdate", access = JsonProperty.Access.WRITE_ONLY) + private String lastSkuUpdate; + + /** + * Get the name property: The name of the SKU. + * + * @return the name value. + */ + public WorkspaceSkuNameEnum name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. + * + * @param name the name value to set. + * @return the WorkspaceSku object itself. + */ + public WorkspaceSku withName(WorkspaceSkuNameEnum name) { + this.name = name; + return this; + } + + /** + * Get the capacityReservationLevel property: The capacity reservation level for this workspace, when + * CapacityReservation sku is selected. + * + * @return the capacityReservationLevel value. + */ + public Integer capacityReservationLevel() { + return this.capacityReservationLevel; + } + + /** + * Set the capacityReservationLevel property: The capacity reservation level for this workspace, when + * CapacityReservation sku is selected. + * + * @param capacityReservationLevel the capacityReservationLevel value to set. + * @return the WorkspaceSku object itself. + */ + public WorkspaceSku withCapacityReservationLevel(Integer capacityReservationLevel) { + this.capacityReservationLevel = capacityReservationLevel; + return this; + } + + /** + * Get the maxCapacityReservationLevel property: The maximum capacity reservation level available for this + * workspace, when CapacityReservation sku is selected. + * + * @return the maxCapacityReservationLevel value. + */ + public Integer maxCapacityReservationLevel() { + return this.maxCapacityReservationLevel; + } + + /** + * Get the lastSkuUpdate property: The last time when the sku was updated. + * + * @return the lastSkuUpdate value. + */ + public String lastSkuUpdate() { + return this.lastSkuUpdate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model WorkspaceSku")); + } + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceSkuNameEnum.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceSkuNameEnum.java new file mode 100644 index 0000000000000..2575a89325a30 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/WorkspaceSkuNameEnum.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for WorkspaceSkuNameEnum. */ +public final class WorkspaceSkuNameEnum extends ExpandableStringEnum { + /** Static value Free for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum FREE = fromString("Free"); + + /** Static value Standard for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum STANDARD = fromString("Standard"); + + /** Static value Premium for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum PREMIUM = fromString("Premium"); + + /** Static value PerNode for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum PER_NODE = fromString("PerNode"); + + /** Static value PerGB2018 for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum PER_GB2018 = fromString("PerGB2018"); + + /** Static value Standalone for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum STANDALONE = fromString("Standalone"); + + /** Static value CapacityReservation for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum CAPACITY_RESERVATION = fromString("CapacityReservation"); + + /** + * Creates or finds a WorkspaceSkuNameEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding WorkspaceSkuNameEnum. + */ + @JsonCreator + public static WorkspaceSkuNameEnum fromString(String name) { + return fromString(name, WorkspaceSkuNameEnum.class); + } + + /** @return known WorkspaceSkuNameEnum values. */ + public static Collection values() { + return values(WorkspaceSkuNameEnum.class); + } +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Workspaces.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Workspaces.java new file mode 100644 index 0000000000000..bb06155f00e90 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/Workspaces.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loganalytics.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 Workspaces. */ +public interface Workspaces { + /** + * Gets the workspaces in a subscription. + * + * @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 workspaces in a subscription. + */ + PagedIterable list(); + + /** + * Gets the workspaces in a subscription. + * + * @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 workspaces in a subscription. + */ + PagedIterable list(Context context); + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 workspaces in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets workspaces in a 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 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 workspaces in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 workspaceName, Boolean force); + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspaceName); + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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 workspaceName, Boolean force, Context context); + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace instance. + */ + Workspace getByResourceGroup(String resourceGroupName, String workspaceName); + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace instance. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a workspace instance. + * + * @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 a workspace instance. + */ + Workspace getById(String id); + + /** + * Gets a workspace instance. + * + * @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 a workspace instance. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @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); + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same + * subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. + * To remove the workspace completely and release the name, use the force flag. + * + * @param id the resource ID. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag + * cannot be recovered. + * @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, Boolean force, Context context); + + /** + * Begins definition for a new Workspace resource. + * + * @param name resource name. + * @return the first stage of the new Workspace definition. + */ + Workspace.DefinitionStages.Blank define(String name); +} diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/package-info.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/package-info.java new file mode 100644 index 0000000000000..0d8df9ec0ee6c --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for OperationalInsightsManagementClient. Operational Insights Client. */ +package com.azure.resourcemanager.loganalytics.models; diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/package-info.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/package-info.java new file mode 100644 index 0000000000000..97f7c429557c8 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for OperationalInsightsManagementClient. Operational Insights Client. */ +package com.azure.resourcemanager.loganalytics; diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/module-info.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/module-info.java new file mode 100644 index 0000000000000..592f4739ecb65 --- /dev/null +++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.loganalytics { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.loganalytics; + exports com.azure.resourcemanager.loganalytics.fluent; + exports com.azure.resourcemanager.loganalytics.fluent.models; + exports com.azure.resourcemanager.loganalytics.models; + + opens com.azure.resourcemanager.loganalytics.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.loganalytics.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/loganalytics/ci.yml b/sdk/loganalytics/ci.yml index b66eddc467d5d..ae76f951c575c 100644 --- a/sdk/loganalytics/ci.yml +++ b/sdk/loganalytics/ci.yml @@ -3,27 +3,27 @@ trigger: branches: include: - - master - - hotfix/* - - release/* + - master + - hotfix/* + - release/* paths: include: - - sdk/loganalytics/ + - sdk/loganalytics/ exclude: - - sdk/loganalytics/mgmt-v2015_03_20 + - sdk/loganalytics/mgmt-v2015_03_20 pr: branches: include: - - master - - feature/* - - hotfix/* - - release/* + - master + - feature/* + - hotfix/* + - release/* paths: include: - - sdk/loganalytics/ + - sdk/loganalytics/ exclude: - - sdk/loganalytics/mgmt-v2015_03_20 + - sdk/loganalytics/mgmt-v2015_03_20 extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -31,6 +31,9 @@ extends: SDKType: data ServiceDirectory: loganalytics Artifacts: - - name: azure-loganalytics - groupId: com.microsoft.azure - safeName: azureloganalytics + - name: azure-loganalytics + groupId: com.microsoft.azure + safeName: azureloganalytics + - name: azure-resourcemanager-loganalytics + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerloganalytics diff --git a/sdk/loganalytics/pom.xml b/sdk/loganalytics/pom.xml index b33477163e7d2..7fa646df60feb 100644 --- a/sdk/loganalytics/pom.xml +++ b/sdk/loganalytics/pom.xml @@ -9,6 +9,7 @@ pom 1.0.0 + azure-resourcemanager-loganalytics microsoft-azure-loganalytics