From 24aa51577ca1139512aa4625a957ceb5edfc4cc3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 25 Dec 2020 06:02:18 +0000 Subject: [PATCH] CodeGen from PR 11407 in Azure/azure-rest-api-specs [Hub Generated] Review request for Microsoft.StorageCache to add version stable/2020-10-01 (#11407) * Init the next version so diffs can work better. * Updates readme * Updates API version in new specs and examples * Updates to StorageTargetProperties and added examples of cmk, mtu Add 202 to the storage cache and storage target create/update and update examples Fix ST no junction example's 202 response. add properties for nfs extended groups fix issues with extended groups properties found with autorest add properties and objects for Active Directory username download undo unintended change changes from comments in pull request AccessPolicy support. Example fixes for Access Policies. Fix attribute names to match latest RP. update to credential properties for LDAP and Active Directory marking password properties with x-ms-secret tag minor changes on extended groups and add examples Added blob NFS and some other validation fixes. Update required property for domainName from dnsName Updated blobNfs examples and some kpi fixes. Correct validation errors in examples. Added systemdata to resources. Remove x-ms-secret in keyvault reference due to linter error and common types not using it. Remove blobNfs from this version. Remove blobNfs from spec file. Remove x-ms-secret due to linter errors. Fix certificate spelling. Updating prettier and spell check errors. Used prettier on main spec file. Readded x-ms-secret that open api hub failed on but the PR pipeline allows. * Add prettier fix after rebase * Remove 202 bodies and add systemData to examples. * Update spec with prettier. * Address comments on spec for descriptions, readmes, and extendedGroupsEnabled. * Updating to address addition ldap and pattern comments. * Update version tag to include 01 * Restore changes that would be considered breaking changes matching 2020-03-01 * Address a few other comments. * Update netbios field names and some descriptions. * Fix s360 for missing debugInfo operation. * Fix credscan error in example file. * Update required fields, new validator failure on debugInfo return codes, and bindPassword example value. * Update debug info example with new return codes. * Update other credscan password errors. --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 83 + .../pom.xml | 62 + .../storagecache/StorageCacheManager.java | 264 ++ .../fluent/AscOperationsClient.java | 41 + .../storagecache/fluent/CachesClient.java | 558 ++++ .../storagecache/fluent/OperationsClient.java | 36 + .../storagecache/fluent/SkusClient.java | 36 + .../fluent/StorageCacheManagementClient.java | 89 + .../fluent/StorageTargetsClient.java | 259 ++ .../fluent/UsageModelsClient.java | 36 + .../fluent/models/ApiOperationInner.java | 167 + .../fluent/models/AscOperationInner.java | 184 ++ .../fluent/models/CacheInner.java | 391 +++ .../fluent/models/ResourceSkuInner.java | 177 ++ .../fluent/models/StorageTargetInner.java | 180 ++ .../fluent/models/UsageModelInner.java | 109 + .../fluent/models/package-info.java | 10 + .../storagecache/fluent/package-info.java | 10 + .../implementation/ApiOperationImpl.java | 50 + .../implementation/AscOperationImpl.java | 53 + .../AscOperationsClientImpl.java | 217 ++ .../implementation/AscOperationsImpl.java | 59 + .../implementation/CacheImpl.java | 277 ++ .../implementation/CachesClientImpl.java | 2804 +++++++++++++++++ .../implementation/CachesImpl.java | 209 ++ .../implementation/OperationsClientImpl.java | 269 ++ .../implementation/OperationsImpl.java | 46 + .../implementation/ResourceSkuImpl.java | 77 + .../implementation/SkusClientImpl.java | 293 ++ .../storagecache/implementation/SkusImpl.java | 46 + .../StorageCacheManagementClientBuilder.java | 149 + .../StorageCacheManagementClientImpl.java | 368 +++ .../implementation/StorageTargetImpl.java | 197 ++ .../StorageTargetsClientImpl.java | 1244 ++++++++ .../implementation/StorageTargetsImpl.java | 193 ++ .../implementation/UsageModelImpl.java | 41 + .../implementation/UsageModelsClientImpl.java | 294 ++ .../implementation/UsageModelsImpl.java | 46 + .../storagecache/implementation/Utils.java | 67 + .../implementation/package-info.java | 10 + .../storagecache/models/ApiOperation.java | 52 + .../models/ApiOperationDisplay.java | 128 + .../models/ApiOperationListResult.java | 87 + ...erationPropertiesServiceSpecification.java | 55 + .../storagecache/models/AscOperation.java | 59 + .../storagecache/models/AscOperations.java | 36 + .../storagecache/models/Cache.java | 511 +++ .../models/CacheActiveDirectorySettings.java | 234 ++ ...cheActiveDirectorySettingsCredentials.java | 94 + .../models/CacheDirectorySettings.java | 86 + .../models/CacheEncryptionSettings.java | 53 + .../storagecache/models/CacheHealth.java | 76 + .../storagecache/models/CacheIdentity.java | 80 + .../models/CacheIdentityType.java | 47 + .../models/CacheNetworkSettings.java | 66 + .../models/CacheSecuritySettings.java | 54 + .../storagecache/models/CacheSku.java | 50 + .../models/CacheUpgradeStatus.java | 108 + .../models/CacheUsernameDownloadSettings.java | 349 ++ ...heUsernameDownloadSettingsCredentials.java | 82 + .../storagecache/models/Caches.java | 298 ++ .../storagecache/models/CachesListResult.java | 81 + .../storagecache/models/ClfsTarget.java | 50 + .../models/ClfsTargetProperties.java | 65 + .../storagecache/models/CreatedByType.java | 40 + .../storagecache/models/DomainJoinedType.java | 37 + .../storagecache/models/ErrorResponse.java | 76 + .../models/FirmwareStatusType.java | 34 + .../storagecache/models/HealthStateType.java | 55 + .../models/KeyVaultKeyReference.java | 89 + .../KeyVaultKeyReferenceSourceVault.java | 50 + .../models/MetricAggregationType.java | 49 + .../storagecache/models/MetricDimension.java | 128 + .../models/MetricSpecification.java | 236 ++ .../models/NamespaceJunction.java | 128 + .../storagecache/models/Nfs3Target.java | 79 + .../models/Nfs3TargetProperties.java | 65 + .../storagecache/models/NfsAccessPolicy.java | 90 + .../storagecache/models/NfsAccessRule.java | 260 ++ .../models/NfsAccessRuleAccess.java | 37 + .../models/NfsAccessRuleScope.java | 37 + .../storagecache/models/Operations.java | 31 + .../models/ProvisioningStateType.java | 46 + .../storagecache/models/ReasonCode.java | 34 + .../storagecache/models/ResourceSku.java | 62 + .../models/ResourceSkuCapabilities.java | 76 + .../models/ResourceSkuLocationInfo.java | 77 + .../models/ResourceSkusResult.java | 70 + .../storagecache/models/Restriction.java | 92 + .../storagecache/models/Skus.java | 31 + .../storagecache/models/StorageTarget.java | 305 ++ .../models/StorageTargetProperties.java | 184 ++ .../models/StorageTargetResource.java | 58 + .../models/StorageTargetType.java | 37 + .../storagecache/models/StorageTargets.java | 166 + .../models/StorageTargetsResult.java | 81 + .../storagecache/models/SystemData.java | 181 ++ .../storagecache/models/UnknownTarget.java | 54 + .../models/UnknownTargetProperties.java | 65 + .../storagecache/models/UsageModel.java | 39 + .../models/UsageModelDisplay.java | 50 + .../storagecache/models/UsageModels.java | 31 + .../models/UsageModelsResult.java | 81 + .../models/UsernameDownloadedType.java | 37 + .../storagecache/models/UsernameSource.java | 40 + .../storagecache/models/package-info.java | 10 + .../storagecache/package-info.java | 10 + .../src/main/java/module-info.java | 19 + sdk/storagecache/ci.yml | 31 + sdk/storagecache/pom.xml | 14 + 113 files changed, 16011 insertions(+) create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/CHANGELOG.md create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/README.md create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/pom.xml create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/StorageCacheManager.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/AscOperationsClient.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/CachesClient.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/OperationsClient.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/SkusClient.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageCacheManagementClient.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetsClient.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/UsageModelsClient.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/ApiOperationInner.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/AscOperationInner.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/CacheInner.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/ResourceSkuInner.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/StorageTargetInner.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/UsageModelInner.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/package-info.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/package-info.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/ApiOperationImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsClientImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CacheImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesClientImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/OperationsClientImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/OperationsImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/ResourceSkuImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusClientImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientBuilder.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsClientImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsClientImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsImpl.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/Utils.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/package-info.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperation.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationDisplay.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationListResult.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationPropertiesServiceSpecification.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/AscOperation.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/AscOperations.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Cache.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheActiveDirectorySettings.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheActiveDirectorySettingsCredentials.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheDirectorySettings.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheEncryptionSettings.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheHealth.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentity.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentityType.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheNetworkSettings.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheSecuritySettings.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheSku.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUpgradeStatus.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUsernameDownloadSettings.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUsernameDownloadSettingsCredentials.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Caches.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CachesListResult.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ClfsTarget.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ClfsTargetProperties.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CreatedByType.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/DomainJoinedType.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ErrorResponse.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/FirmwareStatusType.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/HealthStateType.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/KeyVaultKeyReference.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/KeyVaultKeyReferenceSourceVault.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricAggregationType.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricDimension.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricSpecification.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NamespaceJunction.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Nfs3Target.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Nfs3TargetProperties.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessPolicy.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRule.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRuleAccess.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRuleScope.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Operations.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ProvisioningStateType.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ReasonCode.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSku.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkuCapabilities.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkuLocationInfo.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkusResult.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Restriction.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Skus.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTarget.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetProperties.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetResource.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetType.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargets.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetsResult.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/SystemData.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UnknownTarget.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UnknownTargetProperties.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModel.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModelDisplay.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModels.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModelsResult.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsernameDownloadedType.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsernameSource.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/package-info.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/package-info.java create mode 100644 sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/module-info.java create mode 100644 sdk/storagecache/ci.yml create mode 100644 sdk/storagecache/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index d932349db1d8..13d46e08e924 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -186,6 +186,7 @@ com.azure.resourcemanager:azure-resourcemanager-recoveryservices;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-kusto;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-storagecache;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 diff --git a/pom.xml b/pom.xml index b80dac967d8f..ddfa2b08e10b 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,7 @@ sdk/spring sdk/sqlvirtualmachine sdk/storage + sdk/storagecache sdk/synapse sdk/tables sdk/template diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/CHANGELOG.md b/sdk/storagecache/azure-resourcemanager-storagecache/CHANGELOG.md new file mode 100644 index 000000000000..f119b0d59fa7 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-25) + +- Azure Resource Manager StorageCache client library for Java. This package contains Microsoft Azure SDK for StorageCache Management SDK. A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. Package tag package-2020-10-01. 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/storagecache/azure-resourcemanager-storagecache/README.md b/sdk/storagecache/azure-resourcemanager-storagecache/README.md new file mode 100644 index 000000000000..ca9d61ccdf08 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/README.md @@ -0,0 +1,83 @@ +# Azure Resource Manager StorageCache client library for Java + +Azure Resource Manager StorageCache client library for Java. + +This package contains Microsoft Azure SDK for StorageCache Management SDK. A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. Package tag package-2020-10-01. 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 + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-storagecache;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-storagecache + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### 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: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +StorageCacheManager manager = StorageCacheManager + .authenticate(credential, profile); +``` + +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 + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +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/storagecache/azure-resourcemanager-storagecache/pom.xml b/sdk/storagecache/azure-resourcemanager-storagecache/pom.xml new file mode 100644 index 000000000000..e7dd12aabcd4 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/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-storagecache + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for StorageCache Management + This package contains Microsoft Azure SDK for StorageCache Management SDK. A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. Package tag package-2020-10-01. 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/StorageCacheManager.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/StorageCacheManager.java new file mode 100644 index 000000000000..596d3d5cab57 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/StorageCacheManager.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache; + +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.storagecache.fluent.StorageCacheManagementClient; +import com.azure.resourcemanager.storagecache.implementation.AscOperationsImpl; +import com.azure.resourcemanager.storagecache.implementation.CachesImpl; +import com.azure.resourcemanager.storagecache.implementation.OperationsImpl; +import com.azure.resourcemanager.storagecache.implementation.SkusImpl; +import com.azure.resourcemanager.storagecache.implementation.StorageCacheManagementClientBuilder; +import com.azure.resourcemanager.storagecache.implementation.StorageTargetsImpl; +import com.azure.resourcemanager.storagecache.implementation.UsageModelsImpl; +import com.azure.resourcemanager.storagecache.models.AscOperations; +import com.azure.resourcemanager.storagecache.models.Caches; +import com.azure.resourcemanager.storagecache.models.Operations; +import com.azure.resourcemanager.storagecache.models.Skus; +import com.azure.resourcemanager.storagecache.models.StorageTargets; +import com.azure.resourcemanager.storagecache.models.UsageModels; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entry point to StorageCacheManager. A Storage Cache provides scalable caching service for NAS clients, serving data + * from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage + * Caches. + */ +public final class StorageCacheManager { + private Operations operations; + + private Skus skus; + + private UsageModels usageModels; + + private AscOperations ascOperations; + + private Caches caches; + + private StorageTargets storageTargets; + + private final StorageCacheManagementClient clientObject; + + private StorageCacheManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new StorageCacheManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of StorageCache service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the StorageCache service API instance. + */ + public static StorageCacheManager 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 StorageCacheManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new StorageCacheManager.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 StorageCache service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the StorageCache service API instance. + */ + public StorageCacheManager 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.storagecache", + "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 StorageCacheManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @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 Skus. */ + public Skus skus() { + if (this.skus == null) { + this.skus = new SkusImpl(clientObject.getSkus(), this); + } + return skus; + } + + /** @return Resource collection API of UsageModels. */ + public UsageModels usageModels() { + if (this.usageModels == null) { + this.usageModels = new UsageModelsImpl(clientObject.getUsageModels(), this); + } + return usageModels; + } + + /** @return Resource collection API of AscOperations. */ + public AscOperations ascOperations() { + if (this.ascOperations == null) { + this.ascOperations = new AscOperationsImpl(clientObject.getAscOperations(), this); + } + return ascOperations; + } + + /** @return Resource collection API of Caches. */ + public Caches caches() { + if (this.caches == null) { + this.caches = new CachesImpl(clientObject.getCaches(), this); + } + return caches; + } + + /** @return Resource collection API of StorageTargets. */ + public StorageTargets storageTargets() { + if (this.storageTargets == null) { + this.storageTargets = new StorageTargetsImpl(clientObject.getStorageTargets(), this); + } + return storageTargets; + } + + /** + * @return Wrapped service client StorageCacheManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public StorageCacheManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/AscOperationsClient.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/AscOperationsClient.java new file mode 100644 index 000000000000..01fd9d422b8a --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/AscOperationsClient.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.storagecache.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.storagecache.fluent.models.AscOperationInner; + +/** An instance of this class provides access to all the operations defined in AscOperationsClient. */ +public interface AscOperationsClient { + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache. + * + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous 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 an asynchronous operation for the Azure HPC Cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AscOperationInner get(String location, String operationId); + + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache. + * + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @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 an asynchronous operation for the Azure HPC Cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String operationId, Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/CachesClient.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/CachesClient.java new file mode 100644 index 000000000000..bf052cbb19c2 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/CachesClient.java @@ -0,0 +1,558 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.storagecache.fluent.models.CacheInner; + +/** An instance of this class provides access to all the operations defined in CachesClient. */ +public interface CachesClient { + /** + * Returns all Caches the user has access to under 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 result of the request to list Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Returns all Caches the user has access to under 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 result of the request to list Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Returns all Caches the user has access to under a resource group. + * + * @param resourceGroupName Target resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns all Caches the user has access to under a resource group. + * + * @param resourceGroupName Target resource group. + * @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 Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginDelete(String resourceGroupName, String cacheName); + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginDelete(String resourceGroupName, String cacheName, Context context); + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object delete(String resourceGroupName, String cacheName); + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object delete(String resourceGroupName, String cacheName, Context context); + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CacheInner getByResourceGroup(String resourceGroupName, String cacheName); + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String cacheName, Context context); + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CacheInner> beginCreateOrUpdate( + String resourceGroupName, String cacheName, CacheInner cache); + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CacheInner> beginCreateOrUpdate( + String resourceGroupName, String cacheName, CacheInner cache, Context context); + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CacheInner createOrUpdate(String resourceGroupName, String cacheName, CacheInner cache); + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CacheInner createOrUpdate(String resourceGroupName, String cacheName); + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CacheInner createOrUpdate(String resourceGroupName, String cacheName, CacheInner cache, Context context); + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CacheInner update(String resourceGroupName, String cacheName); + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the Cache. If read-only properties are included, + * they must match the existing values of those properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String cacheName, CacheInner cache, Context context); + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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> beginDebugInfo(String resourceGroupName, String cacheName); + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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> beginDebugInfo(String resourceGroupName, String cacheName, Context context); + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 debugInfo(String resourceGroupName, String cacheName); + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 debugInfo(String resourceGroupName, String cacheName, Context context); + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginFlush(String resourceGroupName, String cacheName); + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginFlush(String resourceGroupName, String cacheName, Context context); + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object flush(String resourceGroupName, String cacheName); + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object flush(String resourceGroupName, String cacheName, Context context); + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginStart(String resourceGroupName, String cacheName); + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginStart(String resourceGroupName, String cacheName, Context context); + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object start(String resourceGroupName, String cacheName); + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object start(String resourceGroupName, String cacheName, Context context); + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginStop(String resourceGroupName, String cacheName); + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginStop(String resourceGroupName, String cacheName, Context context); + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object stop(String resourceGroupName, String cacheName); + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object stop(String resourceGroupName, String cacheName, Context context); + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginUpgradeFirmware(String resourceGroupName, String cacheName); + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginUpgradeFirmware( + String resourceGroupName, String cacheName, Context context); + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object upgradeFirmware(String resourceGroupName, String cacheName); + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object upgradeFirmware(String resourceGroupName, String cacheName, Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/OperationsClient.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/OperationsClient.java new file mode 100644 index 000000000000..03fc22ebfcfc --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/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.storagecache.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.storagecache.fluent.models.ApiOperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Resource Provider 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 Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available Resource Provider 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 Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/SkusClient.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/SkusClient.java new file mode 100644 index 000000000000..c328f4b11293 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/SkusClient.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.storagecache.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.storagecache.fluent.models.ResourceSkuInner; + +/** An instance of this class provides access to all the operations defined in SkusClient. */ +public interface SkusClient { + /** + * Get the list of StorageCache.Cache SKUs available to this 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 list of StorageCache. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get the list of StorageCache.Cache SKUs available to this 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 list of StorageCache. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageCacheManagementClient.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageCacheManagementClient.java new file mode 100644 index 000000000000..b08a838a3cb9 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageCacheManagementClient.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.storagecache.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for StorageCacheManagementClient class. */ +public interface StorageCacheManagementClient { + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @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 OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the SkusClient object to access its operations. + * + * @return the SkusClient object. + */ + SkusClient getSkus(); + + /** + * Gets the UsageModelsClient object to access its operations. + * + * @return the UsageModelsClient object. + */ + UsageModelsClient getUsageModels(); + + /** + * Gets the AscOperationsClient object to access its operations. + * + * @return the AscOperationsClient object. + */ + AscOperationsClient getAscOperations(); + + /** + * Gets the CachesClient object to access its operations. + * + * @return the CachesClient object. + */ + CachesClient getCaches(); + + /** + * Gets the StorageTargetsClient object to access its operations. + * + * @return the StorageTargetsClient object. + */ + StorageTargetsClient getStorageTargets(); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetsClient.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetsClient.java new file mode 100644 index 000000000000..66d31a2d63ca --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetsClient.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.storagecache.fluent.models.StorageTargetInner; + +/** An instance of this class provides access to all the operations defined in StorageTargetsClient. */ +public interface StorageTargetsClient { + /** + * Returns a list of Storage Targets for the specified Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Storage Targets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCache(String resourceGroupName, String cacheName); + + /** + * Returns a list of Storage Targets for the specified Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 Storage Targets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCache(String resourceGroupName, String cacheName, Context context); + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginDelete( + String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Object> beginDelete( + String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object delete(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object delete(String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Returns a Storage Target from a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageTargetInner get(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Returns a Storage Target from a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, StorageTargetInner> beginCreateOrUpdate( + String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget); + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, StorageTargetInner> beginCreateOrUpdate( + String resourceGroupName, + String cacheName, + String storageTargetName, + StorageTargetInner storagetarget, + Context context); + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageTargetInner createOrUpdate( + String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget); + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageTargetInner createOrUpdate(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageTargetInner createOrUpdate( + String resourceGroupName, + String cacheName, + String storageTargetName, + StorageTargetInner storagetarget, + Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/UsageModelsClient.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/UsageModelsClient.java new file mode 100644 index 000000000000..8e835430212c --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/UsageModelsClient.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.storagecache.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.storagecache.fluent.models.UsageModelInner; + +/** An instance of this class provides access to all the operations defined in UsageModelsClient. */ +public interface UsageModelsClient { + /** + * Get the list of Cache Usage Models available to this 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 list of Cache Usage Models available to this subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get the list of Cache Usage Models available to this 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 list of Cache Usage Models available to this subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/ApiOperationInner.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/ApiOperationInner.java new file mode 100644 index 000000000000..a32bf6d549de --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/ApiOperationInner.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.models.ApiOperationDisplay; +import com.azure.resourcemanager.storagecache.models.ApiOperationPropertiesServiceSpecification; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API operation description: see + * https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation. + */ +@JsonFlatten +@Fluent +public class ApiOperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiOperationInner.class); + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private ApiOperationDisplay display; + + /* + * Origin of the operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * The flag that indicates whether the operation applies to data plane. + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * Specification of the all the metrics provided for a resource type. + */ + @JsonProperty(value = "properties.serviceSpecification") + private ApiOperationPropertiesServiceSpecification serviceSpecification; + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public ApiOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the ApiOperationInner object itself. + */ + public ApiOperationInner withDisplay(ApiOperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Origin of the operation. + * + * @param origin the origin value to set. + * @return the ApiOperationInner object itself. + */ + public ApiOperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the isDataAction property: The flag that indicates whether the operation applies to data plane. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: The flag that indicates whether the operation applies to data plane. + * + * @param isDataAction the isDataAction value to set. + * @return the ApiOperationInner object itself. + */ + public ApiOperationInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * 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 ApiOperationInner object itself. + */ + public ApiOperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the serviceSpecification property: Specification of the all the metrics provided for a resource type. + * + * @return the serviceSpecification value. + */ + public ApiOperationPropertiesServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set the serviceSpecification property: Specification of the all the metrics provided for a resource type. + * + * @param serviceSpecification the serviceSpecification value to set. + * @return the ApiOperationInner object itself. + */ + public ApiOperationInner withServiceSpecification(ApiOperationPropertiesServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + if (serviceSpecification() != null) { + serviceSpecification().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/AscOperationInner.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/AscOperationInner.java new file mode 100644 index 000000000000..7914eb39b825 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/AscOperationInner.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.models.ErrorResponse; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The status of operation. */ +@Fluent +public final class AscOperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AscOperationInner.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 ErrorResponse 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 AscOperationInner object itself. + */ + public AscOperationInner 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 AscOperationInner object itself. + */ + public AscOperationInner 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 AscOperationInner object itself. + */ + public AscOperationInner 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 AscOperationInner object itself. + */ + public AscOperationInner 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 AscOperationInner object itself. + */ + public AscOperationInner 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 ErrorResponse 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 AscOperationInner object itself. + */ + public AscOperationInner withError(ErrorResponse error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/CacheInner.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/CacheInner.java new file mode 100644 index 000000000000..18908024052e --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/CacheInner.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.storagecache.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.storagecache.models.CacheDirectorySettings; +import com.azure.resourcemanager.storagecache.models.CacheEncryptionSettings; +import com.azure.resourcemanager.storagecache.models.CacheHealth; +import com.azure.resourcemanager.storagecache.models.CacheIdentity; +import com.azure.resourcemanager.storagecache.models.CacheNetworkSettings; +import com.azure.resourcemanager.storagecache.models.CacheSecuritySettings; +import com.azure.resourcemanager.storagecache.models.CacheSku; +import com.azure.resourcemanager.storagecache.models.CacheUpgradeStatus; +import com.azure.resourcemanager.storagecache.models.ProvisioningStateType; +import com.azure.resourcemanager.storagecache.models.SystemData; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * A Cache instance. Follows Azure Resource Manager standards: + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md. + */ +@JsonFlatten +@Fluent +public class CacheInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheInner.class); + + /* + * The identity of the cache, if configured. + */ + @JsonProperty(value = "identity") + private CacheIdentity identity; + + /* + * The system meta data relating to this resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * SKU for the Cache. + */ + @JsonProperty(value = "sku") + private CacheSku sku; + + /* + * The size of this Cache, in GB. + */ + @JsonProperty(value = "properties.cacheSizeGB") + private Integer cacheSizeGB; + + /* + * Health of the Cache. + */ + @JsonProperty(value = "properties.health", access = JsonProperty.Access.WRITE_ONLY) + private CacheHealth health; + + /* + * Array of IP addresses that can be used by clients mounting this Cache. + */ + @JsonProperty(value = "properties.mountAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List mountAddresses; + + /* + * ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningStateType provisioningState; + + /* + * Subnet used for the Cache. + */ + @JsonProperty(value = "properties.subnet") + private String subnet; + + /* + * Upgrade status of the Cache. + */ + @JsonProperty(value = "properties.upgradeStatus") + private CacheUpgradeStatus upgradeStatus; + + /* + * Specifies network settings of the cache. + */ + @JsonProperty(value = "properties.networkSettings") + private CacheNetworkSettings networkSettings; + + /* + * Specifies encryption settings of the cache. + */ + @JsonProperty(value = "properties.encryptionSettings") + private CacheEncryptionSettings encryptionSettings; + + /* + * Specifies security settings of the cache. + */ + @JsonProperty(value = "properties.securitySettings") + private CacheSecuritySettings securitySettings; + + /* + * Specifies Directory Services settings of the cache. + */ + @JsonProperty(value = "properties.directoryServicesSettings") + private CacheDirectorySettings directoryServicesSettings; + + /** + * Get the identity property: The identity of the cache, if configured. + * + * @return the identity value. + */ + public CacheIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the cache, if configured. + * + * @param identity the identity value to set. + * @return the CacheInner object itself. + */ + public CacheInner withIdentity(CacheIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the sku property: SKU for the Cache. + * + * @return the sku value. + */ + public CacheSku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU for the Cache. + * + * @param sku the sku value to set. + * @return the CacheInner object itself. + */ + public CacheInner withSku(CacheSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the cacheSizeGB property: The size of this Cache, in GB. + * + * @return the cacheSizeGB value. + */ + public Integer cacheSizeGB() { + return this.cacheSizeGB; + } + + /** + * Set the cacheSizeGB property: The size of this Cache, in GB. + * + * @param cacheSizeGB the cacheSizeGB value to set. + * @return the CacheInner object itself. + */ + public CacheInner withCacheSizeGB(Integer cacheSizeGB) { + this.cacheSizeGB = cacheSizeGB; + return this; + } + + /** + * Get the health property: Health of the Cache. + * + * @return the health value. + */ + public CacheHealth health() { + return this.health; + } + + /** + * Get the mountAddresses property: Array of IP addresses that can be used by clients mounting this Cache. + * + * @return the mountAddresses value. + */ + public List mountAddresses() { + return this.mountAddresses; + } + + /** + * Get the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @return the provisioningState value. + */ + public ProvisioningStateType provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @param provisioningState the provisioningState value to set. + * @return the CacheInner object itself. + */ + public CacheInner withProvisioningState(ProvisioningStateType provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the subnet property: Subnet used for the Cache. + * + * @return the subnet value. + */ + public String subnet() { + return this.subnet; + } + + /** + * Set the subnet property: Subnet used for the Cache. + * + * @param subnet the subnet value to set. + * @return the CacheInner object itself. + */ + public CacheInner withSubnet(String subnet) { + this.subnet = subnet; + return this; + } + + /** + * Get the upgradeStatus property: Upgrade status of the Cache. + * + * @return the upgradeStatus value. + */ + public CacheUpgradeStatus upgradeStatus() { + return this.upgradeStatus; + } + + /** + * Set the upgradeStatus property: Upgrade status of the Cache. + * + * @param upgradeStatus the upgradeStatus value to set. + * @return the CacheInner object itself. + */ + public CacheInner withUpgradeStatus(CacheUpgradeStatus upgradeStatus) { + this.upgradeStatus = upgradeStatus; + return this; + } + + /** + * Get the networkSettings property: Specifies network settings of the cache. + * + * @return the networkSettings value. + */ + public CacheNetworkSettings networkSettings() { + return this.networkSettings; + } + + /** + * Set the networkSettings property: Specifies network settings of the cache. + * + * @param networkSettings the networkSettings value to set. + * @return the CacheInner object itself. + */ + public CacheInner withNetworkSettings(CacheNetworkSettings networkSettings) { + this.networkSettings = networkSettings; + return this; + } + + /** + * Get the encryptionSettings property: Specifies encryption settings of the cache. + * + * @return the encryptionSettings value. + */ + public CacheEncryptionSettings encryptionSettings() { + return this.encryptionSettings; + } + + /** + * Set the encryptionSettings property: Specifies encryption settings of the cache. + * + * @param encryptionSettings the encryptionSettings value to set. + * @return the CacheInner object itself. + */ + public CacheInner withEncryptionSettings(CacheEncryptionSettings encryptionSettings) { + this.encryptionSettings = encryptionSettings; + return this; + } + + /** + * Get the securitySettings property: Specifies security settings of the cache. + * + * @return the securitySettings value. + */ + public CacheSecuritySettings securitySettings() { + return this.securitySettings; + } + + /** + * Set the securitySettings property: Specifies security settings of the cache. + * + * @param securitySettings the securitySettings value to set. + * @return the CacheInner object itself. + */ + public CacheInner withSecuritySettings(CacheSecuritySettings securitySettings) { + this.securitySettings = securitySettings; + return this; + } + + /** + * Get the directoryServicesSettings property: Specifies Directory Services settings of the cache. + * + * @return the directoryServicesSettings value. + */ + public CacheDirectorySettings directoryServicesSettings() { + return this.directoryServicesSettings; + } + + /** + * Set the directoryServicesSettings property: Specifies Directory Services settings of the cache. + * + * @param directoryServicesSettings the directoryServicesSettings value to set. + * @return the CacheInner object itself. + */ + public CacheInner withDirectoryServicesSettings(CacheDirectorySettings directoryServicesSettings) { + this.directoryServicesSettings = directoryServicesSettings; + return this; + } + + /** {@inheritDoc} */ + @Override + public CacheInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CacheInner 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 (systemData() != null) { + systemData().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (health() != null) { + health().validate(); + } + if (upgradeStatus() != null) { + upgradeStatus().validate(); + } + if (networkSettings() != null) { + networkSettings().validate(); + } + if (encryptionSettings() != null) { + encryptionSettings().validate(); + } + if (securitySettings() != null) { + securitySettings().validate(); + } + if (directoryServicesSettings() != null) { + directoryServicesSettings().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/ResourceSkuInner.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/ResourceSkuInner.java new file mode 100644 index 000000000000..c7d5ff958b08 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/ResourceSkuInner.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.models.ResourceSkuCapabilities; +import com.azure.resourcemanager.storagecache.models.ResourceSkuLocationInfo; +import com.azure.resourcemanager.storagecache.models.Restriction; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A resource SKU. */ +@Fluent +public final class ResourceSkuInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuInner.class); + + /* + * The type of resource the SKU applies to. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /* + * A list of capabilities of this SKU, such as throughput or ops/sec. + */ + @JsonProperty(value = "capabilities") + private List capabilities; + + /* + * The set of locations where the SKU is available. This is the supported + * and registered Azure Geo Regions (e.g., West US, East US, Southeast + * Asia, etc.). + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /* + * The set of locations where the SKU is available. + */ + @JsonProperty(value = "locationInfo") + private List locationInfo; + + /* + * The name of this SKU. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The restrictions preventing this SKU from being used. This is empty if + * there are no restrictions. + */ + @JsonProperty(value = "restrictions") + private List restrictions; + + /** + * Get the resourceType property: The type of resource the SKU applies to. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the capabilities property: A list of capabilities of this SKU, such as throughput or ops/sec. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities property: A list of capabilities of this SKU, such as throughput or ops/sec. + * + * @param capabilities the capabilities value to set. + * @return the ResourceSkuInner object itself. + */ + public ResourceSkuInner withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the locations property: The set of locations where the SKU is available. This is the supported and registered + * Azure Geo Regions (e.g., West US, East US, Southeast Asia, etc.). + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Get the locationInfo property: The set of locations where the SKU is available. + * + * @return the locationInfo value. + */ + public List locationInfo() { + return this.locationInfo; + } + + /** + * Set the locationInfo property: The set of locations where the SKU is available. + * + * @param locationInfo the locationInfo value to set. + * @return the ResourceSkuInner object itself. + */ + public ResourceSkuInner withLocationInfo(List locationInfo) { + this.locationInfo = locationInfo; + return this; + } + + /** + * Get the name property: The name of this SKU. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of this SKU. + * + * @param name the name value to set. + * @return the ResourceSkuInner object itself. + */ + public ResourceSkuInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the restrictions property: The restrictions preventing this SKU from being used. This is empty if there are + * no restrictions. + * + * @return the restrictions value. + */ + public List restrictions() { + return this.restrictions; + } + + /** + * Set the restrictions property: The restrictions preventing this SKU from being used. This is empty if there are + * no restrictions. + * + * @param restrictions the restrictions value to set. + * @return the ResourceSkuInner object itself. + */ + public ResourceSkuInner withRestrictions(List restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + if (locationInfo() != null) { + locationInfo().forEach(e -> e.validate()); + } + if (restrictions() != null) { + restrictions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/StorageTargetInner.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/StorageTargetInner.java new file mode 100644 index 000000000000..a595787aef79 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/StorageTargetInner.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.models.ClfsTarget; +import com.azure.resourcemanager.storagecache.models.NamespaceJunction; +import com.azure.resourcemanager.storagecache.models.Nfs3Target; +import com.azure.resourcemanager.storagecache.models.ProvisioningStateType; +import com.azure.resourcemanager.storagecache.models.StorageTargetResource; +import com.azure.resourcemanager.storagecache.models.UnknownTarget; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Type of the Storage Target. */ +@JsonFlatten +@Fluent +public class StorageTargetInner extends StorageTargetResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageTargetInner.class); + + /* + * List of Cache namespace junctions to target for namespace associations. + */ + @JsonProperty(value = "properties.junctions") + private List junctions; + + /* + * ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningStateType provisioningState; + + /* + * Properties when targetType is nfs3. + */ + @JsonProperty(value = "properties.nfs3") + private Nfs3Target nfs3; + + /* + * Properties when targetType is clfs. + */ + @JsonProperty(value = "properties.clfs") + private ClfsTarget clfs; + + /* + * Properties when targetType is unknown. + */ + @JsonProperty(value = "properties.unknown") + private UnknownTarget unknown; + + /** + * Get the junctions property: List of Cache namespace junctions to target for namespace associations. + * + * @return the junctions value. + */ + public List junctions() { + return this.junctions; + } + + /** + * Set the junctions property: List of Cache namespace junctions to target for namespace associations. + * + * @param junctions the junctions value to set. + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withJunctions(List junctions) { + this.junctions = junctions; + return this; + } + + /** + * Get the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @return the provisioningState value. + */ + public ProvisioningStateType provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @param provisioningState the provisioningState value to set. + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withProvisioningState(ProvisioningStateType provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the nfs3 property: Properties when targetType is nfs3. + * + * @return the nfs3 value. + */ + public Nfs3Target nfs3() { + return this.nfs3; + } + + /** + * Set the nfs3 property: Properties when targetType is nfs3. + * + * @param nfs3 the nfs3 value to set. + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withNfs3(Nfs3Target nfs3) { + this.nfs3 = nfs3; + return this; + } + + /** + * Get the clfs property: Properties when targetType is clfs. + * + * @return the clfs value. + */ + public ClfsTarget clfs() { + return this.clfs; + } + + /** + * Set the clfs property: Properties when targetType is clfs. + * + * @param clfs the clfs value to set. + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withClfs(ClfsTarget clfs) { + this.clfs = clfs; + return this; + } + + /** + * Get the unknown property: Properties when targetType is unknown. + * + * @return the unknown value. + */ + public UnknownTarget unknown() { + return this.unknown; + } + + /** + * Set the unknown property: Properties when targetType is unknown. + * + * @param unknown the unknown value to set. + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withUnknown(UnknownTarget unknown) { + this.unknown = unknown; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (junctions() != null) { + junctions().forEach(e -> e.validate()); + } + if (nfs3() != null) { + nfs3().validate(); + } + if (clfs() != null) { + clfs().validate(); + } + if (unknown() != null) { + unknown().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/UsageModelInner.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/UsageModelInner.java new file mode 100644 index 000000000000..f5c93ef00b44 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/UsageModelInner.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.models.UsageModelDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A usage model. */ +@Fluent +public final class UsageModelInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageModelInner.class); + + /* + * Localized information describing this usage model. + */ + @JsonProperty(value = "display") + private UsageModelDisplay display; + + /* + * Non-localized keyword name for this usage model. + */ + @JsonProperty(value = "modelName") + private String modelName; + + /* + * The type of Storage Target to which this model is applicable (only nfs3 + * as of this version). + */ + @JsonProperty(value = "targetType") + private String targetType; + + /** + * Get the display property: Localized information describing this usage model. + * + * @return the display value. + */ + public UsageModelDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized information describing this usage model. + * + * @param display the display value to set. + * @return the UsageModelInner object itself. + */ + public UsageModelInner withDisplay(UsageModelDisplay display) { + this.display = display; + return this; + } + + /** + * Get the modelName property: Non-localized keyword name for this usage model. + * + * @return the modelName value. + */ + public String modelName() { + return this.modelName; + } + + /** + * Set the modelName property: Non-localized keyword name for this usage model. + * + * @param modelName the modelName value to set. + * @return the UsageModelInner object itself. + */ + public UsageModelInner withModelName(String modelName) { + this.modelName = modelName; + return this; + } + + /** + * Get the targetType property: The type of Storage Target to which this model is applicable (only nfs3 as of this + * version). + * + * @return the targetType value. + */ + public String targetType() { + return this.targetType; + } + + /** + * Set the targetType property: The type of Storage Target to which this model is applicable (only nfs3 as of this + * version). + * + * @param targetType the targetType value to set. + * @return the UsageModelInner object itself. + */ + public UsageModelInner withTargetType(String targetType) { + this.targetType = targetType; + 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/package-info.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/package-info.java new file mode 100644 index 000000000000..8d6fb1912dc2 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// 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 StorageCacheManagementClient. A Storage Cache provides scalable caching + * service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). + * These operations allow you to manage Caches. + */ +package com.azure.resourcemanager.storagecache.fluent.models; diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/package-info.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/package-info.java new file mode 100644 index 000000000000..3c330ebf6178 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/package-info.java @@ -0,0 +1,10 @@ +// 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 StorageCacheManagementClient. A Storage Cache provides scalable caching + * service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). + * These operations allow you to manage Caches. + */ +package com.azure.resourcemanager.storagecache.fluent; diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/ApiOperationImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/ApiOperationImpl.java new file mode 100644 index 000000000000..6eb787d217f7 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/ApiOperationImpl.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.storagecache.implementation; + +import com.azure.resourcemanager.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.models.ApiOperationInner; +import com.azure.resourcemanager.storagecache.models.ApiOperation; +import com.azure.resourcemanager.storagecache.models.ApiOperationDisplay; +import com.azure.resourcemanager.storagecache.models.ApiOperationPropertiesServiceSpecification; + +public final class ApiOperationImpl implements ApiOperation { + private ApiOperationInner innerObject; + + private final StorageCacheManager serviceManager; + + ApiOperationImpl(ApiOperationInner innerObject, StorageCacheManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ApiOperationDisplay display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public String name() { + return this.innerModel().name(); + } + + public ApiOperationPropertiesServiceSpecification serviceSpecification() { + return this.innerModel().serviceSpecification(); + } + + public ApiOperationInner innerModel() { + return this.innerObject; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationImpl.java new file mode 100644 index 000000000000..dd820c65aab0 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationImpl.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.storagecache.implementation; + +import com.azure.resourcemanager.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.models.AscOperationInner; +import com.azure.resourcemanager.storagecache.models.AscOperation; +import com.azure.resourcemanager.storagecache.models.ErrorResponse; + +public final class AscOperationImpl implements AscOperation { + private AscOperationInner innerObject; + + private final StorageCacheManager serviceManager; + + AscOperationImpl(AscOperationInner innerObject, StorageCacheManager 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 ErrorResponse error() { + return this.innerModel().error(); + } + + public AscOperationInner innerModel() { + return this.innerObject; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsClientImpl.java new file mode 100644 index 000000000000..4dae83dbd7ec --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsClientImpl.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.storagecache.fluent.AscOperationsClient; +import com.azure.resourcemanager.storagecache.fluent.models.AscOperationInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AscOperationsClient. */ +public final class AscOperationsClientImpl implements AscOperationsClient { + private final ClientLogger logger = new ClientLogger(AscOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AscOperationsService service; + + /** The service client containing this operation class. */ + private final StorageCacheManagementClientImpl client; + + /** + * Initializes an instance of AscOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AscOperationsClientImpl(StorageCacheManagementClientImpl client) { + this.service = + RestProxy.create(AscOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageCacheManagementClientAscOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageCacheManageme") + private interface AscOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations" + + "/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache. + * + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous 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 an asynchronous operation for the Azure HPC Cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String operationId) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + operationId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache. + * + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @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 an asynchronous operation for the Azure HPC Cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String operationId, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + operationId, + accept, + context); + } + + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache. + * + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous 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 an asynchronous operation for the Azure HPC Cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String operationId) { + return getWithResponseAsync(location, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache. + * + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous 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 an asynchronous operation for the Azure HPC Cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AscOperationInner get(String location, String operationId) { + return getAsync(location, operationId).block(); + } + + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache. + * + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @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 an asynchronous operation for the Azure HPC Cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String operationId, Context context) { + return getWithResponseAsync(location, operationId, context).block(); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsImpl.java new file mode 100644 index 000000000000..08abb5e6cb46 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.AscOperationsClient; +import com.azure.resourcemanager.storagecache.fluent.models.AscOperationInner; +import com.azure.resourcemanager.storagecache.models.AscOperation; +import com.azure.resourcemanager.storagecache.models.AscOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AscOperationsImpl implements AscOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AscOperationsImpl.class); + + private final AscOperationsClient innerClient; + + private final StorageCacheManager serviceManager; + + public AscOperationsImpl(AscOperationsClient innerClient, StorageCacheManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AscOperation get(String location, String operationId) { + AscOperationInner inner = this.serviceClient().get(location, operationId); + if (inner != null) { + return new AscOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String location, String operationId, Context context) { + Response inner = this.serviceClient().getWithResponse(location, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AscOperationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private AscOperationsClient serviceClient() { + return this.innerClient; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CacheImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CacheImpl.java new file mode 100644 index 000000000000..793497466a2c --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CacheImpl.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.models.CacheInner; +import com.azure.resourcemanager.storagecache.models.Cache; +import com.azure.resourcemanager.storagecache.models.CacheDirectorySettings; +import com.azure.resourcemanager.storagecache.models.CacheEncryptionSettings; +import com.azure.resourcemanager.storagecache.models.CacheHealth; +import com.azure.resourcemanager.storagecache.models.CacheIdentity; +import com.azure.resourcemanager.storagecache.models.CacheNetworkSettings; +import com.azure.resourcemanager.storagecache.models.CacheSecuritySettings; +import com.azure.resourcemanager.storagecache.models.CacheSku; +import com.azure.resourcemanager.storagecache.models.CacheUpgradeStatus; +import com.azure.resourcemanager.storagecache.models.ProvisioningStateType; +import com.azure.resourcemanager.storagecache.models.SystemData; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CacheImpl implements Cache, Cache.Definition, Cache.Update { + private CacheInner innerObject; + + private final StorageCacheManager 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 CacheIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public CacheSku sku() { + return this.innerModel().sku(); + } + + public Integer cacheSizeGB() { + return this.innerModel().cacheSizeGB(); + } + + public CacheHealth health() { + return this.innerModel().health(); + } + + public List mountAddresses() { + List inner = this.innerModel().mountAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningStateType provisioningState() { + return this.innerModel().provisioningState(); + } + + public String subnet() { + return this.innerModel().subnet(); + } + + public CacheUpgradeStatus upgradeStatus() { + return this.innerModel().upgradeStatus(); + } + + public CacheNetworkSettings networkSettings() { + return this.innerModel().networkSettings(); + } + + public CacheEncryptionSettings encryptionSettings() { + return this.innerModel().encryptionSettings(); + } + + public CacheSecuritySettings securitySettings() { + return this.innerModel().securitySettings(); + } + + public CacheDirectorySettings directoryServicesSettings() { + return this.innerModel().directoryServicesSettings(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CacheInner innerModel() { + return this.innerObject; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cacheName; + + public CacheImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Cache create() { + this.innerObject = + serviceManager + .serviceClient() + .getCaches() + .createOrUpdate(resourceGroupName, cacheName, this.innerModel(), Context.NONE); + return this; + } + + public Cache create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCaches() + .createOrUpdate(resourceGroupName, cacheName, this.innerModel(), context); + return this; + } + + CacheImpl(String name, StorageCacheManager serviceManager) { + this.innerObject = new CacheInner(); + this.serviceManager = serviceManager; + this.cacheName = name; + } + + public CacheImpl update() { + return this; + } + + public Cache apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCaches() + .updateWithResponse(resourceGroupName, cacheName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Cache apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCaches() + .updateWithResponse(resourceGroupName, cacheName, this.innerModel(), context) + .getValue(); + return this; + } + + CacheImpl(CacheInner innerObject, StorageCacheManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.cacheName = Utils.getValueFromIdByName(innerObject.id(), "caches"); + } + + public Cache refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCaches() + .getByResourceGroupWithResponse(resourceGroupName, cacheName, Context.NONE) + .getValue(); + return this; + } + + public Cache refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCaches() + .getByResourceGroupWithResponse(resourceGroupName, cacheName, context) + .getValue(); + return this; + } + + public CacheImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CacheImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CacheImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public CacheImpl withIdentity(CacheIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public CacheImpl withSku(CacheSku sku) { + this.innerModel().withSku(sku); + return this; + } + + public CacheImpl withCacheSizeGB(Integer cacheSizeGB) { + this.innerModel().withCacheSizeGB(cacheSizeGB); + return this; + } + + public CacheImpl withProvisioningState(ProvisioningStateType provisioningState) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } + + public CacheImpl withSubnet(String subnet) { + this.innerModel().withSubnet(subnet); + return this; + } + + public CacheImpl withUpgradeStatus(CacheUpgradeStatus upgradeStatus) { + this.innerModel().withUpgradeStatus(upgradeStatus); + return this; + } + + public CacheImpl withNetworkSettings(CacheNetworkSettings networkSettings) { + this.innerModel().withNetworkSettings(networkSettings); + return this; + } + + public CacheImpl withEncryptionSettings(CacheEncryptionSettings encryptionSettings) { + this.innerModel().withEncryptionSettings(encryptionSettings); + return this; + } + + public CacheImpl withSecuritySettings(CacheSecuritySettings securitySettings) { + this.innerModel().withSecuritySettings(securitySettings); + return this; + } + + public CacheImpl withDirectoryServicesSettings(CacheDirectorySettings directoryServicesSettings) { + this.innerModel().withDirectoryServicesSettings(directoryServicesSettings); + return this; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesClientImpl.java new file mode 100644 index 000000000000..99f003fa7565 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesClientImpl.java @@ -0,0 +1,2804 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.Post; +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.storagecache.fluent.CachesClient; +import com.azure.resourcemanager.storagecache.fluent.models.CacheInner; +import com.azure.resourcemanager.storagecache.models.CachesListResult; +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 CachesClient. */ +public final class CachesClientImpl implements CachesClient { + private final ClientLogger logger = new ClientLogger(CachesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CachesService service; + + /** The service client containing this operation class. */ + private final StorageCacheManagementClientImpl client; + + /** + * Initializes an instance of CachesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CachesClientImpl(StorageCacheManagementClientImpl client) { + this.service = RestProxy.create(CachesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageCacheManagementClientCaches to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageCacheManageme") + private interface CachesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches") + @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.StorageCache" + + "/caches") + @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"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @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.StorageCache/caches" + + "/{cacheName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @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.StorageCache/caches" + + "/{cacheName}") + @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("cacheName") String cacheName, + @BodyParam("application/json") CacheInner cache, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @BodyParam("application/json") CacheInner cache, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/debugInfo") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> debugInfo( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/flush") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> flush( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/start") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/stop") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> stop( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/upgrade") + @ExpectedResponses({201, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> upgradeFirmware( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns all Caches the user has access to under 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 result of the request to list Caches. + */ + @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()))); + } + + /** + * Returns all Caches the user has access to under 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 result of the request to list Caches. + */ + @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)); + } + + /** + * Returns all Caches the user has access to under 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 result of the request to list Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns all Caches the user has access to under 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 result of the request to list Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns all Caches the user has access to under 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 result of the request to list Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Returns all Caches the user has access to under 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 result of the request to list Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Returns all Caches the user has access to under a resource group. + * + * @param resourceGroupName Target resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Caches. + */ + @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()))); + } + + /** + * Returns all Caches the user has access to under a resource group. + * + * @param resourceGroupName Target resource group. + * @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 Caches. + */ + @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)); + } + + /** + * Returns all Caches the user has access to under a resource group. + * + * @param resourceGroupName Target resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Returns all Caches the user has access to under a resource group. + * + * @param resourceGroupName Target resource group. + * @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 Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns all Caches the user has access to under a resource group. + * + * @param resourceGroupName Target resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Returns all Caches the user has access to under a resource group. + * + * @param resourceGroupName Target resource group. + * @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 Caches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String cacheName) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName 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, + cacheName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String cacheName, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName 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, + cacheName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginDeleteAsync(String resourceGroupName, String cacheName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cacheName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Object.class, Object.class, Context.NONE); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginDeleteAsync( + String resourceGroupName, String cacheName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cacheName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Object.class, Object.class, context); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginDelete(String resourceGroupName, String cacheName) { + return beginDeleteAsync(resourceGroupName, cacheName).getSyncPoller(); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginDelete( + String resourceGroupName, String cacheName, Context context) { + return beginDeleteAsync(resourceGroupName, cacheName, context).getSyncPoller(); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cacheName) { + return beginDeleteAsync(resourceGroupName, cacheName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cacheName, Context context) { + return beginDeleteAsync(resourceGroupName, cacheName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object delete(String resourceGroupName, String cacheName) { + return deleteAsync(resourceGroupName, cacheName).block(); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object delete(String resourceGroupName, String cacheName, Context context) { + return deleteAsync(resourceGroupName, cacheName, context).block(); + } + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String cacheName) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName 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, + cacheName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String cacheName, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName 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, + cacheName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String cacheName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cacheName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CacheInner getByResourceGroup(String resourceGroupName, String cacheName) { + return getByResourceGroupAsync(resourceGroupName, cacheName).block(); + } + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String cacheName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cacheName, context).block(); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cacheName, CacheInner cache) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (cache != null) { + cache.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + cache, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cacheName, CacheInner cache, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (cache != null) { + cache.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + cache, + accept, + context); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CacheInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cacheName, CacheInner cache) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, cacheName, cache); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CacheInner.class, CacheInner.class, Context.NONE); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CacheInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cacheName, CacheInner cache, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, cacheName, cache, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CacheInner.class, CacheInner.class, context); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CacheInner> beginCreateOrUpdate( + String resourceGroupName, String cacheName, CacheInner cache) { + return beginCreateOrUpdateAsync(resourceGroupName, cacheName, cache).getSyncPoller(); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CacheInner> beginCreateOrUpdate( + String resourceGroupName, String cacheName, CacheInner cache, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cacheName, cache, context).getSyncPoller(); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String cacheName, CacheInner cache) { + return beginCreateOrUpdateAsync(resourceGroupName, cacheName, cache) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String cacheName) { + final CacheInner cache = null; + return beginCreateOrUpdateAsync(resourceGroupName, cacheName, cache) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String cacheName, CacheInner cache, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cacheName, cache, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CacheInner createOrUpdate(String resourceGroupName, String cacheName, CacheInner cache) { + return createOrUpdateAsync(resourceGroupName, cacheName, cache).block(); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CacheInner createOrUpdate(String resourceGroupName, String cacheName) { + final CacheInner cache = null; + return createOrUpdateAsync(resourceGroupName, cacheName, cache).block(); + } + + /** + * Create or update a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the new Cache. If read-only properties are + * included, they must match the existing values of those properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CacheInner createOrUpdate(String resourceGroupName, String cacheName, CacheInner cache, Context context) { + return createOrUpdateAsync(resourceGroupName, cacheName, cache, context).block(); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the Cache. If read-only properties are included, + * they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String cacheName, CacheInner cache) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (cache != null) { + cache.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + cache, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the Cache. If read-only properties are included, + * they must match the existing values of those properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String cacheName, CacheInner cache, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (cache != null) { + cache.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + cache, + accept, + context); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the Cache. If read-only properties are included, + * they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String cacheName, CacheInner cache) { + return updateWithResponseAsync(resourceGroupName, cacheName, cache) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String cacheName) { + final CacheInner cache = null; + return updateWithResponseAsync(resourceGroupName, cacheName, cache) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CacheInner update(String resourceGroupName, String cacheName) { + final CacheInner cache = null; + return updateAsync(resourceGroupName, cacheName, cache).block(); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param cache Object containing the user-selectable properties of the Cache. If read-only properties are included, + * they must match the existing values of those properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Cache instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String cacheName, CacheInner cache, Context context) { + return updateWithResponseAsync(resourceGroupName, cacheName, cache, context).block(); + } + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> debugInfoWithResponseAsync(String resourceGroupName, String cacheName) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .debugInfo( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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>> debugInfoWithResponseAsync( + String resourceGroupName, String cacheName, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .debugInfo( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context); + } + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginDebugInfoAsync(String resourceGroupName, String cacheName) { + Mono>> mono = debugInfoWithResponseAsync(resourceGroupName, cacheName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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> beginDebugInfoAsync( + String resourceGroupName, String cacheName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = debugInfoWithResponseAsync(resourceGroupName, cacheName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginDebugInfo(String resourceGroupName, String cacheName) { + return beginDebugInfoAsync(resourceGroupName, cacheName).getSyncPoller(); + } + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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> beginDebugInfo( + String resourceGroupName, String cacheName, Context context) { + return beginDebugInfoAsync(resourceGroupName, cacheName, context).getSyncPoller(); + } + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 debugInfoAsync(String resourceGroupName, String cacheName) { + return beginDebugInfoAsync(resourceGroupName, cacheName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 debugInfoAsync(String resourceGroupName, String cacheName, Context context) { + return beginDebugInfoAsync(resourceGroupName, cacheName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 debugInfo(String resourceGroupName, String cacheName) { + debugInfoAsync(resourceGroupName, cacheName).block(); + } + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 debugInfo(String resourceGroupName, String cacheName, Context context) { + debugInfoAsync(resourceGroupName, cacheName, context).block(); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> flushWithResponseAsync(String resourceGroupName, String cacheName) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .flush( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> flushWithResponseAsync( + String resourceGroupName, String cacheName, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .flush( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginFlushAsync(String resourceGroupName, String cacheName) { + Mono>> mono = flushWithResponseAsync(resourceGroupName, cacheName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Object.class, Object.class, Context.NONE); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginFlushAsync( + String resourceGroupName, String cacheName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = flushWithResponseAsync(resourceGroupName, cacheName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Object.class, Object.class, context); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginFlush(String resourceGroupName, String cacheName) { + return beginFlushAsync(resourceGroupName, cacheName).getSyncPoller(); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginFlush( + String resourceGroupName, String cacheName, Context context) { + return beginFlushAsync(resourceGroupName, cacheName, context).getSyncPoller(); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono flushAsync(String resourceGroupName, String cacheName) { + return beginFlushAsync(resourceGroupName, cacheName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono flushAsync(String resourceGroupName, String cacheName, Context context) { + return beginFlushAsync(resourceGroupName, cacheName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object flush(String resourceGroupName, String cacheName) { + return flushAsync(resourceGroupName, cacheName).block(); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object flush(String resourceGroupName, String cacheName, Context context) { + return flushAsync(resourceGroupName, cacheName, context).block(); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync(String resourceGroupName, String cacheName) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String cacheName, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginStartAsync(String resourceGroupName, String cacheName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, cacheName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Object.class, Object.class, Context.NONE); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginStartAsync( + String resourceGroupName, String cacheName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, cacheName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Object.class, Object.class, context); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginStart(String resourceGroupName, String cacheName) { + return beginStartAsync(resourceGroupName, cacheName).getSyncPoller(); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginStart( + String resourceGroupName, String cacheName, Context context) { + return beginStartAsync(resourceGroupName, cacheName, context).getSyncPoller(); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String cacheName) { + return beginStartAsync(resourceGroupName, cacheName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String cacheName, Context context) { + return beginStartAsync(resourceGroupName, cacheName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object start(String resourceGroupName, String cacheName) { + return startAsync(resourceGroupName, cacheName).block(); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object start(String resourceGroupName, String cacheName, Context context) { + return startAsync(resourceGroupName, cacheName, context).block(); + } + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync(String resourceGroupName, String cacheName) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .stop( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync( + String resourceGroupName, String cacheName, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .stop( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context); + } + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginStopAsync(String resourceGroupName, String cacheName) { + Mono>> mono = stopWithResponseAsync(resourceGroupName, cacheName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Object.class, Object.class, Context.NONE); + } + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginStopAsync( + String resourceGroupName, String cacheName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = stopWithResponseAsync(resourceGroupName, cacheName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Object.class, Object.class, context); + } + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginStop(String resourceGroupName, String cacheName) { + return beginStopAsync(resourceGroupName, cacheName).getSyncPoller(); + } + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginStop( + String resourceGroupName, String cacheName, Context context) { + return beginStopAsync(resourceGroupName, cacheName, context).getSyncPoller(); + } + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String cacheName) { + return beginStopAsync(resourceGroupName, cacheName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String cacheName, Context context) { + return beginStopAsync(resourceGroupName, cacheName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object stop(String resourceGroupName, String cacheName) { + return stopAsync(resourceGroupName, cacheName).block(); + } + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object stop(String resourceGroupName, String cacheName, Context context) { + return stopAsync(resourceGroupName, cacheName, context).block(); + } + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> upgradeFirmwareWithResponseAsync( + String resourceGroupName, String cacheName) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .upgradeFirmware( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> upgradeFirmwareWithResponseAsync( + String resourceGroupName, String cacheName, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .upgradeFirmware( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context); + } + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginUpgradeFirmwareAsync( + String resourceGroupName, String cacheName) { + Mono>> mono = upgradeFirmwareWithResponseAsync(resourceGroupName, cacheName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Object.class, Object.class, Context.NONE); + } + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginUpgradeFirmwareAsync( + String resourceGroupName, String cacheName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = upgradeFirmwareWithResponseAsync(resourceGroupName, cacheName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Object.class, Object.class, context); + } + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginUpgradeFirmware(String resourceGroupName, String cacheName) { + return beginUpgradeFirmwareAsync(resourceGroupName, cacheName).getSyncPoller(); + } + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginUpgradeFirmware( + String resourceGroupName, String cacheName, Context context) { + return beginUpgradeFirmwareAsync(resourceGroupName, cacheName, context).getSyncPoller(); + } + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono upgradeFirmwareAsync(String resourceGroupName, String cacheName) { + return beginUpgradeFirmwareAsync(resourceGroupName, cacheName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono upgradeFirmwareAsync(String resourceGroupName, String cacheName, Context context) { + return beginUpgradeFirmwareAsync(resourceGroupName, cacheName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object upgradeFirmware(String resourceGroupName, String cacheName) { + return upgradeFirmwareAsync(resourceGroupName, cacheName).block(); + } + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object upgradeFirmware(String resourceGroupName, String cacheName, Context context) { + return upgradeFirmwareAsync(resourceGroupName, cacheName, 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 result of the request to list Caches. + */ + @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 Caches. + */ + @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)); + } + + /** + * 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 Caches. + */ + @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 result of the request to list Caches. + */ + @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)); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesImpl.java new file mode 100644 index 000000000000..7f40589a9f4a --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesImpl.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.storagecache.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.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.CachesClient; +import com.azure.resourcemanager.storagecache.fluent.models.CacheInner; +import com.azure.resourcemanager.storagecache.models.Cache; +import com.azure.resourcemanager.storagecache.models.Caches; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CachesImpl implements Caches { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CachesImpl.class); + + private final CachesClient innerClient; + + private final StorageCacheManager serviceManager; + + public CachesImpl(CachesClient innerClient, StorageCacheManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new CacheImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new CacheImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new CacheImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new CacheImpl(inner1, this.manager())); + } + + public Object deleteByResourceGroup(String resourceGroupName, String cacheName) { + return this.serviceClient().delete(resourceGroupName, cacheName); + } + + public Object delete(String resourceGroupName, String cacheName, Context context) { + return this.serviceClient().delete(resourceGroupName, cacheName, context); + } + + public Cache getByResourceGroup(String resourceGroupName, String cacheName) { + CacheInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, cacheName); + if (inner != null) { + return new CacheImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String cacheName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, cacheName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CacheImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void debugInfo(String resourceGroupName, String cacheName) { + this.serviceClient().debugInfo(resourceGroupName, cacheName); + } + + public void debugInfo(String resourceGroupName, String cacheName, Context context) { + this.serviceClient().debugInfo(resourceGroupName, cacheName, context); + } + + public Object flush(String resourceGroupName, String cacheName) { + return this.serviceClient().flush(resourceGroupName, cacheName); + } + + public Object flush(String resourceGroupName, String cacheName, Context context) { + return this.serviceClient().flush(resourceGroupName, cacheName, context); + } + + public Object start(String resourceGroupName, String cacheName) { + return this.serviceClient().start(resourceGroupName, cacheName); + } + + public Object start(String resourceGroupName, String cacheName, Context context) { + return this.serviceClient().start(resourceGroupName, cacheName, context); + } + + public Object stop(String resourceGroupName, String cacheName) { + return this.serviceClient().stop(resourceGroupName, cacheName); + } + + public Object stop(String resourceGroupName, String cacheName, Context context) { + return this.serviceClient().stop(resourceGroupName, cacheName, context); + } + + public Object upgradeFirmware(String resourceGroupName, String cacheName) { + return this.serviceClient().upgradeFirmware(resourceGroupName, cacheName); + } + + public Object upgradeFirmware(String resourceGroupName, String cacheName, Context context) { + return this.serviceClient().upgradeFirmware(resourceGroupName, cacheName, context); + } + + public Cache 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 cacheName = Utils.getValueFromIdByName(id, "caches"); + if (cacheName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cacheName, 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 cacheName = Utils.getValueFromIdByName(id, "caches"); + if (cacheName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cacheName, context); + } + + public Object 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 cacheName = Utils.getValueFromIdByName(id, "caches"); + if (cacheName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id))); + } + return this.delete(resourceGroupName, cacheName, Context.NONE); + } + + public Object 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 cacheName = Utils.getValueFromIdByName(id, "caches"); + if (cacheName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id))); + } + return this.delete(resourceGroupName, cacheName, context); + } + + private CachesClient serviceClient() { + return this.innerClient; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } + + public CacheImpl define(String name) { + return new CacheImpl(name, this.manager()); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/OperationsClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..48448fcb3797 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/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.storagecache.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.storagecache.fluent.OperationsClient; +import com.azure.resourcemanager.storagecache.fluent.models.ApiOperationInner; +import com.azure.resourcemanager.storagecache.models.ApiOperationListResult; +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 StorageCacheManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(StorageCacheManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageCacheManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageCacheManageme") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.StorageCache/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 Resource Provider 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 Resource Provider 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 Resource Provider 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 Resource Provider 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 Resource Provider 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 Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Resource Provider 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 Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available Resource Provider 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 Resource Provider operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available Resource Provider 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 Resource Provider 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 Resource Provider 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 Resource Provider 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/OperationsImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/OperationsImpl.java new file mode 100644 index 000000000000..d9426d565270 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/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.storagecache.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.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.OperationsClient; +import com.azure.resourcemanager.storagecache.fluent.models.ApiOperationInner; +import com.azure.resourcemanager.storagecache.models.ApiOperation; +import com.azure.resourcemanager.storagecache.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 StorageCacheManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, StorageCacheManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new ApiOperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new ApiOperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/ResourceSkuImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/ResourceSkuImpl.java new file mode 100644 index 000000000000..ad574055ba70 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/ResourceSkuImpl.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.storagecache.implementation; + +import com.azure.resourcemanager.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.models.ResourceSkuInner; +import com.azure.resourcemanager.storagecache.models.ResourceSku; +import com.azure.resourcemanager.storagecache.models.ResourceSkuCapabilities; +import com.azure.resourcemanager.storagecache.models.ResourceSkuLocationInfo; +import com.azure.resourcemanager.storagecache.models.Restriction; +import java.util.Collections; +import java.util.List; + +public final class ResourceSkuImpl implements ResourceSku { + private ResourceSkuInner innerObject; + + private final StorageCacheManager serviceManager; + + ResourceSkuImpl(ResourceSkuInner innerObject, StorageCacheManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public List capabilities() { + List inner = this.innerModel().capabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List locationInfo() { + List inner = this.innerModel().locationInfo(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String name() { + return this.innerModel().name(); + } + + public List restrictions() { + List inner = this.innerModel().restrictions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ResourceSkuInner innerModel() { + return this.innerObject; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusClientImpl.java new file mode 100644 index 000000000000..b9d4275a6a95 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusClientImpl.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.storagecache.fluent.SkusClient; +import com.azure.resourcemanager.storagecache.fluent.models.ResourceSkuInner; +import com.azure.resourcemanager.storagecache.models.ResourceSkusResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SkusClient. */ +public final class SkusClientImpl implements SkusClient { + private final ClientLogger logger = new ClientLogger(SkusClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SkusService service; + + /** The service client containing this operation class. */ + private final StorageCacheManagementClientImpl client; + + /** + * Initializes an instance of SkusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SkusClientImpl(StorageCacheManagementClientImpl client) { + this.service = RestProxy.create(SkusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageCacheManagementClientSkus to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageCacheManageme") + private interface SkusService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus") + @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("{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); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this 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 list of StorageCache. + */ + @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()))); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this 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 list of StorageCache. + */ + @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)); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this 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 list of StorageCache. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this 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 list of StorageCache. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this 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 list of StorageCache. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this 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 list of StorageCache. + */ + @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 the response from the List Cache SKUs operation. + */ + @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 response from the List Cache SKUs operation. + */ + @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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusImpl.java new file mode 100644 index 000000000000..a0ffeaebcaef --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusImpl.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.storagecache.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.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.SkusClient; +import com.azure.resourcemanager.storagecache.fluent.models.ResourceSkuInner; +import com.azure.resourcemanager.storagecache.models.ResourceSku; +import com.azure.resourcemanager.storagecache.models.Skus; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SkusImpl implements Skus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SkusImpl.class); + + private final SkusClient innerClient; + + private final StorageCacheManager serviceManager; + + public SkusImpl(SkusClient innerClient, StorageCacheManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new ResourceSkuImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new ResourceSkuImpl(inner1, this.manager())); + } + + private SkusClient serviceClient() { + return this.innerClient; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientBuilder.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientBuilder.java new file mode 100644 index 000000000000..3561de6543d4 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientBuilder.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.storagecache.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 StorageCacheManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {StorageCacheManagementClientImpl.class}) +public final class StorageCacheManagementClientBuilder { + /* + * Subscription credentials which uniquely identify Microsoft Azure + * subscription. The subscription ID forms part of the URI for every + * service call. + */ + private String subscriptionId; + + /** + * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the StorageCacheManagementClientBuilder. + */ + public StorageCacheManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the StorageCacheManagementClientBuilder. + */ + public StorageCacheManagementClientBuilder 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 StorageCacheManagementClientBuilder. + */ + public StorageCacheManagementClientBuilder 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 StorageCacheManagementClientBuilder. + */ + public StorageCacheManagementClientBuilder 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 StorageCacheManagementClientBuilder. + */ + public StorageCacheManagementClientBuilder 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 StorageCacheManagementClientBuilder. + */ + public StorageCacheManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of StorageCacheManagementClientImpl with the provided parameters. + * + * @return an instance of StorageCacheManagementClientImpl. + */ + public StorageCacheManagementClientImpl 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(); + } + StorageCacheManagementClientImpl client = + new StorageCacheManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientImpl.java new file mode 100644 index 000000000000..60ae1333ce3b --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientImpl.java @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.storagecache.fluent.AscOperationsClient; +import com.azure.resourcemanager.storagecache.fluent.CachesClient; +import com.azure.resourcemanager.storagecache.fluent.OperationsClient; +import com.azure.resourcemanager.storagecache.fluent.SkusClient; +import com.azure.resourcemanager.storagecache.fluent.StorageCacheManagementClient; +import com.azure.resourcemanager.storagecache.fluent.StorageTargetsClient; +import com.azure.resourcemanager.storagecache.fluent.UsageModelsClient; +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 StorageCacheManagementClientImpl type. */ +@ServiceClient(builder = StorageCacheManagementClientBuilder.class) +public final class StorageCacheManagementClientImpl implements StorageCacheManagementClient { + private final ClientLogger logger = new ClientLogger(StorageCacheManagementClientImpl.class); + + /** + * Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of + * the URI for every service call. + */ + private final String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @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 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 SkusClient object to access its operations. */ + private final SkusClient skus; + + /** + * Gets the SkusClient object to access its operations. + * + * @return the SkusClient object. + */ + public SkusClient getSkus() { + return this.skus; + } + + /** The UsageModelsClient object to access its operations. */ + private final UsageModelsClient usageModels; + + /** + * Gets the UsageModelsClient object to access its operations. + * + * @return the UsageModelsClient object. + */ + public UsageModelsClient getUsageModels() { + return this.usageModels; + } + + /** The AscOperationsClient object to access its operations. */ + private final AscOperationsClient ascOperations; + + /** + * Gets the AscOperationsClient object to access its operations. + * + * @return the AscOperationsClient object. + */ + public AscOperationsClient getAscOperations() { + return this.ascOperations; + } + + /** The CachesClient object to access its operations. */ + private final CachesClient caches; + + /** + * Gets the CachesClient object to access its operations. + * + * @return the CachesClient object. + */ + public CachesClient getCaches() { + return this.caches; + } + + /** The StorageTargetsClient object to access its operations. */ + private final StorageTargetsClient storageTargets; + + /** + * Gets the StorageTargetsClient object to access its operations. + * + * @return the StorageTargetsClient object. + */ + public StorageTargetsClient getStorageTargets() { + return this.storageTargets; + } + + /** + * Initializes an instance of StorageCacheManagementClient 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 Subscription credentials which uniquely identify Microsoft Azure subscription. The + * subscription ID forms part of the URI for every service call. + * @param endpoint server parameter. + */ + StorageCacheManagementClientImpl( + 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-10-01"; + this.operations = new OperationsClientImpl(this); + this.skus = new SkusClientImpl(this); + this.usageModels = new UsageModelsClientImpl(this); + this.ascOperations = new AscOperationsClientImpl(this); + this.caches = new CachesClientImpl(this); + this.storageTargets = new StorageTargetsClientImpl(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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetImpl.java new file mode 100644 index 000000000000..b23f38f64990 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.models.StorageTargetInner; +import com.azure.resourcemanager.storagecache.models.ClfsTarget; +import com.azure.resourcemanager.storagecache.models.NamespaceJunction; +import com.azure.resourcemanager.storagecache.models.Nfs3Target; +import com.azure.resourcemanager.storagecache.models.ProvisioningStateType; +import com.azure.resourcemanager.storagecache.models.StorageTarget; +import com.azure.resourcemanager.storagecache.models.SystemData; +import com.azure.resourcemanager.storagecache.models.UnknownTarget; +import java.util.Collections; +import java.util.List; + +public final class StorageTargetImpl implements StorageTarget, StorageTarget.Definition, StorageTarget.Update { + private StorageTargetInner innerObject; + + private final StorageCacheManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public List junctions() { + List inner = this.innerModel().junctions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningStateType provisioningState() { + return this.innerModel().provisioningState(); + } + + public Nfs3Target nfs3() { + return this.innerModel().nfs3(); + } + + public ClfsTarget clfs() { + return this.innerModel().clfs(); + } + + public UnknownTarget unknown() { + return this.innerModel().unknown(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public StorageTargetInner innerModel() { + return this.innerObject; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cacheName; + + private String storageTargetName; + + public StorageTargetImpl withExistingCache(String resourceGroupName, String cacheName) { + this.resourceGroupName = resourceGroupName; + this.cacheName = cacheName; + return this; + } + + public StorageTarget create() { + this.innerObject = + serviceManager + .serviceClient() + .getStorageTargets() + .createOrUpdate(resourceGroupName, cacheName, storageTargetName, this.innerModel(), Context.NONE); + return this; + } + + public StorageTarget create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getStorageTargets() + .createOrUpdate(resourceGroupName, cacheName, storageTargetName, this.innerModel(), context); + return this; + } + + StorageTargetImpl(String name, StorageCacheManager serviceManager) { + this.innerObject = new StorageTargetInner(); + this.serviceManager = serviceManager; + this.storageTargetName = name; + } + + public StorageTargetImpl update() { + return this; + } + + public StorageTarget apply() { + this.innerObject = + serviceManager + .serviceClient() + .getStorageTargets() + .createOrUpdate(resourceGroupName, cacheName, storageTargetName, this.innerModel(), Context.NONE); + return this; + } + + public StorageTarget apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getStorageTargets() + .createOrUpdate(resourceGroupName, cacheName, storageTargetName, this.innerModel(), context); + return this; + } + + StorageTargetImpl(StorageTargetInner innerObject, StorageCacheManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.cacheName = Utils.getValueFromIdByName(innerObject.id(), "caches"); + this.storageTargetName = Utils.getValueFromIdByName(innerObject.id(), "storageTargets"); + } + + public StorageTarget refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getStorageTargets() + .getWithResponse(resourceGroupName, cacheName, storageTargetName, Context.NONE) + .getValue(); + return this; + } + + public StorageTarget refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getStorageTargets() + .getWithResponse(resourceGroupName, cacheName, storageTargetName, context) + .getValue(); + return this; + } + + public StorageTargetImpl withJunctions(List junctions) { + this.innerModel().withJunctions(junctions); + return this; + } + + public StorageTargetImpl withProvisioningState(ProvisioningStateType provisioningState) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } + + public StorageTargetImpl withNfs3(Nfs3Target nfs3) { + this.innerModel().withNfs3(nfs3); + return this; + } + + public StorageTargetImpl withClfs(ClfsTarget clfs) { + this.innerModel().withClfs(clfs); + return this; + } + + public StorageTargetImpl withUnknown(UnknownTarget unknown) { + this.innerModel().withUnknown(unknown); + return this; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsClientImpl.java new file mode 100644 index 000000000000..6bea2bbc5da8 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsClientImpl.java @@ -0,0 +1,1244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.storagecache.fluent.StorageTargetsClient; +import com.azure.resourcemanager.storagecache.fluent.models.StorageTargetInner; +import com.azure.resourcemanager.storagecache.models.StorageTargetsResult; +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 StorageTargetsClient. */ +public final class StorageTargetsClientImpl implements StorageTargetsClient { + private final ClientLogger logger = new ClientLogger(StorageTargetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final StorageTargetsService service; + + /** The service client containing this operation class. */ + private final StorageCacheManagementClientImpl client; + + /** + * Initializes an instance of StorageTargetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageTargetsClientImpl(StorageCacheManagementClientImpl client) { + this.service = + RestProxy.create(StorageTargetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageCacheManagementClientStorageTargets to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageCacheManageme") + private interface StorageTargetsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/storageTargets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCache( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/storageTargets/{storageTargetName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @PathParam("storageTargetName") String storageTargetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/storageTargets/{storageTargetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @PathParam("storageTargetName") String storageTargetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/storageTargets/{storageTargetName}") + @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("cacheName") String cacheName, + @PathParam("storageTargetName") String storageTargetName, + @BodyParam("application/json") StorageTargetInner storagetarget, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCacheNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns a list of Storage Targets for the specified Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Storage Targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCacheSinglePageAsync( + String resourceGroupName, String cacheName) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCache( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + 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()))); + } + + /** + * Returns a list of Storage Targets for the specified Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 Storage Targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCacheSinglePageAsync( + String resourceGroupName, String cacheName, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCache( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns a list of Storage Targets for the specified Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Storage Targets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCacheAsync(String resourceGroupName, String cacheName) { + return new PagedFlux<>( + () -> listByCacheSinglePageAsync(resourceGroupName, cacheName), + nextLink -> listByCacheNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of Storage Targets for the specified Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 Storage Targets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCacheAsync( + String resourceGroupName, String cacheName, Context context) { + return new PagedFlux<>( + () -> listByCacheSinglePageAsync(resourceGroupName, cacheName, context), + nextLink -> listByCacheNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of Storage Targets for the specified Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Storage Targets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCache(String resourceGroupName, String cacheName) { + return new PagedIterable<>(listByCacheAsync(resourceGroupName, cacheName)); + } + + /** + * Returns a list of Storage Targets for the specified Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 Storage Targets. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCache(String resourceGroupName, String cacheName, Context context) { + return new PagedIterable<>(listByCacheAsync(resourceGroupName, cacheName, context)); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + accept, + context); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginDeleteAsync( + String resourceGroupName, String cacheName, String storageTargetName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, cacheName, storageTargetName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Object.class, Object.class, Context.NONE); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Object> beginDeleteAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, cacheName, storageTargetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Object.class, Object.class, context); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginDelete( + String resourceGroupName, String cacheName, String storageTargetName) { + return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName).getSyncPoller(); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Object> beginDelete( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName, context).getSyncPoller(); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object delete(String resourceGroupName, String cacheName, String storageTargetName) { + return deleteAsync(resourceGroupName, cacheName, storageTargetName).block(); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @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 any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object delete(String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return deleteAsync(resourceGroupName, cacheName, storageTargetName, context).block(); + } + + /** + * Returns a Storage Target from a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Returns a Storage Target from a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName, 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + accept, + context); + } + + /** + * Returns a Storage Target from a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return getWithResponseAsync(resourceGroupName, cacheName, storageTargetName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns a Storage Target from a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageTargetInner get(String resourceGroupName, String cacheName, String storageTargetName) { + return getAsync(resourceGroupName, cacheName, storageTargetName).block(); + } + + /** + * Returns a Storage Target from a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return getWithResponseAsync(resourceGroupName, cacheName, storageTargetName, context).block(); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + if (storagetarget != null) { + storagetarget.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + storagetarget, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String cacheName, + String storageTargetName, + StorageTargetInner storagetarget, + 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 (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + if (storagetarget != null) { + storagetarget.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + storagetarget, + accept, + context); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, StorageTargetInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), StorageTargetInner.class, StorageTargetInner.class, Context.NONE); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, StorageTargetInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String cacheName, + String storageTargetName, + StorageTargetInner storagetarget, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), StorageTargetInner.class, StorageTargetInner.class, context); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, StorageTargetInner> beginCreateOrUpdate( + String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + return beginCreateOrUpdateAsync(resourceGroupName, cacheName, storageTargetName, storagetarget).getSyncPoller(); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, StorageTargetInner> beginCreateOrUpdate( + String resourceGroupName, + String cacheName, + String storageTargetName, + StorageTargetInner storagetarget, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cacheName, storageTargetName, storagetarget, context) + .getSyncPoller(); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + return beginCreateOrUpdateAsync(resourceGroupName, cacheName, storageTargetName, storagetarget) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String cacheName, String storageTargetName) { + final StorageTargetInner storagetarget = null; + return beginCreateOrUpdateAsync(resourceGroupName, cacheName, storageTargetName, storagetarget) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String cacheName, + String storageTargetName, + StorageTargetInner storagetarget, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cacheName, storageTargetName, storagetarget, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageTargetInner createOrUpdate( + String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + return createOrUpdateAsync(resourceGroupName, cacheName, storageTargetName, storagetarget).block(); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageTargetInner createOrUpdate(String resourceGroupName, String cacheName, String storageTargetName) { + final StorageTargetInner storagetarget = null; + return createOrUpdateAsync(resourceGroupName, cacheName, storageTargetName, storagetarget).block(); + } + + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, + * the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @param storagetarget Object containing the definition of a Storage Target. + * @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 type of the Storage Target. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageTargetInner createOrUpdate( + String resourceGroupName, + String cacheName, + String storageTargetName, + StorageTargetInner storagetarget, + Context context) { + return createOrUpdateAsync(resourceGroupName, cacheName, storageTargetName, storagetarget, 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 a list of Storage Targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCacheNextSinglePageAsync(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.listByCacheNext(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 a list of Storage Targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCacheNextSinglePageAsync(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 + .listByCacheNext(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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsImpl.java new file mode 100644 index 000000000000..e4b2fd655f6a --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.StorageTargetsClient; +import com.azure.resourcemanager.storagecache.fluent.models.StorageTargetInner; +import com.azure.resourcemanager.storagecache.models.StorageTarget; +import com.azure.resourcemanager.storagecache.models.StorageTargets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class StorageTargetsImpl implements StorageTargets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageTargetsImpl.class); + + private final StorageTargetsClient innerClient; + + private final StorageCacheManager serviceManager; + + public StorageTargetsImpl(StorageTargetsClient innerClient, StorageCacheManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCache(String resourceGroupName, String cacheName) { + PagedIterable inner = this.serviceClient().listByCache(resourceGroupName, cacheName); + return inner.mapPage(inner1 -> new StorageTargetImpl(inner1, this.manager())); + } + + public PagedIterable listByCache(String resourceGroupName, String cacheName, Context context) { + PagedIterable inner = + this.serviceClient().listByCache(resourceGroupName, cacheName, context); + return inner.mapPage(inner1 -> new StorageTargetImpl(inner1, this.manager())); + } + + public Object delete(String resourceGroupName, String cacheName, String storageTargetName) { + return this.serviceClient().delete(resourceGroupName, cacheName, storageTargetName); + } + + public Object delete(String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return this.serviceClient().delete(resourceGroupName, cacheName, storageTargetName, context); + } + + public StorageTarget get(String resourceGroupName, String cacheName, String storageTargetName) { + StorageTargetInner inner = this.serviceClient().get(resourceGroupName, cacheName, storageTargetName); + if (inner != null) { + return new StorageTargetImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, cacheName, storageTargetName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new StorageTargetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public StorageTarget 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 cacheName = Utils.getValueFromIdByName(id, "caches"); + if (cacheName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id))); + } + String storageTargetName = Utils.getValueFromIdByName(id, "storageTargets"); + if (storageTargetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'storageTargets'.", id))); + } + return this.getWithResponse(resourceGroupName, cacheName, storageTargetName, 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 cacheName = Utils.getValueFromIdByName(id, "caches"); + if (cacheName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id))); + } + String storageTargetName = Utils.getValueFromIdByName(id, "storageTargets"); + if (storageTargetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'storageTargets'.", id))); + } + return this.getWithResponse(resourceGroupName, cacheName, storageTargetName, context); + } + + public Object 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 cacheName = Utils.getValueFromIdByName(id, "caches"); + if (cacheName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id))); + } + String storageTargetName = Utils.getValueFromIdByName(id, "storageTargets"); + if (storageTargetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'storageTargets'.", id))); + } + return this.delete(resourceGroupName, cacheName, storageTargetName, Context.NONE); + } + + public Object 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 cacheName = Utils.getValueFromIdByName(id, "caches"); + if (cacheName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'caches'.", id))); + } + String storageTargetName = Utils.getValueFromIdByName(id, "storageTargets"); + if (storageTargetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'storageTargets'.", id))); + } + return this.delete(resourceGroupName, cacheName, storageTargetName, context); + } + + private StorageTargetsClient serviceClient() { + return this.innerClient; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } + + public StorageTargetImpl define(String name) { + return new StorageTargetImpl(name, this.manager()); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelImpl.java new file mode 100644 index 000000000000..11a9a4a80130 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelImpl.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.storagecache.implementation; + +import com.azure.resourcemanager.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.models.UsageModelInner; +import com.azure.resourcemanager.storagecache.models.UsageModel; +import com.azure.resourcemanager.storagecache.models.UsageModelDisplay; + +public final class UsageModelImpl implements UsageModel { + private UsageModelInner innerObject; + + private final StorageCacheManager serviceManager; + + UsageModelImpl(UsageModelInner innerObject, StorageCacheManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public UsageModelDisplay display() { + return this.innerModel().display(); + } + + public String modelName() { + return this.innerModel().modelName(); + } + + public String targetType() { + return this.innerModel().targetType(); + } + + public UsageModelInner innerModel() { + return this.innerObject; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsClientImpl.java new file mode 100644 index 000000000000..9b6b216541fb --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsClientImpl.java @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.storagecache.fluent.UsageModelsClient; +import com.azure.resourcemanager.storagecache.fluent.models.UsageModelInner; +import com.azure.resourcemanager.storagecache.models.UsageModelsResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in UsageModelsClient. */ +public final class UsageModelsClientImpl implements UsageModelsClient { + private final ClientLogger logger = new ClientLogger(UsageModelsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final UsageModelsService service; + + /** The service client containing this operation class. */ + private final StorageCacheManagementClientImpl client; + + /** + * Initializes an instance of UsageModelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UsageModelsClientImpl(StorageCacheManagementClientImpl client) { + this.service = + RestProxy.create(UsageModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageCacheManagementClientUsageModels to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageCacheManageme") + private interface UsageModelsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels") + @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("{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); + } + + /** + * Get the list of Cache Usage Models available to this 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 list of Cache Usage Models available to this 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()))); + } + + /** + * Get the list of Cache Usage Models available to this 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 list of Cache Usage Models available to this 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)); + } + + /** + * Get the list of Cache Usage Models available to this 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 list of Cache Usage Models available to this subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get the list of Cache Usage Models available to this 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 list of Cache Usage Models available to this subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the list of Cache Usage Models available to this 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 list of Cache Usage Models available to this subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get the list of Cache Usage Models available to this 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 list of Cache Usage Models available to this subscription. + */ + @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 a list of Cache usage models. + */ + @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 a list of Cache usage models. + */ + @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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsImpl.java new file mode 100644 index 000000000000..d031ddfaf0f5 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsImpl.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.storagecache.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.storagecache.StorageCacheManager; +import com.azure.resourcemanager.storagecache.fluent.UsageModelsClient; +import com.azure.resourcemanager.storagecache.fluent.models.UsageModelInner; +import com.azure.resourcemanager.storagecache.models.UsageModel; +import com.azure.resourcemanager.storagecache.models.UsageModels; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class UsageModelsImpl implements UsageModels { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageModelsImpl.class); + + private final UsageModelsClient innerClient; + + private final StorageCacheManager serviceManager; + + public UsageModelsImpl(UsageModelsClient innerClient, StorageCacheManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new UsageModelImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new UsageModelImpl(inner1, this.manager())); + } + + private UsageModelsClient serviceClient() { + return this.innerClient; + } + + private StorageCacheManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/Utils.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/Utils.java new file mode 100644 index 000000000000..e9e20fea6fea --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/Utils.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.implementation; + +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).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; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/package-info.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/package-info.java new file mode 100644 index 000000000000..9d8365d2f001 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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 StorageCacheManagementClient. A Storage Cache provides scalable caching + * service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). + * These operations allow you to manage Caches. + */ +package com.azure.resourcemanager.storagecache.implementation; diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperation.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperation.java new file mode 100644 index 000000000000..715a158a8f81 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperation.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.models; + +import com.azure.resourcemanager.storagecache.fluent.models.ApiOperationInner; + +/** An immutable client-side representation of ApiOperation. */ +public interface ApiOperation { + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + ApiOperationDisplay display(); + + /** + * Gets the origin property: Origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the isDataAction property: The flag that indicates whether the operation applies to data plane. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the serviceSpecification property: Specification of the all the metrics provided for a resource type. + * + * @return the serviceSpecification value. + */ + ApiOperationPropertiesServiceSpecification serviceSpecification(); + + /** + * Gets the inner com.azure.resourcemanager.storagecache.fluent.models.ApiOperationInner object. + * + * @return the inner object. + */ + ApiOperationInner innerModel(); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationDisplay.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationDisplay.java new file mode 100644 index 000000000000..88d6619f0476 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationDisplay.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.storagecache.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 object that represents the operation. */ +@Fluent +public final class ApiOperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiOperationDisplay.class); + + /* + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Service provider: Microsoft.StorageCache + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed: Cache, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * The description of the operation + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the operation property: Operation type: Read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type: Read, write, delete, etc. + * + * @param operation the operation value to set. + * @return the ApiOperationDisplay object itself. + */ + public ApiOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the provider property: Service provider: Microsoft.StorageCache. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft.StorageCache. + * + * @param provider the provider value to set. + * @return the ApiOperationDisplay object itself. + */ + public ApiOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed: Cache, etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed: Cache, etc. + * + * @param resource the resource value to set. + * @return the ApiOperationDisplay object itself. + */ + public ApiOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the operation. + * + * @param description the description value to set. + * @return the ApiOperationDisplay object itself. + */ + public ApiOperationDisplay 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationListResult.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationListResult.java new file mode 100644 index 000000000000..c0b2faaacb73 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationListResult.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.fluent.models.ApiOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get + * the next set of results. + */ +@Fluent +public final class ApiOperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiOperationListResult.class); + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * List of Resource Provider operations supported by the + * Microsoft.StorageCache resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /** + * 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; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the ApiOperationListResult object itself. + */ + public ApiOperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: List of Resource Provider operations supported by the Microsoft.StorageCache resource + * provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Resource Provider operations supported by the Microsoft.StorageCache resource + * provider. + * + * @param value the value value to set. + * @return the ApiOperationListResult object itself. + */ + public ApiOperationListResult 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationPropertiesServiceSpecification.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationPropertiesServiceSpecification.java new file mode 100644 index 000000000000..bf7189f30c14 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ApiOperationPropertiesServiceSpecification.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.storagecache.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; + +/** Specification of the all the metrics provided for a resource type. */ +@Fluent +public final class ApiOperationPropertiesServiceSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiOperationPropertiesServiceSpecification.class); + + /* + * Details about operations related to metrics. + */ + @JsonProperty(value = "metricSpecifications") + private List metricSpecifications; + + /** + * Get the metricSpecifications property: Details about operations related to metrics. + * + * @return the metricSpecifications value. + */ + public List metricSpecifications() { + return this.metricSpecifications; + } + + /** + * Set the metricSpecifications property: Details about operations related to metrics. + * + * @param metricSpecifications the metricSpecifications value to set. + * @return the ApiOperationPropertiesServiceSpecification object itself. + */ + public ApiOperationPropertiesServiceSpecification withMetricSpecifications( + List metricSpecifications) { + this.metricSpecifications = metricSpecifications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metricSpecifications() != null) { + metricSpecifications().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/AscOperation.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/AscOperation.java new file mode 100644 index 000000000000..5541e8715d4c --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/AscOperation.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.models; + +import com.azure.resourcemanager.storagecache.fluent.models.AscOperationInner; + +/** An immutable client-side representation of AscOperation. */ +public interface AscOperation { + /** + * 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. + */ + ErrorResponse error(); + + /** + * Gets the inner com.azure.resourcemanager.storagecache.fluent.models.AscOperationInner object. + * + * @return the inner object. + */ + AscOperationInner innerModel(); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/AscOperations.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/AscOperations.java new file mode 100644 index 000000000000..0fcbaa391b68 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/AscOperations.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.storagecache.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AscOperations. */ +public interface AscOperations { + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache. + * + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous 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 an asynchronous operation for the Azure HPC Cache. + */ + AscOperation get(String location, String operationId); + + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache. + * + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @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 an asynchronous operation for the Azure HPC Cache. + */ + Response getWithResponse(String location, String operationId, Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Cache.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Cache.java new file mode 100644 index 000000000000..1a2a03ba836a --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Cache.java @@ -0,0 +1,511 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagecache.fluent.models.CacheInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Cache. */ +public interface Cache { + /** + * 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 cache, if configured. + * + * @return the identity value. + */ + CacheIdentity identity(); + + /** + * Gets the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the sku property: SKU for the Cache. + * + * @return the sku value. + */ + CacheSku sku(); + + /** + * Gets the cacheSizeGB property: The size of this Cache, in GB. + * + * @return the cacheSizeGB value. + */ + Integer cacheSizeGB(); + + /** + * Gets the health property: Health of the Cache. + * + * @return the health value. + */ + CacheHealth health(); + + /** + * Gets the mountAddresses property: Array of IP addresses that can be used by clients mounting this Cache. + * + * @return the mountAddresses value. + */ + List mountAddresses(); + + /** + * Gets the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @return the provisioningState value. + */ + ProvisioningStateType provisioningState(); + + /** + * Gets the subnet property: Subnet used for the Cache. + * + * @return the subnet value. + */ + String subnet(); + + /** + * Gets the upgradeStatus property: Upgrade status of the Cache. + * + * @return the upgradeStatus value. + */ + CacheUpgradeStatus upgradeStatus(); + + /** + * Gets the networkSettings property: Specifies network settings of the cache. + * + * @return the networkSettings value. + */ + CacheNetworkSettings networkSettings(); + + /** + * Gets the encryptionSettings property: Specifies encryption settings of the cache. + * + * @return the encryptionSettings value. + */ + CacheEncryptionSettings encryptionSettings(); + + /** + * Gets the securitySettings property: Specifies security settings of the cache. + * + * @return the securitySettings value. + */ + CacheSecuritySettings securitySettings(); + + /** + * Gets the directoryServicesSettings property: Specifies Directory Services settings of the cache. + * + * @return the directoryServicesSettings value. + */ + CacheDirectorySettings directoryServicesSettings(); + + /** + * 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.storagecache.fluent.models.CacheInner object. + * + * @return the inner object. + */ + CacheInner innerModel(); + + /** The entirety of the Cache definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Cache definition stages. */ + interface DefinitionStages { + /** The first stage of the Cache definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Cache 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 Cache definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Target resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Cache 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.WithCacheSizeGB, + DefinitionStages.WithProvisioningState, + DefinitionStages.WithSubnet, + DefinitionStages.WithUpgradeStatus, + DefinitionStages.WithNetworkSettings, + DefinitionStages.WithEncryptionSettings, + DefinitionStages.WithSecuritySettings, + DefinitionStages.WithDirectoryServicesSettings { + /** + * Executes the create request. + * + * @return the created resource. + */ + Cache create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Cache create(Context context); + } + /** The stage of the Cache 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 Cache definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the cache, if configured.. + * + * @param identity The identity of the cache, if configured. + * @return the next definition stage. + */ + WithCreate withIdentity(CacheIdentity identity); + } + /** The stage of the Cache definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: SKU for the Cache.. + * + * @param sku SKU for the Cache. + * @return the next definition stage. + */ + WithCreate withSku(CacheSku sku); + } + /** The stage of the Cache definition allowing to specify cacheSizeGB. */ + interface WithCacheSizeGB { + /** + * Specifies the cacheSizeGB property: The size of this Cache, in GB.. + * + * @param cacheSizeGB The size of this Cache, in GB. + * @return the next definition stage. + */ + WithCreate withCacheSizeGB(Integer cacheSizeGB); + } + /** The stage of the Cache definition allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @param provisioningState ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * @return the next definition stage. + */ + WithCreate withProvisioningState(ProvisioningStateType provisioningState); + } + /** The stage of the Cache definition allowing to specify subnet. */ + interface WithSubnet { + /** + * Specifies the subnet property: Subnet used for the Cache.. + * + * @param subnet Subnet used for the Cache. + * @return the next definition stage. + */ + WithCreate withSubnet(String subnet); + } + /** The stage of the Cache definition allowing to specify upgradeStatus. */ + interface WithUpgradeStatus { + /** + * Specifies the upgradeStatus property: Upgrade status of the Cache.. + * + * @param upgradeStatus Upgrade status of the Cache. + * @return the next definition stage. + */ + WithCreate withUpgradeStatus(CacheUpgradeStatus upgradeStatus); + } + /** The stage of the Cache definition allowing to specify networkSettings. */ + interface WithNetworkSettings { + /** + * Specifies the networkSettings property: Specifies network settings of the cache.. + * + * @param networkSettings Specifies network settings of the cache. + * @return the next definition stage. + */ + WithCreate withNetworkSettings(CacheNetworkSettings networkSettings); + } + /** The stage of the Cache definition allowing to specify encryptionSettings. */ + interface WithEncryptionSettings { + /** + * Specifies the encryptionSettings property: Specifies encryption settings of the cache.. + * + * @param encryptionSettings Specifies encryption settings of the cache. + * @return the next definition stage. + */ + WithCreate withEncryptionSettings(CacheEncryptionSettings encryptionSettings); + } + /** The stage of the Cache definition allowing to specify securitySettings. */ + interface WithSecuritySettings { + /** + * Specifies the securitySettings property: Specifies security settings of the cache.. + * + * @param securitySettings Specifies security settings of the cache. + * @return the next definition stage. + */ + WithCreate withSecuritySettings(CacheSecuritySettings securitySettings); + } + /** The stage of the Cache definition allowing to specify directoryServicesSettings. */ + interface WithDirectoryServicesSettings { + /** + * Specifies the directoryServicesSettings property: Specifies Directory Services settings of the cache.. + * + * @param directoryServicesSettings Specifies Directory Services settings of the cache. + * @return the next definition stage. + */ + WithCreate withDirectoryServicesSettings(CacheDirectorySettings directoryServicesSettings); + } + } + /** + * Begins update for the Cache resource. + * + * @return the stage of resource update. + */ + Cache.Update update(); + + /** The template for Cache update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithSku, + UpdateStages.WithCacheSizeGB, + UpdateStages.WithProvisioningState, + UpdateStages.WithSubnet, + UpdateStages.WithUpgradeStatus, + UpdateStages.WithNetworkSettings, + UpdateStages.WithEncryptionSettings, + UpdateStages.WithSecuritySettings, + UpdateStages.WithDirectoryServicesSettings { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Cache apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Cache apply(Context context); + } + /** The Cache update stages. */ + interface UpdateStages { + /** The stage of the Cache 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 Cache update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the cache, if configured.. + * + * @param identity The identity of the cache, if configured. + * @return the next definition stage. + */ + Update withIdentity(CacheIdentity identity); + } + /** The stage of the Cache update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: SKU for the Cache.. + * + * @param sku SKU for the Cache. + * @return the next definition stage. + */ + Update withSku(CacheSku sku); + } + /** The stage of the Cache update allowing to specify cacheSizeGB. */ + interface WithCacheSizeGB { + /** + * Specifies the cacheSizeGB property: The size of this Cache, in GB.. + * + * @param cacheSizeGB The size of this Cache, in GB. + * @return the next definition stage. + */ + Update withCacheSizeGB(Integer cacheSizeGB); + } + /** The stage of the Cache update allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @param provisioningState ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * @return the next definition stage. + */ + Update withProvisioningState(ProvisioningStateType provisioningState); + } + /** The stage of the Cache update allowing to specify subnet. */ + interface WithSubnet { + /** + * Specifies the subnet property: Subnet used for the Cache.. + * + * @param subnet Subnet used for the Cache. + * @return the next definition stage. + */ + Update withSubnet(String subnet); + } + /** The stage of the Cache update allowing to specify upgradeStatus. */ + interface WithUpgradeStatus { + /** + * Specifies the upgradeStatus property: Upgrade status of the Cache.. + * + * @param upgradeStatus Upgrade status of the Cache. + * @return the next definition stage. + */ + Update withUpgradeStatus(CacheUpgradeStatus upgradeStatus); + } + /** The stage of the Cache update allowing to specify networkSettings. */ + interface WithNetworkSettings { + /** + * Specifies the networkSettings property: Specifies network settings of the cache.. + * + * @param networkSettings Specifies network settings of the cache. + * @return the next definition stage. + */ + Update withNetworkSettings(CacheNetworkSettings networkSettings); + } + /** The stage of the Cache update allowing to specify encryptionSettings. */ + interface WithEncryptionSettings { + /** + * Specifies the encryptionSettings property: Specifies encryption settings of the cache.. + * + * @param encryptionSettings Specifies encryption settings of the cache. + * @return the next definition stage. + */ + Update withEncryptionSettings(CacheEncryptionSettings encryptionSettings); + } + /** The stage of the Cache update allowing to specify securitySettings. */ + interface WithSecuritySettings { + /** + * Specifies the securitySettings property: Specifies security settings of the cache.. + * + * @param securitySettings Specifies security settings of the cache. + * @return the next definition stage. + */ + Update withSecuritySettings(CacheSecuritySettings securitySettings); + } + /** The stage of the Cache update allowing to specify directoryServicesSettings. */ + interface WithDirectoryServicesSettings { + /** + * Specifies the directoryServicesSettings property: Specifies Directory Services settings of the cache.. + * + * @param directoryServicesSettings Specifies Directory Services settings of the cache. + * @return the next definition stage. + */ + Update withDirectoryServicesSettings(CacheDirectorySettings directoryServicesSettings); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Cache refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Cache refresh(Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheActiveDirectorySettings.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheActiveDirectorySettings.java new file mode 100644 index 000000000000..7a394589eb21 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheActiveDirectorySettings.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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; + +/** Active Directory settings used to join a cache to a domain. */ +@Fluent +public final class CacheActiveDirectorySettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheActiveDirectorySettings.class); + + /* + * Primary DNS IP address used to resolve the Active Directory domain + * controller's fully qualified domain name. + */ + @JsonProperty(value = "primaryDnsIpAddress", required = true) + private String primaryDnsIpAddress; + + /* + * Secondary DNS IP address used to resolve the Active Directory domain + * controller's fully qualified domain name. + */ + @JsonProperty(value = "secondaryDnsIpAddress") + private String secondaryDnsIpAddress; + + /* + * The fully qualified domain name of the Active Directory domain + * controller. + */ + @JsonProperty(value = "domainName", required = true) + private String domainName; + + /* + * The Active Directory domain's NetBIOS name. + */ + @JsonProperty(value = "domainNetBiosName", required = true) + private String domainNetBiosName; + + /* + * The NetBIOS name to assign to the HPC Cache when it joins the Active + * Directory domain as a server. Length must 1-15 characters from the class + * [-0-9a-zA-Z]. + */ + @JsonProperty(value = "cacheNetBiosName", required = true) + private String cacheNetBiosName; + + /* + * True if the HPC Cache is joined to the Active Directory domain. + */ + @JsonProperty(value = "domainJoined", access = JsonProperty.Access.WRITE_ONLY) + private DomainJoinedType domainJoined; + + /* + * Active Directory admin credentials used to join the HPC Cache to a + * domain. + */ + @JsonProperty(value = "credentials") + private CacheActiveDirectorySettingsCredentials credentials; + + /** + * Get the primaryDnsIpAddress property: Primary DNS IP address used to resolve the Active Directory domain + * controller's fully qualified domain name. + * + * @return the primaryDnsIpAddress value. + */ + public String primaryDnsIpAddress() { + return this.primaryDnsIpAddress; + } + + /** + * Set the primaryDnsIpAddress property: Primary DNS IP address used to resolve the Active Directory domain + * controller's fully qualified domain name. + * + * @param primaryDnsIpAddress the primaryDnsIpAddress value to set. + * @return the CacheActiveDirectorySettings object itself. + */ + public CacheActiveDirectorySettings withPrimaryDnsIpAddress(String primaryDnsIpAddress) { + this.primaryDnsIpAddress = primaryDnsIpAddress; + return this; + } + + /** + * Get the secondaryDnsIpAddress property: Secondary DNS IP address used to resolve the Active Directory domain + * controller's fully qualified domain name. + * + * @return the secondaryDnsIpAddress value. + */ + public String secondaryDnsIpAddress() { + return this.secondaryDnsIpAddress; + } + + /** + * Set the secondaryDnsIpAddress property: Secondary DNS IP address used to resolve the Active Directory domain + * controller's fully qualified domain name. + * + * @param secondaryDnsIpAddress the secondaryDnsIpAddress value to set. + * @return the CacheActiveDirectorySettings object itself. + */ + public CacheActiveDirectorySettings withSecondaryDnsIpAddress(String secondaryDnsIpAddress) { + this.secondaryDnsIpAddress = secondaryDnsIpAddress; + return this; + } + + /** + * Get the domainName property: The fully qualified domain name of the Active Directory domain controller. + * + * @return the domainName value. + */ + public String domainName() { + return this.domainName; + } + + /** + * Set the domainName property: The fully qualified domain name of the Active Directory domain controller. + * + * @param domainName the domainName value to set. + * @return the CacheActiveDirectorySettings object itself. + */ + public CacheActiveDirectorySettings withDomainName(String domainName) { + this.domainName = domainName; + return this; + } + + /** + * Get the domainNetBiosName property: The Active Directory domain's NetBIOS name. + * + * @return the domainNetBiosName value. + */ + public String domainNetBiosName() { + return this.domainNetBiosName; + } + + /** + * Set the domainNetBiosName property: The Active Directory domain's NetBIOS name. + * + * @param domainNetBiosName the domainNetBiosName value to set. + * @return the CacheActiveDirectorySettings object itself. + */ + public CacheActiveDirectorySettings withDomainNetBiosName(String domainNetBiosName) { + this.domainNetBiosName = domainNetBiosName; + return this; + } + + /** + * Get the cacheNetBiosName property: The NetBIOS name to assign to the HPC Cache when it joins the Active Directory + * domain as a server. Length must 1-15 characters from the class [-0-9a-zA-Z]. + * + * @return the cacheNetBiosName value. + */ + public String cacheNetBiosName() { + return this.cacheNetBiosName; + } + + /** + * Set the cacheNetBiosName property: The NetBIOS name to assign to the HPC Cache when it joins the Active Directory + * domain as a server. Length must 1-15 characters from the class [-0-9a-zA-Z]. + * + * @param cacheNetBiosName the cacheNetBiosName value to set. + * @return the CacheActiveDirectorySettings object itself. + */ + public CacheActiveDirectorySettings withCacheNetBiosName(String cacheNetBiosName) { + this.cacheNetBiosName = cacheNetBiosName; + return this; + } + + /** + * Get the domainJoined property: True if the HPC Cache is joined to the Active Directory domain. + * + * @return the domainJoined value. + */ + public DomainJoinedType domainJoined() { + return this.domainJoined; + } + + /** + * Get the credentials property: Active Directory admin credentials used to join the HPC Cache to a domain. + * + * @return the credentials value. + */ + public CacheActiveDirectorySettingsCredentials credentials() { + return this.credentials; + } + + /** + * Set the credentials property: Active Directory admin credentials used to join the HPC Cache to a domain. + * + * @param credentials the credentials value to set. + * @return the CacheActiveDirectorySettings object itself. + */ + public CacheActiveDirectorySettings withCredentials(CacheActiveDirectorySettingsCredentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (primaryDnsIpAddress() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property primaryDnsIpAddress in model CacheActiveDirectorySettings")); + } + if (domainName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property domainName in model CacheActiveDirectorySettings")); + } + if (domainNetBiosName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property domainNetBiosName in model CacheActiveDirectorySettings")); + } + if (cacheNetBiosName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property cacheNetBiosName in model CacheActiveDirectorySettings")); + } + if (credentials() != null) { + credentials().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheActiveDirectorySettingsCredentials.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheActiveDirectorySettingsCredentials.java new file mode 100644 index 000000000000..938b0d118004 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheActiveDirectorySettingsCredentials.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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; + +/** Active Directory admin credentials used to join the HPC Cache to a domain. */ +@Fluent +public final class CacheActiveDirectorySettingsCredentials { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheActiveDirectorySettingsCredentials.class); + + /* + * Username of the Active Directory domain administrator. This value is + * stored encrypted and not returned on response. + */ + @JsonProperty(value = "username", required = true) + private String username; + + /* + * Plain text password of the Active Directory domain administrator. This + * value is stored encrypted and not returned on response. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /** + * Get the username property: Username of the Active Directory domain administrator. This value is stored encrypted + * and not returned on response. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Username of the Active Directory domain administrator. This value is stored encrypted + * and not returned on response. + * + * @param username the username value to set. + * @return the CacheActiveDirectorySettingsCredentials object itself. + */ + public CacheActiveDirectorySettingsCredentials withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Plain text password of the Active Directory domain administrator. This value is stored + * encrypted and not returned on response. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Plain text password of the Active Directory domain administrator. This value is stored + * encrypted and not returned on response. + * + * @param password the password value to set. + * @return the CacheActiveDirectorySettingsCredentials object itself. + */ + public CacheActiveDirectorySettingsCredentials withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (username() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property username in model CacheActiveDirectorySettingsCredentials")); + } + if (password() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property password in model CacheActiveDirectorySettingsCredentials")); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheDirectorySettings.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheDirectorySettings.java new file mode 100644 index 000000000000..9c8abe0476b1 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheDirectorySettings.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.storagecache.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; + +/** Cache Directory Services settings. */ +@Fluent +public final class CacheDirectorySettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheDirectorySettings.class); + + /* + * Specifies settings for joining the HPC Cache to an Active Directory + * domain. + */ + @JsonProperty(value = "activeDirectory") + private CacheActiveDirectorySettings activeDirectory; + + /* + * Specifies settings for Extended Groups. Extended Groups allows users to + * be members of more than 16 groups. + */ + @JsonProperty(value = "usernameDownload") + private CacheUsernameDownloadSettings usernameDownload; + + /** + * Get the activeDirectory property: Specifies settings for joining the HPC Cache to an Active Directory domain. + * + * @return the activeDirectory value. + */ + public CacheActiveDirectorySettings activeDirectory() { + return this.activeDirectory; + } + + /** + * Set the activeDirectory property: Specifies settings for joining the HPC Cache to an Active Directory domain. + * + * @param activeDirectory the activeDirectory value to set. + * @return the CacheDirectorySettings object itself. + */ + public CacheDirectorySettings withActiveDirectory(CacheActiveDirectorySettings activeDirectory) { + this.activeDirectory = activeDirectory; + return this; + } + + /** + * Get the usernameDownload property: Specifies settings for Extended Groups. Extended Groups allows users to be + * members of more than 16 groups. + * + * @return the usernameDownload value. + */ + public CacheUsernameDownloadSettings usernameDownload() { + return this.usernameDownload; + } + + /** + * Set the usernameDownload property: Specifies settings for Extended Groups. Extended Groups allows users to be + * members of more than 16 groups. + * + * @param usernameDownload the usernameDownload value to set. + * @return the CacheDirectorySettings object itself. + */ + public CacheDirectorySettings withUsernameDownload(CacheUsernameDownloadSettings usernameDownload) { + this.usernameDownload = usernameDownload; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (activeDirectory() != null) { + activeDirectory().validate(); + } + if (usernameDownload() != null) { + usernameDownload().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheEncryptionSettings.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheEncryptionSettings.java new file mode 100644 index 000000000000..0ada57c44aa9 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheEncryptionSettings.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.storagecache.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; + +/** Cache encryption settings. */ +@Fluent +public final class CacheEncryptionSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheEncryptionSettings.class); + + /* + * Specifies the location of the key encryption key in Key Vault. + */ + @JsonProperty(value = "keyEncryptionKey") + private KeyVaultKeyReference keyEncryptionKey; + + /** + * Get the keyEncryptionKey property: Specifies the location of the key encryption key in Key Vault. + * + * @return the keyEncryptionKey value. + */ + public KeyVaultKeyReference keyEncryptionKey() { + return this.keyEncryptionKey; + } + + /** + * Set the keyEncryptionKey property: Specifies the location of the key encryption key in Key Vault. + * + * @param keyEncryptionKey the keyEncryptionKey value to set. + * @return the CacheEncryptionSettings object itself. + */ + public CacheEncryptionSettings withKeyEncryptionKey(KeyVaultKeyReference keyEncryptionKey) { + this.keyEncryptionKey = keyEncryptionKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyEncryptionKey() != null) { + keyEncryptionKey().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheHealth.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheHealth.java new file mode 100644 index 000000000000..ee48da2085bc --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheHealth.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.storagecache.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; + +/** An indication of Cache health. Gives more information about health than just that related to provisioning. */ +@Fluent +public final class CacheHealth { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheHealth.class); + + /* + * List of Cache health states. + */ + @JsonProperty(value = "state") + private HealthStateType state; + + /* + * Describes explanation of state. + */ + @JsonProperty(value = "statusDescription") + private String statusDescription; + + /** + * Get the state property: List of Cache health states. + * + * @return the state value. + */ + public HealthStateType state() { + return this.state; + } + + /** + * Set the state property: List of Cache health states. + * + * @param state the state value to set. + * @return the CacheHealth object itself. + */ + public CacheHealth withState(HealthStateType state) { + this.state = state; + return this; + } + + /** + * Get the statusDescription property: Describes explanation of state. + * + * @return the statusDescription value. + */ + public String statusDescription() { + return this.statusDescription; + } + + /** + * Set the statusDescription property: Describes explanation of state. + * + * @param statusDescription the statusDescription value to set. + * @return the CacheHealth object itself. + */ + public CacheHealth withStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentity.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentity.java new file mode 100644 index 000000000000..a1cf41231003 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentity.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.storagecache.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; + +/** Cache identity properties. */ +@Fluent +public class CacheIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheIdentity.class); + + /* + * The principal id of the cache. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id associated with the cache. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of identity used for the cache + */ + @JsonProperty(value = "type") + private CacheIdentityType type; + + /** + * Get the principalId property: The principal id of the cache. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant id associated with the cache. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of identity used for the cache. + * + * @return the type value. + */ + public CacheIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the cache. + * + * @param type the type value to set. + * @return the CacheIdentity object itself. + */ + public CacheIdentity withType(CacheIdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentityType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentityType.java new file mode 100644 index 000000000000..83fa0092d53f --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentityType.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.storagecache.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for CacheIdentityType. */ +public enum CacheIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a CacheIdentityType instance. */ + private final String value; + + CacheIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CacheIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed CacheIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static CacheIdentityType fromString(String value) { + CacheIdentityType[] items = CacheIdentityType.values(); + for (CacheIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheNetworkSettings.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheNetworkSettings.java new file mode 100644 index 000000000000..ff1aa74f3090 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheNetworkSettings.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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; + +/** Cache network settings. */ +@Fluent +public final class CacheNetworkSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheNetworkSettings.class); + + /* + * The IPv4 maximum transmission unit configured for the subnet. + */ + @JsonProperty(value = "mtu") + private Integer mtu; + + /* + * Array of additional IP addresses used by this Cache. + */ + @JsonProperty(value = "utilityAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List utilityAddresses; + + /** + * Get the mtu property: The IPv4 maximum transmission unit configured for the subnet. + * + * @return the mtu value. + */ + public Integer mtu() { + return this.mtu; + } + + /** + * Set the mtu property: The IPv4 maximum transmission unit configured for the subnet. + * + * @param mtu the mtu value to set. + * @return the CacheNetworkSettings object itself. + */ + public CacheNetworkSettings withMtu(Integer mtu) { + this.mtu = mtu; + return this; + } + + /** + * Get the utilityAddresses property: Array of additional IP addresses used by this Cache. + * + * @return the utilityAddresses value. + */ + public List utilityAddresses() { + return this.utilityAddresses; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheSecuritySettings.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheSecuritySettings.java new file mode 100644 index 000000000000..96ede4741476 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheSecuritySettings.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.storagecache.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; + +/** Cache security settings. */ +@Fluent +public final class CacheSecuritySettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheSecuritySettings.class); + + /* + * NFS access policies defined for this cache. + */ + @JsonProperty(value = "accessPolicies") + private List accessPolicies; + + /** + * Get the accessPolicies property: NFS access policies defined for this cache. + * + * @return the accessPolicies value. + */ + public List accessPolicies() { + return this.accessPolicies; + } + + /** + * Set the accessPolicies property: NFS access policies defined for this cache. + * + * @param accessPolicies the accessPolicies value to set. + * @return the CacheSecuritySettings object itself. + */ + public CacheSecuritySettings withAccessPolicies(List accessPolicies) { + this.accessPolicies = accessPolicies; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (accessPolicies() != null) { + accessPolicies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheSku.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheSku.java new file mode 100644 index 000000000000..b3115b101765 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheSku.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.storagecache.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; + +/** SKU for the Cache. */ +@Fluent +public final class CacheSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheSku.class); + + /* + * SKU name for this Cache. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: SKU name for this Cache. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: SKU name for this Cache. + * + * @param name the name value to set. + * @return the CacheSku object itself. + */ + public CacheSku withName(String 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUpgradeStatus.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUpgradeStatus.java new file mode 100644 index 000000000000..703160c00389 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUpgradeStatus.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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; +import java.time.OffsetDateTime; + +/** Properties describing the software upgrade state of the Cache. */ +@Immutable +public final class CacheUpgradeStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheUpgradeStatus.class); + + /* + * Version string of the firmware currently installed on this Cache. + */ + @JsonProperty(value = "currentFirmwareVersion", access = JsonProperty.Access.WRITE_ONLY) + private String currentFirmwareVersion; + + /* + * True if there is a firmware update ready to install on this Cache. The + * firmware will automatically be installed after firmwareUpdateDeadline if + * not triggered earlier via the upgrade operation. + */ + @JsonProperty(value = "firmwareUpdateStatus", access = JsonProperty.Access.WRITE_ONLY) + private FirmwareStatusType firmwareUpdateStatus; + + /* + * Time at which the pending firmware update will automatically be + * installed on the Cache. + */ + @JsonProperty(value = "firmwareUpdateDeadline", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime firmwareUpdateDeadline; + + /* + * Time of the last successful firmware update. + */ + @JsonProperty(value = "lastFirmwareUpdate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastFirmwareUpdate; + + /* + * When firmwareUpdateAvailable is true, this field holds the version + * string for the update. + */ + @JsonProperty(value = "pendingFirmwareVersion", access = JsonProperty.Access.WRITE_ONLY) + private String pendingFirmwareVersion; + + /** + * Get the currentFirmwareVersion property: Version string of the firmware currently installed on this Cache. + * + * @return the currentFirmwareVersion value. + */ + public String currentFirmwareVersion() { + return this.currentFirmwareVersion; + } + + /** + * Get the firmwareUpdateStatus property: True if there is a firmware update ready to install on this Cache. The + * firmware will automatically be installed after firmwareUpdateDeadline if not triggered earlier via the upgrade + * operation. + * + * @return the firmwareUpdateStatus value. + */ + public FirmwareStatusType firmwareUpdateStatus() { + return this.firmwareUpdateStatus; + } + + /** + * Get the firmwareUpdateDeadline property: Time at which the pending firmware update will automatically be + * installed on the Cache. + * + * @return the firmwareUpdateDeadline value. + */ + public OffsetDateTime firmwareUpdateDeadline() { + return this.firmwareUpdateDeadline; + } + + /** + * Get the lastFirmwareUpdate property: Time of the last successful firmware update. + * + * @return the lastFirmwareUpdate value. + */ + public OffsetDateTime lastFirmwareUpdate() { + return this.lastFirmwareUpdate; + } + + /** + * Get the pendingFirmwareVersion property: When firmwareUpdateAvailable is true, this field holds the version + * string for the update. + * + * @return the pendingFirmwareVersion value. + */ + public String pendingFirmwareVersion() { + return this.pendingFirmwareVersion; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUsernameDownloadSettings.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUsernameDownloadSettings.java new file mode 100644 index 000000000000..3dc43b28deb8 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUsernameDownloadSettings.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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; + +/** Settings for Extended Groups username and group download. */ +@Fluent +public final class CacheUsernameDownloadSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheUsernameDownloadSettings.class); + + /* + * Whether or not Extended Groups is enabled. + */ + @JsonProperty(value = "extendedGroupsEnabled") + private Boolean extendedGroupsEnabled; + + /* + * This setting determines how the cache gets username and group names for + * clients. + */ + @JsonProperty(value = "usernameSource") + private UsernameSource usernameSource; + + /* + * The URI of the file containing group information (in /etc/group file + * format). This field must be populated when 'usernameSource' is set to + * 'File'. + */ + @JsonProperty(value = "groupFileURI") + private String groupFileUri; + + /* + * The URI of the file containing user information (in /etc/passwd file + * format). This field must be populated when 'usernameSource' is set to + * 'File'. + */ + @JsonProperty(value = "userFileURI") + private String userFileUri; + + /* + * The fully qualified domain name or IP address of the LDAP server to use. + */ + @JsonProperty(value = "ldapServer") + private String ldapServer; + + /* + * The base distinguished name for the LDAP domain. + */ + @JsonProperty(value = "ldapBaseDn") + private String ldapBaseDn; + + /* + * Whether or not the LDAP connection should be encrypted. + */ + @JsonProperty(value = "encryptLdapConnection") + private Boolean encryptLdapConnection; + + /* + * Determines if the certificates must be validated by a certificate + * authority. When true, caCertificateURI must be provided. + */ + @JsonProperty(value = "requireValidCertificate") + private Boolean requireValidCertificate; + + /* + * Determines if the certificate should be automatically downloaded. This + * applies to 'caCertificateURI' only if 'requireValidCertificate' is true. + */ + @JsonProperty(value = "autoDownloadCertificate") + private Boolean autoDownloadCertificate; + + /* + * The URI of the CA certificate to validate the LDAP secure connection. + * This field must be populated when 'requireValidCertificate' is set to + * true. + */ + @JsonProperty(value = "caCertificateURI") + private String caCertificateUri; + + /* + * Indicates whether or not the HPC Cache has performed the username + * download successfully. + */ + @JsonProperty(value = "usernameDownloaded", access = JsonProperty.Access.WRITE_ONLY) + private UsernameDownloadedType usernameDownloaded; + + /* + * When present, these are the credentials for the secure LDAP connection. + */ + @JsonProperty(value = "credentials") + private CacheUsernameDownloadSettingsCredentials credentials; + + /** + * Get the extendedGroupsEnabled property: Whether or not Extended Groups is enabled. + * + * @return the extendedGroupsEnabled value. + */ + public Boolean extendedGroupsEnabled() { + return this.extendedGroupsEnabled; + } + + /** + * Set the extendedGroupsEnabled property: Whether or not Extended Groups is enabled. + * + * @param extendedGroupsEnabled the extendedGroupsEnabled value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withExtendedGroupsEnabled(Boolean extendedGroupsEnabled) { + this.extendedGroupsEnabled = extendedGroupsEnabled; + return this; + } + + /** + * Get the usernameSource property: This setting determines how the cache gets username and group names for clients. + * + * @return the usernameSource value. + */ + public UsernameSource usernameSource() { + return this.usernameSource; + } + + /** + * Set the usernameSource property: This setting determines how the cache gets username and group names for clients. + * + * @param usernameSource the usernameSource value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withUsernameSource(UsernameSource usernameSource) { + this.usernameSource = usernameSource; + return this; + } + + /** + * Get the groupFileUri property: The URI of the file containing group information (in /etc/group file format). This + * field must be populated when 'usernameSource' is set to 'File'. + * + * @return the groupFileUri value. + */ + public String groupFileUri() { + return this.groupFileUri; + } + + /** + * Set the groupFileUri property: The URI of the file containing group information (in /etc/group file format). This + * field must be populated when 'usernameSource' is set to 'File'. + * + * @param groupFileUri the groupFileUri value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withGroupFileUri(String groupFileUri) { + this.groupFileUri = groupFileUri; + return this; + } + + /** + * Get the userFileUri property: The URI of the file containing user information (in /etc/passwd file format). This + * field must be populated when 'usernameSource' is set to 'File'. + * + * @return the userFileUri value. + */ + public String userFileUri() { + return this.userFileUri; + } + + /** + * Set the userFileUri property: The URI of the file containing user information (in /etc/passwd file format). This + * field must be populated when 'usernameSource' is set to 'File'. + * + * @param userFileUri the userFileUri value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withUserFileUri(String userFileUri) { + this.userFileUri = userFileUri; + return this; + } + + /** + * Get the ldapServer property: The fully qualified domain name or IP address of the LDAP server to use. + * + * @return the ldapServer value. + */ + public String ldapServer() { + return this.ldapServer; + } + + /** + * Set the ldapServer property: The fully qualified domain name or IP address of the LDAP server to use. + * + * @param ldapServer the ldapServer value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withLdapServer(String ldapServer) { + this.ldapServer = ldapServer; + return this; + } + + /** + * Get the ldapBaseDn property: The base distinguished name for the LDAP domain. + * + * @return the ldapBaseDn value. + */ + public String ldapBaseDn() { + return this.ldapBaseDn; + } + + /** + * Set the ldapBaseDn property: The base distinguished name for the LDAP domain. + * + * @param ldapBaseDn the ldapBaseDn value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withLdapBaseDn(String ldapBaseDn) { + this.ldapBaseDn = ldapBaseDn; + return this; + } + + /** + * Get the encryptLdapConnection property: Whether or not the LDAP connection should be encrypted. + * + * @return the encryptLdapConnection value. + */ + public Boolean encryptLdapConnection() { + return this.encryptLdapConnection; + } + + /** + * Set the encryptLdapConnection property: Whether or not the LDAP connection should be encrypted. + * + * @param encryptLdapConnection the encryptLdapConnection value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withEncryptLdapConnection(Boolean encryptLdapConnection) { + this.encryptLdapConnection = encryptLdapConnection; + return this; + } + + /** + * Get the requireValidCertificate property: Determines if the certificates must be validated by a certificate + * authority. When true, caCertificateURI must be provided. + * + * @return the requireValidCertificate value. + */ + public Boolean requireValidCertificate() { + return this.requireValidCertificate; + } + + /** + * Set the requireValidCertificate property: Determines if the certificates must be validated by a certificate + * authority. When true, caCertificateURI must be provided. + * + * @param requireValidCertificate the requireValidCertificate value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withRequireValidCertificate(Boolean requireValidCertificate) { + this.requireValidCertificate = requireValidCertificate; + return this; + } + + /** + * Get the autoDownloadCertificate property: Determines if the certificate should be automatically downloaded. This + * applies to 'caCertificateURI' only if 'requireValidCertificate' is true. + * + * @return the autoDownloadCertificate value. + */ + public Boolean autoDownloadCertificate() { + return this.autoDownloadCertificate; + } + + /** + * Set the autoDownloadCertificate property: Determines if the certificate should be automatically downloaded. This + * applies to 'caCertificateURI' only if 'requireValidCertificate' is true. + * + * @param autoDownloadCertificate the autoDownloadCertificate value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withAutoDownloadCertificate(Boolean autoDownloadCertificate) { + this.autoDownloadCertificate = autoDownloadCertificate; + return this; + } + + /** + * Get the caCertificateUri property: The URI of the CA certificate to validate the LDAP secure connection. This + * field must be populated when 'requireValidCertificate' is set to true. + * + * @return the caCertificateUri value. + */ + public String caCertificateUri() { + return this.caCertificateUri; + } + + /** + * Set the caCertificateUri property: The URI of the CA certificate to validate the LDAP secure connection. This + * field must be populated when 'requireValidCertificate' is set to true. + * + * @param caCertificateUri the caCertificateUri value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withCaCertificateUri(String caCertificateUri) { + this.caCertificateUri = caCertificateUri; + return this; + } + + /** + * Get the usernameDownloaded property: Indicates whether or not the HPC Cache has performed the username download + * successfully. + * + * @return the usernameDownloaded value. + */ + public UsernameDownloadedType usernameDownloaded() { + return this.usernameDownloaded; + } + + /** + * Get the credentials property: When present, these are the credentials for the secure LDAP connection. + * + * @return the credentials value. + */ + public CacheUsernameDownloadSettingsCredentials credentials() { + return this.credentials; + } + + /** + * Set the credentials property: When present, these are the credentials for the secure LDAP connection. + * + * @param credentials the credentials value to set. + * @return the CacheUsernameDownloadSettings object itself. + */ + public CacheUsernameDownloadSettings withCredentials(CacheUsernameDownloadSettingsCredentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (credentials() != null) { + credentials().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUsernameDownloadSettingsCredentials.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUsernameDownloadSettingsCredentials.java new file mode 100644 index 000000000000..6ff095d1180f --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheUsernameDownloadSettingsCredentials.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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; + +/** When present, these are the credentials for the secure LDAP connection. */ +@Fluent +public final class CacheUsernameDownloadSettingsCredentials { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheUsernameDownloadSettingsCredentials.class); + + /* + * The Bind Distinguished Name identity to be used in the secure LDAP + * connection. This value is stored encrypted and not returned on response. + */ + @JsonProperty(value = "bindDn") + private String bindDn; + + /* + * The Bind password to be used in the secure LDAP connection. This value + * is stored encrypted and not returned on response. + */ + @JsonProperty(value = "bindPassword") + private String bindPassword; + + /** + * Get the bindDn property: The Bind Distinguished Name identity to be used in the secure LDAP connection. This + * value is stored encrypted and not returned on response. + * + * @return the bindDn value. + */ + public String bindDn() { + return this.bindDn; + } + + /** + * Set the bindDn property: The Bind Distinguished Name identity to be used in the secure LDAP connection. This + * value is stored encrypted and not returned on response. + * + * @param bindDn the bindDn value to set. + * @return the CacheUsernameDownloadSettingsCredentials object itself. + */ + public CacheUsernameDownloadSettingsCredentials withBindDn(String bindDn) { + this.bindDn = bindDn; + return this; + } + + /** + * Get the bindPassword property: The Bind password to be used in the secure LDAP connection. This value is stored + * encrypted and not returned on response. + * + * @return the bindPassword value. + */ + public String bindPassword() { + return this.bindPassword; + } + + /** + * Set the bindPassword property: The Bind password to be used in the secure LDAP connection. This value is stored + * encrypted and not returned on response. + * + * @param bindPassword the bindPassword value to set. + * @return the CacheUsernameDownloadSettingsCredentials object itself. + */ + public CacheUsernameDownloadSettingsCredentials withBindPassword(String bindPassword) { + this.bindPassword = bindPassword; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Caches.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Caches.java new file mode 100644 index 000000000000..58766f9a27a6 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Caches.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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 Caches. */ +public interface Caches { + /** + * Returns all Caches the user has access to under 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 result of the request to list Caches. + */ + PagedIterable list(); + + /** + * Returns all Caches the user has access to under 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 result of the request to list Caches. + */ + PagedIterable list(Context context); + + /** + * Returns all Caches the user has access to under a resource group. + * + * @param resourceGroupName Target resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Caches. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns all Caches the user has access to under a resource group. + * + * @param resourceGroupName Target resource group. + * @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 Caches. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + Object deleteByResourceGroup(String resourceGroupName, String cacheName); + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + Object delete(String resourceGroupName, String cacheName, Context context); + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Cache instance. + */ + Cache getByResourceGroup(String resourceGroupName, String cacheName); + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 Cache instance. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String cacheName, Context context); + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 debugInfo(String resourceGroupName, String cacheName); + + /** + * Tells a Cache to write generate debug info for support to process. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 debugInfo(String resourceGroupName, String cacheName, Context context); + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + Object flush(String resourceGroupName, String cacheName); + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors + * returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + Object flush(String resourceGroupName, String cacheName, Context context); + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + Object start(String resourceGroupName, String cacheName); + + /** + * Tells a Stopped state Cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + Object start(String resourceGroupName, String cacheName, Context context); + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + Object stop(String resourceGroupName, String cacheName); + + /** + * Tells an Active Cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + Object stop(String resourceGroupName, String cacheName, Context context); + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + Object upgradeFirmware(String resourceGroupName, String cacheName); + + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 any object. + */ + Object upgradeFirmware(String resourceGroupName, String cacheName, Context context); + + /** + * Returns a Cache. + * + * @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 Cache instance. + */ + Cache getById(String id); + + /** + * Returns a Cache. + * + * @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 Cache instance. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Schedules a Cache for deletion. + * + * @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 any object. + */ + Object deleteById(String id); + + /** + * Schedules a Cache for deletion. + * + * @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 any object. + */ + Object deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Cache resource. + * + * @param name resource name. + * @return the first stage of the new Cache definition. + */ + Cache.DefinitionStages.Blank define(String name); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CachesListResult.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CachesListResult.java new file mode 100644 index 000000000000..3e1715efd823 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CachesListResult.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.storagecache.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.fluent.models.CacheInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the request to list Caches. It contains a list of Caches and a URL link to get the next set of results. */ +@Fluent +public final class CachesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CachesListResult.class); + + /* + * URL to get the next set of Cache list results, if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * List of Caches. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the nextLink property: URL to get the next set of Cache list results, if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of Cache list results, if there are any. + * + * @param nextLink the nextLink value to set. + * @return the CachesListResult object itself. + */ + public CachesListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: List of Caches. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Caches. + * + * @param value the value value to set. + * @return the CachesListResult object itself. + */ + public CachesListResult 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ClfsTarget.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ClfsTarget.java new file mode 100644 index 000000000000..0dc8e69c59b7 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ClfsTarget.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.storagecache.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; + +/** Properties pertaining to the ClfsTarget. */ +@Fluent +public final class ClfsTarget { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClfsTarget.class); + + /* + * Resource ID of storage container. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Get the target property: Resource ID of storage container. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: Resource ID of storage container. + * + * @param target the target value to set. + * @return the ClfsTarget object itself. + */ + public ClfsTarget withTarget(String target) { + this.target = target; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ClfsTargetProperties.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ClfsTargetProperties.java new file mode 100644 index 000000000000..21469f3500df --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ClfsTargetProperties.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Storage container for use as a CLFS Storage Target. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "targetType") +@JsonTypeName("clfs") +@Immutable +public final class ClfsTargetProperties extends StorageTargetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClfsTargetProperties.class); + + /** {@inheritDoc} */ + @Override + public ClfsTargetProperties withJunctions(List junctions) { + super.withJunctions(junctions); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClfsTargetProperties withProvisioningState(ProvisioningStateType provisioningState) { + super.withProvisioningState(provisioningState); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClfsTargetProperties withNfs3(Nfs3Target nfs3) { + super.withNfs3(nfs3); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClfsTargetProperties withClfs(ClfsTarget clfs) { + super.withClfs(clfs); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClfsTargetProperties withUnknown(UnknownTarget unknown) { + super.withUnknown(unknown); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CreatedByType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CreatedByType.java new file mode 100644 index 000000000000..e8c4ecd76cd1 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CreatedByType.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreatedByType. */ +public final class CreatedByType extends ExpandableStringEnum { + /** Static value User for CreatedByType. */ + public static final CreatedByType USER = fromString("User"); + + /** Static value Application for CreatedByType. */ + public static final CreatedByType APPLICATION = fromString("Application"); + + /** Static value ManagedIdentity for CreatedByType. */ + public static final CreatedByType MANAGED_IDENTITY = fromString("ManagedIdentity"); + + /** Static value Key for CreatedByType. */ + public static final CreatedByType KEY = fromString("Key"); + + /** + * Creates or finds a CreatedByType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreatedByType. + */ + @JsonCreator + public static CreatedByType fromString(String name) { + return fromString(name, CreatedByType.class); + } + + /** @return known CreatedByType values. */ + public static Collection values() { + return values(CreatedByType.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/DomainJoinedType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/DomainJoinedType.java new file mode 100644 index 000000000000..d53098001aaf --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/DomainJoinedType.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DomainJoinedType. */ +public final class DomainJoinedType extends ExpandableStringEnum { + /** Static value Yes for DomainJoinedType. */ + public static final DomainJoinedType YES = fromString("Yes"); + + /** Static value No for DomainJoinedType. */ + public static final DomainJoinedType NO = fromString("No"); + + /** Static value Error for DomainJoinedType. */ + public static final DomainJoinedType ERROR = fromString("Error"); + + /** + * Creates or finds a DomainJoinedType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DomainJoinedType. + */ + @JsonCreator + public static DomainJoinedType fromString(String name) { + return fromString(name, DomainJoinedType.class); + } + + /** @return known DomainJoinedType values. */ + public static Collection values() { + return values(DomainJoinedType.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ErrorResponse.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ErrorResponse.java new file mode 100644 index 000000000000..281d7fcf04e8 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ErrorResponse.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.storagecache.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 the format of Error response. */ +@Fluent +public final class ErrorResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorResponse.class); + + /* + * Error code + */ + @JsonProperty(value = "code") + private String code; + + /* + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the code property: Error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: Error code. + * + * @param code the code value to set. + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: Error message indicating why the operation failed. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Error message indicating why the operation failed. + * + * @param message the message value to set. + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/FirmwareStatusType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/FirmwareStatusType.java new file mode 100644 index 000000000000..5525104ec66c --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/FirmwareStatusType.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for FirmwareStatusType. */ +public final class FirmwareStatusType extends ExpandableStringEnum { + /** Static value available for FirmwareStatusType. */ + public static final FirmwareStatusType AVAILABLE = fromString("available"); + + /** Static value unavailable for FirmwareStatusType. */ + public static final FirmwareStatusType UNAVAILABLE = fromString("unavailable"); + + /** + * Creates or finds a FirmwareStatusType from its string representation. + * + * @param name a name to look for. + * @return the corresponding FirmwareStatusType. + */ + @JsonCreator + public static FirmwareStatusType fromString(String name) { + return fromString(name, FirmwareStatusType.class); + } + + /** @return known FirmwareStatusType values. */ + public static Collection values() { + return values(FirmwareStatusType.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/HealthStateType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/HealthStateType.java new file mode 100644 index 000000000000..755ac8e583da --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/HealthStateType.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HealthStateType. */ +public final class HealthStateType extends ExpandableStringEnum { + /** Static value Unknown for HealthStateType. */ + public static final HealthStateType UNKNOWN = fromString("Unknown"); + + /** Static value Healthy for HealthStateType. */ + public static final HealthStateType HEALTHY = fromString("Healthy"); + + /** Static value Degraded for HealthStateType. */ + public static final HealthStateType DEGRADED = fromString("Degraded"); + + /** Static value Down for HealthStateType. */ + public static final HealthStateType DOWN = fromString("Down"); + + /** Static value Transitioning for HealthStateType. */ + public static final HealthStateType TRANSITIONING = fromString("Transitioning"); + + /** Static value Stopping for HealthStateType. */ + public static final HealthStateType STOPPING = fromString("Stopping"); + + /** Static value Stopped for HealthStateType. */ + public static final HealthStateType STOPPED = fromString("Stopped"); + + /** Static value Upgrading for HealthStateType. */ + public static final HealthStateType UPGRADING = fromString("Upgrading"); + + /** Static value Flushing for HealthStateType. */ + public static final HealthStateType FLUSHING = fromString("Flushing"); + + /** + * Creates or finds a HealthStateType from its string representation. + * + * @param name a name to look for. + * @return the corresponding HealthStateType. + */ + @JsonCreator + public static HealthStateType fromString(String name) { + return fromString(name, HealthStateType.class); + } + + /** @return known HealthStateType values. */ + public static Collection values() { + return values(HealthStateType.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/KeyVaultKeyReference.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/KeyVaultKeyReference.java new file mode 100644 index 000000000000..7b1114716615 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/KeyVaultKeyReference.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.storagecache.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 reference to Key Vault Key. */ +@Fluent +public final class KeyVaultKeyReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultKeyReference.class); + + /* + * The URL referencing a key encryption key in Key Vault. + */ + @JsonProperty(value = "keyUrl", required = true) + private String keyUrl; + + /* + * Describes a resource Id to source Key Vault. + */ + @JsonProperty(value = "sourceVault", required = true) + private KeyVaultKeyReferenceSourceVault sourceVault; + + /** + * Get the keyUrl property: The URL referencing a key encryption key in Key Vault. + * + * @return the keyUrl value. + */ + public String keyUrl() { + return this.keyUrl; + } + + /** + * Set the keyUrl property: The URL referencing a key encryption key in Key Vault. + * + * @param keyUrl the keyUrl value to set. + * @return the KeyVaultKeyReference object itself. + */ + public KeyVaultKeyReference withKeyUrl(String keyUrl) { + this.keyUrl = keyUrl; + return this; + } + + /** + * Get the sourceVault property: Describes a resource Id to source Key Vault. + * + * @return the sourceVault value. + */ + public KeyVaultKeyReferenceSourceVault sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: Describes a resource Id to source Key Vault. + * + * @param sourceVault the sourceVault value to set. + * @return the KeyVaultKeyReference object itself. + */ + public KeyVaultKeyReference withSourceVault(KeyVaultKeyReferenceSourceVault sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyUrl in model KeyVaultKeyReference")); + } + if (sourceVault() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceVault in model KeyVaultKeyReference")); + } else { + sourceVault().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/KeyVaultKeyReferenceSourceVault.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/KeyVaultKeyReferenceSourceVault.java new file mode 100644 index 000000000000..d51e28a2293d --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/KeyVaultKeyReferenceSourceVault.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.storagecache.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 resource Id to source Key Vault. */ +@Fluent +public final class KeyVaultKeyReferenceSourceVault { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultKeyReferenceSourceVault.class); + + /* + * Resource Id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource Id. + * + * @param id the id value to set. + * @return the KeyVaultKeyReferenceSourceVault object itself. + */ + public KeyVaultKeyReferenceSourceVault withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricAggregationType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricAggregationType.java new file mode 100644 index 000000000000..67e98dbb68ac --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricAggregationType.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MetricAggregationType. */ +public final class MetricAggregationType extends ExpandableStringEnum { + /** Static value NotSpecified for MetricAggregationType. */ + public static final MetricAggregationType NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value None for MetricAggregationType. */ + public static final MetricAggregationType NONE = fromString("None"); + + /** Static value Average for MetricAggregationType. */ + public static final MetricAggregationType AVERAGE = fromString("Average"); + + /** Static value Minimum for MetricAggregationType. */ + public static final MetricAggregationType MINIMUM = fromString("Minimum"); + + /** Static value Maximum for MetricAggregationType. */ + public static final MetricAggregationType MAXIMUM = fromString("Maximum"); + + /** Static value Total for MetricAggregationType. */ + public static final MetricAggregationType TOTAL = fromString("Total"); + + /** Static value Count for MetricAggregationType. */ + public static final MetricAggregationType COUNT = fromString("Count"); + + /** + * Creates or finds a MetricAggregationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding MetricAggregationType. + */ + @JsonCreator + public static MetricAggregationType fromString(String name) { + return fromString(name, MetricAggregationType.class); + } + + /** @return known MetricAggregationType values. */ + public static Collection values() { + return values(MetricAggregationType.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricDimension.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricDimension.java new file mode 100644 index 000000000000..d4d0648d5d13 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricDimension.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.storagecache.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; + +/** Specifications of the Dimension of metrics. */ +@Fluent +public final class MetricDimension { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDimension.class); + + /* + * Name of the dimension + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized friendly display name of the dimension + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Internal name of the dimension. + */ + @JsonProperty(value = "internalName") + private String internalName; + + /* + * To be exported to shoe box. + */ + @JsonProperty(value = "toBeExportedForShoebox") + private Boolean toBeExportedForShoebox; + + /** + * Get the name property: Name of the dimension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the dimension. + * + * @param name the name value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized friendly display name of the dimension. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized friendly display name of the dimension. + * + * @param displayName the displayName value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the internalName property: Internal name of the dimension. + * + * @return the internalName value. + */ + public String internalName() { + return this.internalName; + } + + /** + * Set the internalName property: Internal name of the dimension. + * + * @param internalName the internalName value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withInternalName(String internalName) { + this.internalName = internalName; + return this; + } + + /** + * Get the toBeExportedForShoebox property: To be exported to shoe box. + * + * @return the toBeExportedForShoebox value. + */ + public Boolean toBeExportedForShoebox() { + return this.toBeExportedForShoebox; + } + + /** + * Set the toBeExportedForShoebox property: To be exported to shoe box. + * + * @param toBeExportedForShoebox the toBeExportedForShoebox value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withToBeExportedForShoebox(Boolean toBeExportedForShoebox) { + this.toBeExportedForShoebox = toBeExportedForShoebox; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricSpecification.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricSpecification.java new file mode 100644 index 000000000000..49f95b2e9504 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/MetricSpecification.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.storagecache.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; + +/** Details about operation related to metrics. */ +@Fluent +public final class MetricSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricSpecification.class); + + /* + * The name of the metric. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized display name of the metric. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The description of the metric. + */ + @JsonProperty(value = "displayDescription") + private String displayDescription; + + /* + * The unit that the metric is measured in. + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * The type of metric aggregation. + */ + @JsonProperty(value = "aggregationType") + private String aggregationType; + + /* + * Support metric aggregation type. + */ + @JsonProperty(value = "supportedAggregationTypes") + private List supportedAggregationTypes; + + /* + * Type of metrics. + */ + @JsonProperty(value = "metricClass") + private String metricClass; + + /* + * Dimensions of the metric + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * Get the name property: The name of the metric. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the metric. + * + * @param name the name value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized display name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized display name of the metric. + * + * @param displayName the displayName value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the displayDescription property: The description of the metric. + * + * @return the displayDescription value. + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Set the displayDescription property: The description of the metric. + * + * @param displayDescription the displayDescription value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + return this; + } + + /** + * Get the unit property: The unit that the metric is measured in. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: The unit that the metric is measured in. + * + * @param unit the unit value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the aggregationType property: The type of metric aggregation. + * + * @return the aggregationType value. + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Set the aggregationType property: The type of metric aggregation. + * + * @param aggregationType the aggregationType value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withAggregationType(String aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get the supportedAggregationTypes property: Support metric aggregation type. + * + * @return the supportedAggregationTypes value. + */ + public List supportedAggregationTypes() { + return this.supportedAggregationTypes; + } + + /** + * Set the supportedAggregationTypes property: Support metric aggregation type. + * + * @param supportedAggregationTypes the supportedAggregationTypes value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withSupportedAggregationTypes(List supportedAggregationTypes) { + this.supportedAggregationTypes = supportedAggregationTypes; + return this; + } + + /** + * Get the metricClass property: Type of metrics. + * + * @return the metricClass value. + */ + public String metricClass() { + return this.metricClass; + } + + /** + * Set the metricClass property: Type of metrics. + * + * @param metricClass the metricClass value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withMetricClass(String metricClass) { + this.metricClass = metricClass; + return this; + } + + /** + * Get the dimensions property: Dimensions of the metric. + * + * @return the dimensions value. + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: Dimensions of the metric. + * + * @param dimensions the dimensions value to set. + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dimensions() != null) { + dimensions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NamespaceJunction.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NamespaceJunction.java new file mode 100644 index 000000000000..9a49c74f9738 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NamespaceJunction.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.storagecache.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 namespace junction. */ +@Fluent +public final class NamespaceJunction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NamespaceJunction.class); + + /* + * Namespace path on a Cache for a Storage Target. + */ + @JsonProperty(value = "namespacePath") + private String namespacePath; + + /* + * Path in Storage Target to which namespacePath points. + */ + @JsonProperty(value = "targetPath") + private String targetPath; + + /* + * NFS export where targetPath exists. + */ + @JsonProperty(value = "nfsExport") + private String nfsExport; + + /* + * Name of the access policy applied to this junction. + */ + @JsonProperty(value = "nfsAccessPolicy") + private String nfsAccessPolicy; + + /** + * Get the namespacePath property: Namespace path on a Cache for a Storage Target. + * + * @return the namespacePath value. + */ + public String namespacePath() { + return this.namespacePath; + } + + /** + * Set the namespacePath property: Namespace path on a Cache for a Storage Target. + * + * @param namespacePath the namespacePath value to set. + * @return the NamespaceJunction object itself. + */ + public NamespaceJunction withNamespacePath(String namespacePath) { + this.namespacePath = namespacePath; + return this; + } + + /** + * Get the targetPath property: Path in Storage Target to which namespacePath points. + * + * @return the targetPath value. + */ + public String targetPath() { + return this.targetPath; + } + + /** + * Set the targetPath property: Path in Storage Target to which namespacePath points. + * + * @param targetPath the targetPath value to set. + * @return the NamespaceJunction object itself. + */ + public NamespaceJunction withTargetPath(String targetPath) { + this.targetPath = targetPath; + return this; + } + + /** + * Get the nfsExport property: NFS export where targetPath exists. + * + * @return the nfsExport value. + */ + public String nfsExport() { + return this.nfsExport; + } + + /** + * Set the nfsExport property: NFS export where targetPath exists. + * + * @param nfsExport the nfsExport value to set. + * @return the NamespaceJunction object itself. + */ + public NamespaceJunction withNfsExport(String nfsExport) { + this.nfsExport = nfsExport; + return this; + } + + /** + * Get the nfsAccessPolicy property: Name of the access policy applied to this junction. + * + * @return the nfsAccessPolicy value. + */ + public String nfsAccessPolicy() { + return this.nfsAccessPolicy; + } + + /** + * Set the nfsAccessPolicy property: Name of the access policy applied to this junction. + * + * @param nfsAccessPolicy the nfsAccessPolicy value to set. + * @return the NamespaceJunction object itself. + */ + public NamespaceJunction withNfsAccessPolicy(String nfsAccessPolicy) { + this.nfsAccessPolicy = nfsAccessPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Nfs3Target.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Nfs3Target.java new file mode 100644 index 000000000000..4bda128492ee --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Nfs3Target.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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; + +/** Properties pertaining to the Nfs3Target. */ +@Fluent +public final class Nfs3Target { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Nfs3Target.class); + + /* + * IP address or host name of an NFSv3 host (e.g., 10.0.44.44). + */ + @JsonProperty(value = "target") + private String target; + + /* + * Identifies the usage model to be used for this Storage Target. Get + * choices from .../usageModels + */ + @JsonProperty(value = "usageModel") + private String usageModel; + + /** + * Get the target property: IP address or host name of an NFSv3 host (e.g., 10.0.44.44). + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: IP address or host name of an NFSv3 host (e.g., 10.0.44.44). + * + * @param target the target value to set. + * @return the Nfs3Target object itself. + */ + public Nfs3Target withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the usageModel property: Identifies the usage model to be used for this Storage Target. Get choices from + * .../usageModels. + * + * @return the usageModel value. + */ + public String usageModel() { + return this.usageModel; + } + + /** + * Set the usageModel property: Identifies the usage model to be used for this Storage Target. Get choices from + * .../usageModels. + * + * @param usageModel the usageModel value to set. + * @return the Nfs3Target object itself. + */ + public Nfs3Target withUsageModel(String usageModel) { + this.usageModel = usageModel; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Nfs3TargetProperties.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Nfs3TargetProperties.java new file mode 100644 index 000000000000..3946120ffb22 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Nfs3TargetProperties.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** An NFSv3 mount point for use as a Storage Target. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "targetType") +@JsonTypeName("nfs3") +@Immutable +public final class Nfs3TargetProperties extends StorageTargetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Nfs3TargetProperties.class); + + /** {@inheritDoc} */ + @Override + public Nfs3TargetProperties withJunctions(List junctions) { + super.withJunctions(junctions); + return this; + } + + /** {@inheritDoc} */ + @Override + public Nfs3TargetProperties withProvisioningState(ProvisioningStateType provisioningState) { + super.withProvisioningState(provisioningState); + return this; + } + + /** {@inheritDoc} */ + @Override + public Nfs3TargetProperties withNfs3(Nfs3Target nfs3) { + super.withNfs3(nfs3); + return this; + } + + /** {@inheritDoc} */ + @Override + public Nfs3TargetProperties withClfs(ClfsTarget clfs) { + super.withClfs(clfs); + return this; + } + + /** {@inheritDoc} */ + @Override + public Nfs3TargetProperties withUnknown(UnknownTarget unknown) { + super.withUnknown(unknown); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessPolicy.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessPolicy.java new file mode 100644 index 000000000000..f05d0cc2b2e6 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessPolicy.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.storagecache.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; + +/** A set of rules describing access policies applied to NFSv3 clients of the cache. */ +@Fluent +public final class NfsAccessPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NfsAccessPolicy.class); + + /* + * Name identifying this policy. Access Policy names are not case + * sensitive. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The set of rules describing client accesses allowed under this policy. + */ + @JsonProperty(value = "accessRules", required = true) + private List accessRules; + + /** + * Get the name property: Name identifying this policy. Access Policy names are not case sensitive. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name identifying this policy. Access Policy names are not case sensitive. + * + * @param name the name value to set. + * @return the NfsAccessPolicy object itself. + */ + public NfsAccessPolicy withName(String name) { + this.name = name; + return this; + } + + /** + * Get the accessRules property: The set of rules describing client accesses allowed under this policy. + * + * @return the accessRules value. + */ + public List accessRules() { + return this.accessRules; + } + + /** + * Set the accessRules property: The set of rules describing client accesses allowed under this policy. + * + * @param accessRules the accessRules value to set. + * @return the NfsAccessPolicy object itself. + */ + public NfsAccessPolicy withAccessRules(List accessRules) { + this.accessRules = accessRules; + 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 NfsAccessPolicy")); + } + if (accessRules() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property accessRules in model NfsAccessPolicy")); + } else { + accessRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRule.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRule.java new file mode 100644 index 000000000000..e06f04055f00 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRule.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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; + +/** Rule to place restrictions on portions of the cache namespace being presented to clients. */ +@Fluent +public final class NfsAccessRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NfsAccessRule.class); + + /* + * Scope for this rule. The scope and filter determine which clients match + * the rule. + */ + @JsonProperty(value = "scope", required = true) + private NfsAccessRuleScope scope; + + /* + * Filter applied to the scope for this rule. The filter's format depends + * on its scope. 'default' scope matches all clients and has no filter + * value. 'network' scope takes a filter in CIDR format (for example, + * 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name + * as filter. If a client does not match any filter rule and there is no + * default rule, access is denied. + */ + @JsonProperty(value = "filter") + private String filter; + + /* + * Access allowed by this rule. + */ + @JsonProperty(value = "access", required = true) + private NfsAccessRuleAccess access; + + /* + * Allow SUID semantics. + */ + @JsonProperty(value = "suid") + private Boolean suid; + + /* + * For the default policy, allow access to subdirectories under the root + * export. If this is set to no, clients can only mount the path '/'. If + * set to yes, clients can mount a deeper path, like '/a/b'. + */ + @JsonProperty(value = "submountAccess") + private Boolean submountAccess; + + /* + * Map root accesses to anonymousUID and anonymousGID. + */ + @JsonProperty(value = "rootSquash") + private Boolean rootSquash; + + /* + * UID value that replaces 0 when rootSquash is true. + */ + @JsonProperty(value = "anonymousUID") + private String anonymousUid; + + /* + * GID value that replaces 0 when rootSquash is true. + */ + @JsonProperty(value = "anonymousGID") + private String anonymousGid; + + /** + * Get the scope property: Scope for this rule. The scope and filter determine which clients match the rule. + * + * @return the scope value. + */ + public NfsAccessRuleScope scope() { + return this.scope; + } + + /** + * Set the scope property: Scope for this rule. The scope and filter determine which clients match the rule. + * + * @param scope the scope value to set. + * @return the NfsAccessRule object itself. + */ + public NfsAccessRule withScope(NfsAccessRuleScope scope) { + this.scope = scope; + return this; + } + + /** + * Get the filter property: Filter applied to the scope for this rule. The filter's format depends on its scope. + * 'default' scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR format (for + * example, 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name as filter. If a client does not + * match any filter rule and there is no default rule, access is denied. + * + * @return the filter value. + */ + public String filter() { + return this.filter; + } + + /** + * Set the filter property: Filter applied to the scope for this rule. The filter's format depends on its scope. + * 'default' scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR format (for + * example, 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name as filter. If a client does not + * match any filter rule and there is no default rule, access is denied. + * + * @param filter the filter value to set. + * @return the NfsAccessRule object itself. + */ + public NfsAccessRule withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the access property: Access allowed by this rule. + * + * @return the access value. + */ + public NfsAccessRuleAccess access() { + return this.access; + } + + /** + * Set the access property: Access allowed by this rule. + * + * @param access the access value to set. + * @return the NfsAccessRule object itself. + */ + public NfsAccessRule withAccess(NfsAccessRuleAccess access) { + this.access = access; + return this; + } + + /** + * Get the suid property: Allow SUID semantics. + * + * @return the suid value. + */ + public Boolean suid() { + return this.suid; + } + + /** + * Set the suid property: Allow SUID semantics. + * + * @param suid the suid value to set. + * @return the NfsAccessRule object itself. + */ + public NfsAccessRule withSuid(Boolean suid) { + this.suid = suid; + return this; + } + + /** + * Get the submountAccess property: For the default policy, allow access to subdirectories under the root export. If + * this is set to no, clients can only mount the path '/'. If set to yes, clients can mount a deeper path, like + * '/a/b'. + * + * @return the submountAccess value. + */ + public Boolean submountAccess() { + return this.submountAccess; + } + + /** + * Set the submountAccess property: For the default policy, allow access to subdirectories under the root export. If + * this is set to no, clients can only mount the path '/'. If set to yes, clients can mount a deeper path, like + * '/a/b'. + * + * @param submountAccess the submountAccess value to set. + * @return the NfsAccessRule object itself. + */ + public NfsAccessRule withSubmountAccess(Boolean submountAccess) { + this.submountAccess = submountAccess; + return this; + } + + /** + * Get the rootSquash property: Map root accesses to anonymousUID and anonymousGID. + * + * @return the rootSquash value. + */ + public Boolean rootSquash() { + return this.rootSquash; + } + + /** + * Set the rootSquash property: Map root accesses to anonymousUID and anonymousGID. + * + * @param rootSquash the rootSquash value to set. + * @return the NfsAccessRule object itself. + */ + public NfsAccessRule withRootSquash(Boolean rootSquash) { + this.rootSquash = rootSquash; + return this; + } + + /** + * Get the anonymousUid property: UID value that replaces 0 when rootSquash is true. + * + * @return the anonymousUid value. + */ + public String anonymousUid() { + return this.anonymousUid; + } + + /** + * Set the anonymousUid property: UID value that replaces 0 when rootSquash is true. + * + * @param anonymousUid the anonymousUid value to set. + * @return the NfsAccessRule object itself. + */ + public NfsAccessRule withAnonymousUid(String anonymousUid) { + this.anonymousUid = anonymousUid; + return this; + } + + /** + * Get the anonymousGid property: GID value that replaces 0 when rootSquash is true. + * + * @return the anonymousGid value. + */ + public String anonymousGid() { + return this.anonymousGid; + } + + /** + * Set the anonymousGid property: GID value that replaces 0 when rootSquash is true. + * + * @param anonymousGid the anonymousGid value to set. + * @return the NfsAccessRule object itself. + */ + public NfsAccessRule withAnonymousGid(String anonymousGid) { + this.anonymousGid = anonymousGid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (scope() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property scope in model NfsAccessRule")); + } + if (access() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property access in model NfsAccessRule")); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRuleAccess.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRuleAccess.java new file mode 100644 index 000000000000..09399a108fb3 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRuleAccess.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NfsAccessRuleAccess. */ +public final class NfsAccessRuleAccess extends ExpandableStringEnum { + /** Static value no for NfsAccessRuleAccess. */ + public static final NfsAccessRuleAccess NO = fromString("no"); + + /** Static value ro for NfsAccessRuleAccess. */ + public static final NfsAccessRuleAccess RO = fromString("ro"); + + /** Static value rw for NfsAccessRuleAccess. */ + public static final NfsAccessRuleAccess RW = fromString("rw"); + + /** + * Creates or finds a NfsAccessRuleAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding NfsAccessRuleAccess. + */ + @JsonCreator + public static NfsAccessRuleAccess fromString(String name) { + return fromString(name, NfsAccessRuleAccess.class); + } + + /** @return known NfsAccessRuleAccess values. */ + public static Collection values() { + return values(NfsAccessRuleAccess.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRuleScope.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRuleScope.java new file mode 100644 index 000000000000..b51b085c8055 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/NfsAccessRuleScope.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NfsAccessRuleScope. */ +public final class NfsAccessRuleScope extends ExpandableStringEnum { + /** Static value default for NfsAccessRuleScope. */ + public static final NfsAccessRuleScope DEFAULT = fromString("default"); + + /** Static value network for NfsAccessRuleScope. */ + public static final NfsAccessRuleScope NETWORK = fromString("network"); + + /** Static value host for NfsAccessRuleScope. */ + public static final NfsAccessRuleScope HOST = fromString("host"); + + /** + * Creates or finds a NfsAccessRuleScope from its string representation. + * + * @param name a name to look for. + * @return the corresponding NfsAccessRuleScope. + */ + @JsonCreator + public static NfsAccessRuleScope fromString(String name) { + return fromString(name, NfsAccessRuleScope.class); + } + + /** @return known NfsAccessRuleScope values. */ + public static Collection values() { + return values(NfsAccessRuleScope.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Operations.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Operations.java new file mode 100644 index 000000000000..dfbce29e8583 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/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.storagecache.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 Resource Provider 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 Resource Provider operations. + */ + PagedIterable list(); + + /** + * Lists all of the available Resource Provider 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 Resource Provider operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ProvisioningStateType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ProvisioningStateType.java new file mode 100644 index 000000000000..4f746fae8507 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ProvisioningStateType.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningStateType. */ +public final class ProvisioningStateType extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningStateType. */ + public static final ProvisioningStateType SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningStateType. */ + public static final ProvisioningStateType FAILED = fromString("Failed"); + + /** Static value Cancelled for ProvisioningStateType. */ + public static final ProvisioningStateType CANCELLED = fromString("Cancelled"); + + /** Static value Creating for ProvisioningStateType. */ + public static final ProvisioningStateType CREATING = fromString("Creating"); + + /** Static value Deleting for ProvisioningStateType. */ + public static final ProvisioningStateType DELETING = fromString("Deleting"); + + /** Static value Updating for ProvisioningStateType. */ + public static final ProvisioningStateType UPDATING = fromString("Updating"); + + /** + * Creates or finds a ProvisioningStateType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningStateType. + */ + @JsonCreator + public static ProvisioningStateType fromString(String name) { + return fromString(name, ProvisioningStateType.class); + } + + /** @return known ProvisioningStateType values. */ + public static Collection values() { + return values(ProvisioningStateType.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ReasonCode.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ReasonCode.java new file mode 100644 index 000000000000..eb9b49076b25 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ReasonCode.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReasonCode. */ +public final class ReasonCode extends ExpandableStringEnum { + /** Static value QuotaId for ReasonCode. */ + public static final ReasonCode QUOTA_ID = fromString("QuotaId"); + + /** Static value NotAvailableForSubscription for ReasonCode. */ + public static final ReasonCode NOT_AVAILABLE_FOR_SUBSCRIPTION = fromString("NotAvailableForSubscription"); + + /** + * Creates or finds a ReasonCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReasonCode. + */ + @JsonCreator + public static ReasonCode fromString(String name) { + return fromString(name, ReasonCode.class); + } + + /** @return known ReasonCode values. */ + public static Collection values() { + return values(ReasonCode.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSku.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSku.java new file mode 100644 index 000000000000..05aefaa4d3ff --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSku.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.models; + +import com.azure.resourcemanager.storagecache.fluent.models.ResourceSkuInner; +import java.util.List; + +/** An immutable client-side representation of ResourceSku. */ +public interface ResourceSku { + /** + * Gets the resourceType property: The type of resource the SKU applies to. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the capabilities property: A list of capabilities of this SKU, such as throughput or ops/sec. + * + * @return the capabilities value. + */ + List capabilities(); + + /** + * Gets the locations property: The set of locations where the SKU is available. This is the supported and + * registered Azure Geo Regions (e.g., West US, East US, Southeast Asia, etc.). + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the locationInfo property: The set of locations where the SKU is available. + * + * @return the locationInfo value. + */ + List locationInfo(); + + /** + * Gets the name property: The name of this SKU. + * + * @return the name value. + */ + String name(); + + /** + * Gets the restrictions property: The restrictions preventing this SKU from being used. This is empty if there are + * no restrictions. + * + * @return the restrictions value. + */ + List restrictions(); + + /** + * Gets the inner com.azure.resourcemanager.storagecache.fluent.models.ResourceSkuInner object. + * + * @return the inner object. + */ + ResourceSkuInner innerModel(); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkuCapabilities.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkuCapabilities.java new file mode 100644 index 000000000000..9fe327471400 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkuCapabilities.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.storagecache.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 resource SKU capability. */ +@Fluent +public final class ResourceSkuCapabilities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuCapabilities.class); + + /* + * Name of a capability, such as ops/sec. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Quantity, if the capability is measured by quantity. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: Name of a capability, such as ops/sec. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of a capability, such as ops/sec. + * + * @param name the name value to set. + * @return the ResourceSkuCapabilities object itself. + */ + public ResourceSkuCapabilities withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: Quantity, if the capability is measured by quantity. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Quantity, if the capability is measured by quantity. + * + * @param value the value value to set. + * @return the ResourceSkuCapabilities object itself. + */ + public ResourceSkuCapabilities withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkuLocationInfo.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkuLocationInfo.java new file mode 100644 index 000000000000..2a8c57f947ce --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkuLocationInfo.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.storagecache.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; + +/** Resource SKU location information. */ +@Fluent +public final class ResourceSkuLocationInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuLocationInfo.class); + + /* + * Location where this SKU is available. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Zones if any. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get the location property: Location where this SKU is available. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location where this SKU is available. + * + * @param location the location value to set. + * @return the ResourceSkuLocationInfo object itself. + */ + public ResourceSkuLocationInfo withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the zones property: Zones if any. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: Zones if any. + * + * @param zones the zones value to set. + * @return the ResourceSkuLocationInfo object itself. + */ + public ResourceSkuLocationInfo withZones(List zones) { + this.zones = zones; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkusResult.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkusResult.java new file mode 100644 index 000000000000..fc472136198d --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/ResourceSkusResult.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.storagecache.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.fluent.models.ResourceSkuInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response from the List Cache SKUs operation. */ +@Fluent +public final class ResourceSkusResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkusResult.class); + + /* + * The URI to fetch the next page of Cache SKUs. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * The list of SKUs available for the subscription. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the nextLink property: The URI to fetch the next page of Cache SKUs. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of Cache SKUs. + * + * @param nextLink the nextLink value to set. + * @return the ResourceSkusResult object itself. + */ + public ResourceSkusResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: The list of SKUs available for the subscription. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Restriction.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Restriction.java new file mode 100644 index 000000000000..7153ce9668d2 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Restriction.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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 restrictions preventing this SKU from being used. */ +@Fluent +public final class Restriction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Restriction.class); + + /* + * The type of restrictions. In this version, the only possible value for + * this is location. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The value of restrictions. If the restriction type is set to location, + * then this would be the different locations where the SKU is restricted. + */ + @JsonProperty(value = "values", access = JsonProperty.Access.WRITE_ONLY) + private List values; + + /* + * The reason for the restriction. As of now this can be "QuotaId" or + * "NotAvailableForSubscription". "QuotaId" is set when the SKU has + * requiredQuotas parameter as the subscription does not belong to that + * quota. "NotAvailableForSubscription" is related to capacity at the + * datacenter. + */ + @JsonProperty(value = "reasonCode") + private ReasonCode reasonCode; + + /** + * Get the type property: The type of restrictions. In this version, the only possible value for this is location. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the values property: The value of restrictions. If the restriction type is set to location, then this would + * be the different locations where the SKU is restricted. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Get the reasonCode property: The reason for the restriction. As of now this can be "QuotaId" or + * "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription + * does not belong to that quota. "NotAvailableForSubscription" is related to capacity at the datacenter. + * + * @return the reasonCode value. + */ + public ReasonCode reasonCode() { + return this.reasonCode; + } + + /** + * Set the reasonCode property: The reason for the restriction. As of now this can be "QuotaId" or + * "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription + * does not belong to that quota. "NotAvailableForSubscription" is related to capacity at the datacenter. + * + * @param reasonCode the reasonCode value to set. + * @return the Restriction object itself. + */ + public Restriction withReasonCode(ReasonCode reasonCode) { + this.reasonCode = reasonCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Skus.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Skus.java new file mode 100644 index 000000000000..b3fb376d9c75 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Skus.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.storagecache.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Skus. */ +public interface Skus { + /** + * Get the list of StorageCache.Cache SKUs available to this 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 list of StorageCache. + */ + PagedIterable list(); + + /** + * Get the list of StorageCache.Cache SKUs available to this 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 list of StorageCache. + */ + PagedIterable list(Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTarget.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTarget.java new file mode 100644 index 000000000000..f6dfb969248f --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTarget.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.storagecache.fluent.models.StorageTargetInner; +import java.util.List; + +/** An immutable client-side representation of StorageTarget. */ +public interface StorageTarget { + /** + * 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: Region name string. + * + * @return the location value. + */ + String location(); + + /** + * Gets the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the junctions property: List of Cache namespace junctions to target for namespace associations. + * + * @return the junctions value. + */ + List junctions(); + + /** + * Gets the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @return the provisioningState value. + */ + ProvisioningStateType provisioningState(); + + /** + * Gets the nfs3 property: Properties when targetType is nfs3. + * + * @return the nfs3 value. + */ + Nfs3Target nfs3(); + + /** + * Gets the clfs property: Properties when targetType is clfs. + * + * @return the clfs value. + */ + ClfsTarget clfs(); + + /** + * Gets the unknown property: Properties when targetType is unknown. + * + * @return the unknown value. + */ + UnknownTarget unknown(); + + /** + * 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.storagecache.fluent.models.StorageTargetInner object. + * + * @return the inner object. + */ + StorageTargetInner innerModel(); + + /** The entirety of the StorageTarget definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The StorageTarget definition stages. */ + interface DefinitionStages { + /** The first stage of the StorageTarget definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the StorageTarget definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, cacheName. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @return the next definition stage. + */ + WithCreate withExistingCache(String resourceGroupName, String cacheName); + } + /** + * The stage of the StorageTarget 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.WithJunctions, + DefinitionStages.WithProvisioningState, + DefinitionStages.WithNfs3, + DefinitionStages.WithClfs, + DefinitionStages.WithUnknown { + /** + * Executes the create request. + * + * @return the created resource. + */ + StorageTarget create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + StorageTarget create(Context context); + } + /** The stage of the StorageTarget definition allowing to specify junctions. */ + interface WithJunctions { + /** + * Specifies the junctions property: List of Cache namespace junctions to target for namespace + * associations.. + * + * @param junctions List of Cache namespace junctions to target for namespace associations. + * @return the next definition stage. + */ + WithCreate withJunctions(List junctions); + } + /** The stage of the StorageTarget definition allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @param provisioningState ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * @return the next definition stage. + */ + WithCreate withProvisioningState(ProvisioningStateType provisioningState); + } + /** The stage of the StorageTarget definition allowing to specify nfs3. */ + interface WithNfs3 { + /** + * Specifies the nfs3 property: Properties when targetType is nfs3.. + * + * @param nfs3 Properties when targetType is nfs3. + * @return the next definition stage. + */ + WithCreate withNfs3(Nfs3Target nfs3); + } + /** The stage of the StorageTarget definition allowing to specify clfs. */ + interface WithClfs { + /** + * Specifies the clfs property: Properties when targetType is clfs.. + * + * @param clfs Properties when targetType is clfs. + * @return the next definition stage. + */ + WithCreate withClfs(ClfsTarget clfs); + } + /** The stage of the StorageTarget definition allowing to specify unknown. */ + interface WithUnknown { + /** + * Specifies the unknown property: Properties when targetType is unknown.. + * + * @param unknown Properties when targetType is unknown. + * @return the next definition stage. + */ + WithCreate withUnknown(UnknownTarget unknown); + } + } + /** + * Begins update for the StorageTarget resource. + * + * @return the stage of resource update. + */ + StorageTarget.Update update(); + + /** The template for StorageTarget update. */ + interface Update + extends UpdateStages.WithJunctions, + UpdateStages.WithProvisioningState, + UpdateStages.WithNfs3, + UpdateStages.WithClfs, + UpdateStages.WithUnknown { + /** + * Executes the update request. + * + * @return the updated resource. + */ + StorageTarget apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + StorageTarget apply(Context context); + } + /** The StorageTarget update stages. */ + interface UpdateStages { + /** The stage of the StorageTarget update allowing to specify junctions. */ + interface WithJunctions { + /** + * Specifies the junctions property: List of Cache namespace junctions to target for namespace + * associations.. + * + * @param junctions List of Cache namespace junctions to target for namespace associations. + * @return the next definition stage. + */ + Update withJunctions(List junctions); + } + /** The stage of the StorageTarget update allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @param provisioningState ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * @return the next definition stage. + */ + Update withProvisioningState(ProvisioningStateType provisioningState); + } + /** The stage of the StorageTarget update allowing to specify nfs3. */ + interface WithNfs3 { + /** + * Specifies the nfs3 property: Properties when targetType is nfs3.. + * + * @param nfs3 Properties when targetType is nfs3. + * @return the next definition stage. + */ + Update withNfs3(Nfs3Target nfs3); + } + /** The stage of the StorageTarget update allowing to specify clfs. */ + interface WithClfs { + /** + * Specifies the clfs property: Properties when targetType is clfs.. + * + * @param clfs Properties when targetType is clfs. + * @return the next definition stage. + */ + Update withClfs(ClfsTarget clfs); + } + /** The stage of the StorageTarget update allowing to specify unknown. */ + interface WithUnknown { + /** + * Specifies the unknown property: Properties when targetType is unknown.. + * + * @param unknown Properties when targetType is unknown. + * @return the next definition stage. + */ + Update withUnknown(UnknownTarget unknown); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + StorageTarget refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + StorageTarget refresh(Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetProperties.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetProperties.java new file mode 100644 index 000000000000..039d8a571e29 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetProperties.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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 com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Properties of the Storage Target. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "targetType", + defaultImpl = StorageTargetProperties.class) +@JsonTypeName("StorageTargetProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "nfs3", value = Nfs3TargetProperties.class), + @JsonSubTypes.Type(name = "clfs", value = ClfsTargetProperties.class), + @JsonSubTypes.Type(name = "unknown", value = UnknownTargetProperties.class) +}) +@Fluent +public class StorageTargetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageTargetProperties.class); + + /* + * List of Cache namespace junctions to target for namespace associations. + */ + @JsonProperty(value = "junctions") + private List junctions; + + /* + * ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property + */ + @JsonProperty(value = "provisioningState") + private ProvisioningStateType provisioningState; + + /* + * Properties when targetType is nfs3. + */ + @JsonProperty(value = "nfs3") + private Nfs3Target nfs3; + + /* + * Properties when targetType is clfs. + */ + @JsonProperty(value = "clfs") + private ClfsTarget clfs; + + /* + * Properties when targetType is unknown. + */ + @JsonProperty(value = "unknown") + private UnknownTarget unknown; + + /** + * Get the junctions property: List of Cache namespace junctions to target for namespace associations. + * + * @return the junctions value. + */ + public List junctions() { + return this.junctions; + } + + /** + * Set the junctions property: List of Cache namespace junctions to target for namespace associations. + * + * @param junctions the junctions value to set. + * @return the StorageTargetProperties object itself. + */ + public StorageTargetProperties withJunctions(List junctions) { + this.junctions = junctions; + return this; + } + + /** + * Get the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @return the provisioningState value. + */ + public ProvisioningStateType provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * + * @param provisioningState the provisioningState value to set. + * @return the StorageTargetProperties object itself. + */ + public StorageTargetProperties withProvisioningState(ProvisioningStateType provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the nfs3 property: Properties when targetType is nfs3. + * + * @return the nfs3 value. + */ + public Nfs3Target nfs3() { + return this.nfs3; + } + + /** + * Set the nfs3 property: Properties when targetType is nfs3. + * + * @param nfs3 the nfs3 value to set. + * @return the StorageTargetProperties object itself. + */ + public StorageTargetProperties withNfs3(Nfs3Target nfs3) { + this.nfs3 = nfs3; + return this; + } + + /** + * Get the clfs property: Properties when targetType is clfs. + * + * @return the clfs value. + */ + public ClfsTarget clfs() { + return this.clfs; + } + + /** + * Set the clfs property: Properties when targetType is clfs. + * + * @param clfs the clfs value to set. + * @return the StorageTargetProperties object itself. + */ + public StorageTargetProperties withClfs(ClfsTarget clfs) { + this.clfs = clfs; + return this; + } + + /** + * Get the unknown property: Properties when targetType is unknown. + * + * @return the unknown value. + */ + public UnknownTarget unknown() { + return this.unknown; + } + + /** + * Set the unknown property: Properties when targetType is unknown. + * + * @param unknown the unknown value to set. + * @return the StorageTargetProperties object itself. + */ + public StorageTargetProperties withUnknown(UnknownTarget unknown) { + this.unknown = unknown; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (junctions() != null) { + junctions().forEach(e -> e.validate()); + } + if (nfs3() != null) { + nfs3().validate(); + } + if (clfs() != null) { + clfs().validate(); + } + if (unknown() != null) { + unknown().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetResource.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetResource.java new file mode 100644 index 000000000000..a401a278414f --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetResource.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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; + +/** Resource used by a Cache. */ +@Immutable +public class StorageTargetResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageTargetResource.class); + + /* + * Region name string. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The system meta data relating to this resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the location property: Region name string. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (systemData() != null) { + systemData().validate(); + } + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetType.java new file mode 100644 index 000000000000..1e9ee02ef0ef --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetType.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageTargetType. */ +public final class StorageTargetType extends ExpandableStringEnum { + /** Static value nfs3 for StorageTargetType. */ + public static final StorageTargetType NFS3 = fromString("nfs3"); + + /** Static value clfs for StorageTargetType. */ + public static final StorageTargetType CLFS = fromString("clfs"); + + /** Static value unknown for StorageTargetType. */ + public static final StorageTargetType UNKNOWN = fromString("unknown"); + + /** + * Creates or finds a StorageTargetType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageTargetType. + */ + @JsonCreator + public static StorageTargetType fromString(String name) { + return fromString(name, StorageTargetType.class); + } + + /** @return known StorageTargetType values. */ + public static Collection values() { + return values(StorageTargetType.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargets.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargets.java new file mode 100644 index 000000000000..921729f0e24c --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargets.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.storagecache.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 StorageTargets. */ +public interface StorageTargets { + /** + * Returns a list of Storage Targets for the specified Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Storage Targets. + */ + PagedIterable listByCache(String resourceGroupName, String cacheName); + + /** + * Returns a list of Storage Targets for the specified Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @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 Storage Targets. + */ + PagedIterable listByCache(String resourceGroupName, String cacheName, Context context); + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 any object. + */ + Object delete(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @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 any object. + */ + Object delete(String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Returns a Storage Target from a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 type of the Storage Target. + */ + StorageTarget get(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Returns a Storage Target from a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of the Storage Target. Length of name must not be greater than 80 and chars must be + * from the [-0-9a-zA-Z_] char class. + * @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 type of the Storage Target. + */ + Response getWithResponse( + String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Returns a Storage Target from a Cache. + * + * @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 type of the Storage Target. + */ + StorageTarget getById(String id); + + /** + * Returns a Storage Target from a Cache. + * + * @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 type of the Storage Target. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @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 any object. + */ + Object deleteById(String id); + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @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 any object. + */ + Object deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new StorageTarget resource. + * + * @param name resource name. + * @return the first stage of the new StorageTarget definition. + */ + StorageTarget.DefinitionStages.Blank define(String name); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetsResult.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetsResult.java new file mode 100644 index 000000000000..54a7d368d078 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetsResult.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.storagecache.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.fluent.models.StorageTargetInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Storage Targets. */ +@Fluent +public final class StorageTargetsResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageTargetsResult.class); + + /* + * The URI to fetch the next page of Storage Targets. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * The list of Storage Targets defined for the Cache. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the nextLink property: The URI to fetch the next page of Storage Targets. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of Storage Targets. + * + * @param nextLink the nextLink value to set. + * @return the StorageTargetsResult object itself. + */ + public StorageTargetsResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: The list of Storage Targets defined for the Cache. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Storage Targets defined for the Cache. + * + * @param value the value value to set. + * @return the StorageTargetsResult object itself. + */ + public StorageTargetsResult 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/SystemData.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/SystemData.java new file mode 100644 index 000000000000..f250a22d36f0 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/SystemData.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.storagecache.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; + +/** Metadata pertaining to creation and last modification of the resource. */ +@Fluent +public final class SystemData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SystemData.class); + + /* + * The identity that created the resource. + */ + @JsonProperty(value = "createdBy") + private String createdBy; + + /* + * The type of identity that created the resource. + */ + @JsonProperty(value = "createdByType") + private CreatedByType createdByType; + + /* + * The timestamp of resource creation (UTC). + */ + @JsonProperty(value = "createdAt") + private OffsetDateTime createdAt; + + /* + * The identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedBy") + private String lastModifiedBy; + + /* + * The type of identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedByType") + private CreatedByType lastModifiedByType; + + /* + * The type of identity that last modified the resource. + */ + @JsonProperty(value = "lastModifiedAt") + private OffsetDateTime lastModifiedAt; + + /** + * Get the createdBy property: The identity that created the resource. + * + * @return the createdBy value. + */ + public String createdBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: The identity that created the resource. + * + * @param createdBy the createdBy value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Get the createdByType property: The type of identity that created the resource. + * + * @return the createdByType value. + */ + public CreatedByType createdByType() { + return this.createdByType; + } + + /** + * Set the createdByType property: The type of identity that created the resource. + * + * @param createdByType the createdByType value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedByType(CreatedByType createdByType) { + this.createdByType = createdByType; + return this; + } + + /** + * Get the createdAt property: The timestamp of resource creation (UTC). + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: The timestamp of resource creation (UTC). + * + * @param createdAt the createdAt value to set. + * @return the SystemData object itself. + */ + public SystemData withCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the lastModifiedBy property: The identity that last modified the resource. + * + * @return the lastModifiedBy value. + */ + public String lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Set the lastModifiedBy property: The identity that last modified the resource. + * + * @param lastModifiedBy the lastModifiedBy value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * Get the lastModifiedByType property: The type of identity that last modified the resource. + * + * @return the lastModifiedByType value. + */ + public CreatedByType lastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Set the lastModifiedByType property: The type of identity that last modified the resource. + * + * @param lastModifiedByType the lastModifiedByType value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedByType(CreatedByType lastModifiedByType) { + this.lastModifiedByType = lastModifiedByType; + return this; + } + + /** + * Get the lastModifiedAt property: The type of identity that last modified the resource. + * + * @return the lastModifiedAt value. + */ + public OffsetDateTime lastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Set the lastModifiedAt property: The type of identity that last modified the resource. + * + * @param lastModifiedAt the lastModifiedAt value to set. + * @return the SystemData object itself. + */ + public SystemData withLastModifiedAt(OffsetDateTime lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UnknownTarget.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UnknownTarget.java new file mode 100644 index 000000000000..6817fc2132d0 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UnknownTarget.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.storagecache.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.Map; + +/** Properties pertaining to the UnknownTarget. */ +@Fluent +public final class UnknownTarget { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UnknownTarget.class); + + /* + * Dictionary of string->string pairs containing information about the + * Storage Target. + */ + @JsonProperty(value = "unknownMap") + private Map unknownMap; + + /** + * Get the unknownMap property: Dictionary of string->string pairs containing information about the Storage + * Target. + * + * @return the unknownMap value. + */ + public Map unknownMap() { + return this.unknownMap; + } + + /** + * Set the unknownMap property: Dictionary of string->string pairs containing information about the Storage + * Target. + * + * @param unknownMap the unknownMap value to set. + * @return the UnknownTarget object itself. + */ + public UnknownTarget withUnknownMap(Map unknownMap) { + this.unknownMap = unknownMap; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UnknownTargetProperties.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UnknownTargetProperties.java new file mode 100644 index 000000000000..c3ceb5a9911f --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UnknownTargetProperties.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.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.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Storage container for use as an Unknown Storage Target. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "targetType") +@JsonTypeName("unknown") +@Immutable +public final class UnknownTargetProperties extends StorageTargetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UnknownTargetProperties.class); + + /** {@inheritDoc} */ + @Override + public UnknownTargetProperties withJunctions(List junctions) { + super.withJunctions(junctions); + return this; + } + + /** {@inheritDoc} */ + @Override + public UnknownTargetProperties withProvisioningState(ProvisioningStateType provisioningState) { + super.withProvisioningState(provisioningState); + return this; + } + + /** {@inheritDoc} */ + @Override + public UnknownTargetProperties withNfs3(Nfs3Target nfs3) { + super.withNfs3(nfs3); + return this; + } + + /** {@inheritDoc} */ + @Override + public UnknownTargetProperties withClfs(ClfsTarget clfs) { + super.withClfs(clfs); + return this; + } + + /** {@inheritDoc} */ + @Override + public UnknownTargetProperties withUnknown(UnknownTarget unknown) { + super.withUnknown(unknown); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModel.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModel.java new file mode 100644 index 000000000000..884eba6665f9 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModel.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.models; + +import com.azure.resourcemanager.storagecache.fluent.models.UsageModelInner; + +/** An immutable client-side representation of UsageModel. */ +public interface UsageModel { + /** + * Gets the display property: Localized information describing this usage model. + * + * @return the display value. + */ + UsageModelDisplay display(); + + /** + * Gets the modelName property: Non-localized keyword name for this usage model. + * + * @return the modelName value. + */ + String modelName(); + + /** + * Gets the targetType property: The type of Storage Target to which this model is applicable (only nfs3 as of this + * version). + * + * @return the targetType value. + */ + String targetType(); + + /** + * Gets the inner com.azure.resourcemanager.storagecache.fluent.models.UsageModelInner object. + * + * @return the inner object. + */ + UsageModelInner innerModel(); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModelDisplay.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModelDisplay.java new file mode 100644 index 000000000000..758097daa170 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModelDisplay.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.storagecache.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; + +/** Localized information describing this usage model. */ +@Fluent +public final class UsageModelDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageModelDisplay.class); + + /* + * String to display for this usage model. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the description property: String to display for this usage model. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: String to display for this usage model. + * + * @param description the description value to set. + * @return the UsageModelDisplay object itself. + */ + public UsageModelDisplay 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModels.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModels.java new file mode 100644 index 000000000000..8b1d344762a4 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModels.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.storagecache.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of UsageModels. */ +public interface UsageModels { + /** + * Get the list of Cache Usage Models available to this 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 list of Cache Usage Models available to this subscription. + */ + PagedIterable list(); + + /** + * Get the list of Cache Usage Models available to this 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 list of Cache Usage Models available to this subscription. + */ + PagedIterable list(Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModelsResult.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModelsResult.java new file mode 100644 index 000000000000..927fe0671d4d --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsageModelsResult.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.storagecache.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.fluent.models.UsageModelInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Cache usage models. */ +@Fluent +public final class UsageModelsResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageModelsResult.class); + + /* + * The URI to fetch the next page of Cache usage models. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * The list of usage models available for the subscription. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the nextLink property: The URI to fetch the next page of Cache usage models. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of Cache usage models. + * + * @param nextLink the nextLink value to set. + * @return the UsageModelsResult object itself. + */ + public UsageModelsResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: The list of usage models available for the subscription. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of usage models available for the subscription. + * + * @param value the value value to set. + * @return the UsageModelsResult object itself. + */ + public UsageModelsResult 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsernameDownloadedType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsernameDownloadedType.java new file mode 100644 index 000000000000..ae0b22663664 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsernameDownloadedType.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UsernameDownloadedType. */ +public final class UsernameDownloadedType extends ExpandableStringEnum { + /** Static value Yes for UsernameDownloadedType. */ + public static final UsernameDownloadedType YES = fromString("Yes"); + + /** Static value No for UsernameDownloadedType. */ + public static final UsernameDownloadedType NO = fromString("No"); + + /** Static value Error for UsernameDownloadedType. */ + public static final UsernameDownloadedType ERROR = fromString("Error"); + + /** + * Creates or finds a UsernameDownloadedType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UsernameDownloadedType. + */ + @JsonCreator + public static UsernameDownloadedType fromString(String name) { + return fromString(name, UsernameDownloadedType.class); + } + + /** @return known UsernameDownloadedType values. */ + public static Collection values() { + return values(UsernameDownloadedType.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsernameSource.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsernameSource.java new file mode 100644 index 000000000000..9ea5aae9b441 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UsernameSource.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.storagecache.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UsernameSource. */ +public final class UsernameSource extends ExpandableStringEnum { + /** Static value AD for UsernameSource. */ + public static final UsernameSource AD = fromString("AD"); + + /** Static value LDAP for UsernameSource. */ + public static final UsernameSource LDAP = fromString("LDAP"); + + /** Static value File for UsernameSource. */ + public static final UsernameSource FILE = fromString("File"); + + /** Static value None for UsernameSource. */ + public static final UsernameSource NONE = fromString("None"); + + /** + * Creates or finds a UsernameSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding UsernameSource. + */ + @JsonCreator + public static UsernameSource fromString(String name) { + return fromString(name, UsernameSource.class); + } + + /** @return known UsernameSource values. */ + public static Collection values() { + return values(UsernameSource.class); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/package-info.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/package-info.java new file mode 100644 index 000000000000..763d8baa2ee2 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/package-info.java @@ -0,0 +1,10 @@ +// 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 StorageCacheManagementClient. A Storage Cache provides scalable caching + * service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). + * These operations allow you to manage Caches. + */ +package com.azure.resourcemanager.storagecache.models; diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/package-info.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/package-info.java new file mode 100644 index 000000000000..7f534d534287 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/package-info.java @@ -0,0 +1,10 @@ +// 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 StorageCacheManagementClient. A Storage Cache provides scalable caching service + * for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These + * operations allow you to manage Caches. + */ +package com.azure.resourcemanager.storagecache; diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/module-info.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/module-info.java new file mode 100644 index 000000000000..adc3f00a4247 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/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.storagecache { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.storagecache; + exports com.azure.resourcemanager.storagecache.fluent; + exports com.azure.resourcemanager.storagecache.fluent.models; + exports com.azure.resourcemanager.storagecache.models; + + opens com.azure.resourcemanager.storagecache.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.storagecache.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/storagecache/ci.yml b/sdk/storagecache/ci.yml new file mode 100644 index 000000000000..d324d05d7104 --- /dev/null +++ b/sdk/storagecache/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/storagecache/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagecache/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storagecache + Artifacts: + - name: azure-resourcemanager-storagecache + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerstoragecache diff --git a/sdk/storagecache/pom.xml b/sdk/storagecache/pom.xml new file mode 100644 index 000000000000..c5f03dffbd14 --- /dev/null +++ b/sdk/storagecache/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-storagecache-service + pom + 1.0.0 + + azure-resourcemanager-storagecache + +