From 8ca7e84e110f7fa1aa98a54bccebd454ee04a6c6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 9 Dec 2020 02:49:49 +0000 Subject: [PATCH] CodeGen from PR 11789 in Azure/azure-rest-api-specs Merge c1c9cab0a05723b84b0fa86504c45e491d19dcc0 into c8a4f57c9c792ed967bfd3f4d843cfa988c2d7e2 --- eng/versioning/external_dependencies.txt | 1 + eng/versioning/version_client.txt | 25 +- pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 84 + .../pom.xml | 62 + .../CognitiveServicesManager.java | 261 +++ .../fluent/AccountsClient.java | 311 +++ .../CognitiveServicesManagementClient.java | 88 + .../fluent/OperationsClient.java | 36 + .../PrivateEndpointConnectionsClient.java | 149 ++ .../fluent/PrivateLinkResourcesClient.java | 42 + .../fluent/ResourceProvidersClient.java | 71 + .../fluent/ResourceSkusClient.java | 36 + .../CheckDomainAvailabilityResultInner.java | 128 ++ .../CheckSkuAvailabilityResultListInner.java | 55 + ...rvicesAccountEnumerateSkusResultInner.java | 45 + .../models/CognitiveServicesAccountInner.java | 171 ++ .../CognitiveServicesAccountKeysInner.java | 76 + .../fluent/models/OperationEntityInner.java | 132 ++ .../PrivateEndpointConnectionInner.java | 55 + ...vateEndpointConnectionListResultInner.java | 54 + .../PrivateLinkResourceListResultInner.java | 55 + .../fluent/models/ResourceSkuInner.java | 121 + .../fluent/models/UsagesResultInner.java | 44 + .../fluent/models/package-info.java | 8 + .../fluent/package-info.java | 8 + .../implementation/AccountsClientImpl.java | 1993 +++++++++++++++++ .../implementation/AccountsImpl.java | 278 +++ .../CheckDomainAvailabilityResultImpl.java | 45 + .../CheckSkuAvailabilityResultListImpl.java | 41 + ...ervicesAccountEnumerateSkusResultImpl.java | 42 + .../CognitiveServicesAccountImpl.java | 206 ++ .../CognitiveServicesAccountKeysImpl.java | 37 + ...nitiveServicesManagementClientBuilder.java | 146 ++ ...CognitiveServicesManagementClientImpl.java | 363 +++ .../implementation/OperationEntityImpl.java | 45 + .../implementation/OperationsClientImpl.java | 269 +++ .../implementation/OperationsImpl.java | 46 + .../PrivateEndpointConnectionImpl.java | 142 ++ ...ivateEndpointConnectionListResultImpl.java | 48 + .../PrivateEndpointConnectionsClientImpl.java | 828 +++++++ .../PrivateEndpointConnectionsImpl.java | 225 ++ .../PrivateLinkResourceListResultImpl.java | 41 + .../PrivateLinkResourcesClientImpl.java | 222 ++ .../PrivateLinkResourcesImpl.java | 61 + .../ResourceProvidersClientImpl.java | 380 ++++ .../implementation/ResourceProvidersImpl.java | 90 + .../implementation/ResourceSkuImpl.java | 65 + .../ResourceSkusClientImpl.java | 294 +++ .../implementation/ResourceSkusImpl.java | 46 + .../implementation/UsagesResultImpl.java | 40 + .../implementation/Utils.java | 31 + .../implementation/package-info.java | 8 + .../cognitiveservices/models/Accounts.java | 271 +++ .../CheckDomainAvailabilityParameter.java | 88 + .../models/CheckDomainAvailabilityResult.java | 46 + .../models/CheckSkuAvailabilityParameter.java | 121 + .../models/CheckSkuAvailabilityResult.java | 180 ++ .../CheckSkuAvailabilityResultList.java | 26 + .../models/CognitiveServicesAccount.java | 317 +++ ...CognitiveServicesAccountApiProperties.java | 233 ++ ...iveServicesAccountEnumerateSkusResult.java | 27 + .../models/CognitiveServicesAccountKeys.java | 32 + .../CognitiveServicesAccountListResult.java | 70 + .../CognitiveServicesAccountProperties.java | 314 +++ .../CognitiveServicesResourceAndSku.java | 79 + .../cognitiveservices/models/Encryption.java | 79 + .../cognitiveservices/models/Identity.java | 124 + .../models/IdentityType.java | 50 + .../cognitiveservices/models/IpRule.java | 58 + .../cognitiveservices/models/KeyName.java | 47 + .../cognitiveservices/models/KeySource.java | 34 + .../models/KeyVaultProperties.java | 102 + .../cognitiveservices/models/MetricName.java | 54 + .../models/NetworkRuleAction.java | 34 + .../models/NetworkRuleSet.java | 113 + .../models/OperationDisplayInfo.java | 128 ++ .../models/OperationEntity.java | 45 + .../models/OperationEntityListResult.java | 81 + .../cognitiveservices/models/Operations.java | 31 + .../models/PrivateEndpoint.java | 39 + .../models/PrivateEndpointConnection.java | 149 ++ .../PrivateEndpointConnectionListResult.java | 26 + .../PrivateEndpointConnectionProperties.java | 119 + .../models/PrivateEndpointConnections.java | 149 ++ ...rivateEndpointServiceConnectionStatus.java | 41 + .../models/PrivateLinkResource.java | 54 + .../models/PrivateLinkResourceListResult.java | 26 + .../models/PrivateLinkResourceProperties.java | 96 + .../models/PrivateLinkResources.java | 37 + .../PrivateLinkServiceConnectionState.java | 108 + .../models/ProvisioningState.java | 46 + .../models/PublicNetworkAccess.java | 34 + .../models/QuotaUsageStatus.java | 40 + .../models/RegenerateKeyParameters.java | 55 + .../models/ResourceProviders.java | 61 + .../cognitiveservices/models/ResourceSku.java | 61 + .../models/ResourceSkuRestrictionInfo.java | 55 + .../models/ResourceSkuRestrictions.java | 90 + .../ResourceSkuRestrictionsReasonCode.java | 35 + .../models/ResourceSkuRestrictionsType.java | 47 + .../models/ResourceSkus.java | 31 + .../models/ResourceSkusResult.java | 85 + .../cognitiveservices/models/Sku.java | 70 + .../models/SkuCapability.java | 76 + .../cognitiveservices/models/SkuTier.java | 40 + .../cognitiveservices/models/UnitType.java | 49 + .../cognitiveservices/models/Usage.java | 143 ++ .../models/UsagesResult.java | 25 + .../models/UserAssignedIdentity.java | 76 + .../models/UserOwnedStorage.java | 50 + .../models/VirtualNetworkRule.java | 110 + .../models/package-info.java | 6 + .../cognitiveservices/package-info.java | 6 + .../src/main/java/module-info.java | 19 + sdk/cognitiveservices/ci.yml | 144 +- sdk/cognitiveservices/pom.xml | 1 + 118 files changed, 13157 insertions(+), 82 deletions(-) create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/CHANGELOG.md create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/README.md create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/pom.xml create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManager.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/AccountsClient.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/CognitiveServicesManagementClient.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/OperationsClient.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/PrivateEndpointConnectionsClient.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/PrivateLinkResourcesClient.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/ResourceProvidersClient.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/ResourceSkusClient.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CheckDomainAvailabilityResultInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CheckSkuAvailabilityResultListInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountEnumerateSkusResultInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountKeysInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/OperationEntityInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateEndpointConnectionInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateEndpointConnectionListResultInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateLinkResourceListResultInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/ResourceSkuInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/UsagesResultInner.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/package-info.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/package-info.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CheckDomainAvailabilityResultImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CheckSkuAvailabilityResultListImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountEnumerateSkusResultImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountKeysImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientBuilder.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/OperationEntityImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/OperationsClientImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/OperationsImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionListResultImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionsClientImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourceListResultImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourcesClientImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourcesImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceProvidersClientImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceProvidersImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkuImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkusClientImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkusImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/UsagesResultImpl.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/Utils.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/package-info.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Accounts.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckDomainAvailabilityParameter.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckDomainAvailabilityResult.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityParameter.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityResult.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityResultList.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccount.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountApiProperties.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountEnumerateSkusResult.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountKeys.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountListResult.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountProperties.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesResourceAndSku.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Encryption.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Identity.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/IdentityType.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/IpRule.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeyName.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeySource.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeyVaultProperties.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/MetricName.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/NetworkRuleAction.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/NetworkRuleSet.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationDisplayInfo.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationEntity.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationEntityListResult.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Operations.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpoint.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnection.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnectionListResult.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnectionProperties.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnections.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointServiceConnectionStatus.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResource.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResourceListResult.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResourceProperties.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResources.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkServiceConnectionState.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ProvisioningState.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PublicNetworkAccess.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/QuotaUsageStatus.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/RegenerateKeyParameters.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceProviders.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSku.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionInfo.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictions.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionsReasonCode.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionsType.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkus.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkusResult.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Sku.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/SkuCapability.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/SkuTier.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UnitType.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Usage.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UsagesResult.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UserAssignedIdentity.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UserOwnedStorage.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/VirtualNetworkRule.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/package-info.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/package-info.java create mode 100644 sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/module-info.java diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 62906a566feea..464bc9b7cf1a7 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -110,6 +110,7 @@ org.springframework.kafka:spring-kafka;2.5.7.RELEASE org.springframework.security:spring-security-config;5.3.5.RELEASE org.springframework.security:spring-security-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-client;5.3.5.RELEASE +org.springframework.security:spring-security-oauth2-resource-server;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-jose;5.3.5.RELEASE org.springframework.security:spring-security-web;5.3.5.RELEASE diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fa2e6238ee364..9ff023f060939 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -40,17 +40,22 @@ com.azure:azure-ai-anomalydetector;3.0.0-beta.1;3.0.0-beta.2 com.azure:azure-ai-formrecognizer;3.0.3;3.1.0-beta.2 com.azure:azure-ai-metricsadvisor;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-ai-textanalytics;5.0.1;5.1.0-beta.4 +com.azure:azure-analytics-synapse-accesscontrol;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-analytics-synapse-artifacts;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-analytics-synapse-spark;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-analytics-synapse-managedprivateendpoints;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-analytics-synapse-monitoring;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-communication-chat;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-common;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-administration;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-sms;1.0.0-beta.3;1.0.0-beta.4 -com.azure:azure-core;1.10.0;1.11.0 -com.azure:azure-core-amqp;1.6.0;1.7.0-beta.3 +com.azure:azure-core;1.11.0;1.12.0-beta.1 +com.azure:azure-core-amqp;2.0.0;2.1.0-beta.1 com.azure:azure-core-amqp-experimental;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-experimental;1.0.0-beta.8;1.0.0-beta.9 com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-core-http-netty;1.6.3;1.7.0 -com.azure:azure-core-http-okhttp;1.3.3;1.4.0 +com.azure:azure-core-http-netty;1.7.0;1.8.0-beta.1 +com.azure:azure-core-http-okhttp;1.4.0;1.5.0-beta.1 com.azure:azure-core-management;1.0.0;1.1.0-beta.1 com.azure:azure-core-serializer-avro-apache;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-core-serializer-avro-jackson;1.0.0-beta.1;1.0.0-beta.2 @@ -68,12 +73,12 @@ com.azure:azure-data-schemaregistry-avro;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-data-tables;12.0.0-beta.3;12.0.0-beta.4 com.azure:azure-digitaltwins-core;1.0.1;1.1.0-beta.1 com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-identity;1.2.0;1.3.0-beta.1 +com.azure:azure-identity;1.2.0;1.2.1 com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventgrid;2.0.0-beta.3;2.0.0-beta.4 com.azure:azure-messaging-eventhubs;5.3.1;5.4.0-beta.2 com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.3.1;1.4.0-beta.2 -com.azure:azure-messaging-servicebus;7.0.0-beta.7;7.0.0-beta.8 +com.azure:azure-messaging-servicebus;7.0.0;7.1.0-beta.1 com.azure:azure-messaging-servicebus-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track2-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-search-documents;11.1.2;11.2.0-beta.4 @@ -94,7 +99,7 @@ com.azure:azure-storage-blob-nio;12.0.0-beta.2;12.0.0-beta.3 com.azure:azure-storage-common;12.9.0;12.10.0-beta.1 com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.1 com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.1 -com.azure:azure-storage-internal-avro;12.0.1;12.1.0-beta.1 +com.azure:azure-storage-internal-avro;12.0.1;12.0.2-beta.1 com.azure:azure-storage-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-storage-queue;12.7.0;12.8.0-beta.1 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 @@ -168,6 +173,7 @@ com.azure.resourcemanager:azure-resourcemanager-sql;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-storage;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-trafficmanager;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-test;2.0.0-beta.1;2.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-cognitiveservices;1.0.0-beta.1;1.0.0-beta.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 @@ -176,9 +182,7 @@ com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-b # Format; # unreleased_:;dependency-version # note: The unreleased dependencies will not be manipulated with the automatic PR creation code. -unreleased_com.azure:azure-core;1.11.0 -unreleased_com.azure:azure-core-amqp;1.7.0-beta.3 -unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 +unreleased_com.azure:azure-messaging-servicebus;7.0.0 # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current # version and set the version to the released beta. Released beta dependencies are only valid @@ -188,4 +192,3 @@ unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 # beta_:;dependency-version # note: Released beta versions will not be manipulated with the automatic PR creation code. beta_com.azure:azure-security-keyvault-keys;4.3.0-beta.1 -beta_com.azure:azure-core-amqp;1.7.0-beta.2 diff --git a/pom.xml b/pom.xml index d97614e5dba32..85f448c1740a2 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ sdk/search sdk/servicebus sdk/storage + sdk/synapse sdk/tables sdk/template sdk/textanalytics diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/CHANGELOG.md b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/CHANGELOG.md new file mode 100644 index 0000000000000..3fcc068d355df --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-09) + +- Azure Resource Manager CognitiveServices client library for Java. This package contains Microsoft Azure SDK for CognitiveServices Management SDK. Cognitive Services Management Client. Package tag package-2017-04. 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/cognitiveservices/azure-resourcemanager-cognitiveservices/README.md b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/README.md new file mode 100644 index 0000000000000..edfb93ae24218 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/README.md @@ -0,0 +1,84 @@ +# Azure Resource Manager CognitiveServices client library for Java + +Azure Resource Manager CognitiveServices client library for Java. + +This package contains Microsoft Azure SDK for CognitiveServices Management SDK. Cognitive Services Management Client. Package tag package-2017-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +```xml + + com.azure.resourcemanager + azure-resourcemanager-cognitiveservices + 1.0.0-beta.1 + +``` + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-cognitiveservices;current}) +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +CognitiveServicesManager manager = CognitiveServicesManager + .authenticate(credential, profile); +``` +[//]: # ({x-version-update-end}) + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/pom.xml b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/pom.xml new file mode 100644 index 0000000000000..094fc8b845d4b --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/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-cognitiveservices + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for CognitiveServices Management + This package contains Microsoft Azure SDK for CognitiveServices Management SDK. Cognitive Services Management Client. Package tag package-2017-04. 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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManager.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManager.java new file mode 100644 index 0000000000000..041024eed1ed4 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManager.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices; + +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.cognitiveservices.fluent.CognitiveServicesManagementClient; +import com.azure.resourcemanager.cognitiveservices.implementation.AccountsImpl; +import com.azure.resourcemanager.cognitiveservices.implementation.CognitiveServicesManagementClientBuilder; +import com.azure.resourcemanager.cognitiveservices.implementation.OperationsImpl; +import com.azure.resourcemanager.cognitiveservices.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.cognitiveservices.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.cognitiveservices.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.cognitiveservices.implementation.ResourceSkusImpl; +import com.azure.resourcemanager.cognitiveservices.models.Accounts; +import com.azure.resourcemanager.cognitiveservices.models.Operations; +import com.azure.resourcemanager.cognitiveservices.models.PrivateEndpointConnections; +import com.azure.resourcemanager.cognitiveservices.models.PrivateLinkResources; +import com.azure.resourcemanager.cognitiveservices.models.ResourceProviders; +import com.azure.resourcemanager.cognitiveservices.models.ResourceSkus; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to CognitiveServicesManager. Cognitive Services Management Client. */ +public final class CognitiveServicesManager { + private Accounts accounts; + + private ResourceSkus resourceSkus; + + private Operations operations; + + private ResourceProviders resourceProviders; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinkResources privateLinkResources; + + private final CognitiveServicesManagementClient clientObject; + + private CognitiveServicesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new CognitiveServicesManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of CognitiveServices service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CognitiveServices service API instance. + */ + public static CognitiveServicesManager 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 CognitiveServicesManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CognitiveServicesManager.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 CognitiveServices service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CognitiveServices service API instance. + */ + public CognitiveServicesManager 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.cognitiveservices", + "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 CognitiveServicesManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Accounts. */ + public Accounts accounts() { + if (this.accounts == null) { + this.accounts = new AccountsImpl(clientObject.getAccounts(), this); + } + return accounts; + } + + /** @return Resource collection API of ResourceSkus. */ + public ResourceSkus resourceSkus() { + if (this.resourceSkus == null) { + this.resourceSkus = new ResourceSkusImpl(clientObject.getResourceSkus(), this); + } + return resourceSkus; + } + + /** @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 ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** @return Resource collection API of PrivateLinkResources. */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * @return Wrapped service client CognitiveServicesManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public CognitiveServicesManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/AccountsClient.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/AccountsClient.java new file mode 100644 index 0000000000000..41a855c3e2a5b --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/AccountsClient.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountEnumerateSkusResultInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountKeysInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.UsagesResultInner; +import com.azure.resourcemanager.cognitiveservices.models.RegenerateKeyParameters; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public interface AccountsClient { + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for + * developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CognitiveServicesAccountInner create( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account); + + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for + * developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @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 cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account, Context context); + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CognitiveServicesAccountInner update( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account); + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @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 cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account, Context context); + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName); + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CognitiveServicesAccountInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @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 cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CognitiveServicesAccountKeysInner listKeys(String resourceGroupName, String accountName); + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @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 access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param parameters Regenerate key parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CognitiveServicesAccountKeysInner regenerateKey( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters); + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param parameters Regenerate key parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response regenerateKeyWithResponse( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters, Context context); + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CognitiveServicesAccountEnumerateSkusResultInner listSkus(String resourceGroupName, String accountName); + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @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 cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listSkusWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return usages for the requested Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UsagesResultInner getUsages(String resourceGroupName, String accountName); + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @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 usages for the requested Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getUsagesWithResponse( + String resourceGroupName, String accountName, String filter, Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/CognitiveServicesManagementClient.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/CognitiveServicesManagementClient.java new file mode 100644 index 0000000000000..81f194732f833 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/CognitiveServicesManagementClient.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for CognitiveServicesManagementClient class. */ +public interface CognitiveServicesManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + AccountsClient getAccounts(); + + /** + * Gets the ResourceSkusClient object to access its operations. + * + * @return the ResourceSkusClient object. + */ + ResourceSkusClient getResourceSkus(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/OperationsClient.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/OperationsClient.java new file mode 100644 index 0000000000000..1ae02e9985ef2 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/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.cognitiveservices.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.cognitiveservices.fluent.models.OperationEntityInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all the available Cognitive Services account 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 the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the available Cognitive Services account 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 the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/PrivateEndpointConnectionsClient.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..5e4fd8e19ad94 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/PrivateEndpointConnectionsClient.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.cognitiveservices.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.cognitiveservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionListResultInner; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * Gets the private endpoint connections associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connections associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionListResultInner list(String resourceGroupName, String accountName); + + /** + * Gets the private endpoint connections associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @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 private endpoint connections associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Update the state of specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param properties The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties); + + /** + * Update the state of specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param properties The Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties, + Context context); + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/PrivateLinkResourcesClient.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..e1364b14dff00 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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.cognitiveservices.fluent.models.PrivateLinkResourceListResultInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources that need to be created for a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceListResultInner list(String resourceGroupName, String accountName); + + /** + * Gets the private link resources that need to be created for a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @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 private link resources that need to be created for a Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceGroupName, String accountName, Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/ResourceProvidersClient.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..0d39f5102047d --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/ResourceProvidersClient.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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.cognitiveservices.fluent.models.CheckDomainAvailabilityResultInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CheckSkuAvailabilityResultListInner; +import com.azure.resourcemanager.cognitiveservices.models.CheckDomainAvailabilityParameter; +import com.azure.resourcemanager.cognitiveservices.models.CheckSkuAvailabilityParameter; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Check available SKUs. + * + * @param location Resource location. + * @param parameters Check SKU availability parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check SKU availability result list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckSkuAvailabilityResultListInner checkSkuAvailability(String location, CheckSkuAvailabilityParameter parameters); + + /** + * Check available SKUs. + * + * @param location Resource location. + * @param parameters Check SKU availability parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check SKU availability result list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkSkuAvailabilityWithResponse( + String location, CheckSkuAvailabilityParameter parameters, Context context); + + /** + * Check whether a domain is available. + * + * @param parameters Check Domain availability parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check Domain availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckDomainAvailabilityResultInner checkDomainAvailability(CheckDomainAvailabilityParameter parameters); + + /** + * Check whether a domain is available. + * + * @param parameters Check Domain availability parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check Domain availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkDomainAvailabilityWithResponse( + CheckDomainAvailabilityParameter parameters, Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/ResourceSkusClient.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/ResourceSkusClient.java new file mode 100644 index 0000000000000..70907808fd37f --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/ResourceSkusClient.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.cognitiveservices.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.cognitiveservices.fluent.models.ResourceSkuInner; + +/** An instance of this class provides access to all the operations defined in ResourceSkusClient. */ +public interface ResourceSkusClient { + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your 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 Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your 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 Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CheckDomainAvailabilityResultInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CheckDomainAvailabilityResultInner.java new file mode 100644 index 0000000000000..72f25a9d04ef2 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CheckDomainAvailabilityResultInner.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.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Check Domain availability result. */ +@Fluent +public final class CheckDomainAvailabilityResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckDomainAvailabilityResultInner.class); + + /* + * Indicates the given SKU is available or not. + */ + @JsonProperty(value = "isSubdomainAvailable") + private Boolean isSubdomainAvailable; + + /* + * Reason why the SKU is not available. + */ + @JsonProperty(value = "reason") + private String reason; + + /* + * The subdomain name to use. + */ + @JsonProperty(value = "subdomainName") + private String subdomainName; + + /* + * The Type of the resource. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the isSubdomainAvailable property: Indicates the given SKU is available or not. + * + * @return the isSubdomainAvailable value. + */ + public Boolean isSubdomainAvailable() { + return this.isSubdomainAvailable; + } + + /** + * Set the isSubdomainAvailable property: Indicates the given SKU is available or not. + * + * @param isSubdomainAvailable the isSubdomainAvailable value to set. + * @return the CheckDomainAvailabilityResultInner object itself. + */ + public CheckDomainAvailabilityResultInner withIsSubdomainAvailable(Boolean isSubdomainAvailable) { + this.isSubdomainAvailable = isSubdomainAvailable; + return this; + } + + /** + * Get the reason property: Reason why the SKU is not available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Reason why the SKU is not available. + * + * @param reason the reason value to set. + * @return the CheckDomainAvailabilityResultInner object itself. + */ + public CheckDomainAvailabilityResultInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the subdomainName property: The subdomain name to use. + * + * @return the subdomainName value. + */ + public String subdomainName() { + return this.subdomainName; + } + + /** + * Set the subdomainName property: The subdomain name to use. + * + * @param subdomainName the subdomainName value to set. + * @return the CheckDomainAvailabilityResultInner object itself. + */ + public CheckDomainAvailabilityResultInner withSubdomainName(String subdomainName) { + this.subdomainName = subdomainName; + return this; + } + + /** + * Get the type property: The Type of the resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The Type of the resource. + * + * @param type the type value to set. + * @return the CheckDomainAvailabilityResultInner object itself. + */ + public CheckDomainAvailabilityResultInner withType(String 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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CheckSkuAvailabilityResultListInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CheckSkuAvailabilityResultListInner.java new file mode 100644 index 0000000000000..bc3bdff43dbc1 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CheckSkuAvailabilityResultListInner.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.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.models.CheckSkuAvailabilityResult; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Check SKU availability result list. */ +@Fluent +public final class CheckSkuAvailabilityResultListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckSkuAvailabilityResultListInner.class); + + /* + * Check SKU availability result list. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Check SKU availability result list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Check SKU availability result list. + * + * @param value the value value to set. + * @return the CheckSkuAvailabilityResultListInner object itself. + */ + public CheckSkuAvailabilityResultListInner 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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountEnumerateSkusResultInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountEnumerateSkusResultInner.java new file mode 100644 index 0000000000000..067889c979e08 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountEnumerateSkusResultInner.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesResourceAndSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of cognitive services accounts operation response. */ +@Immutable +public final class CognitiveServicesAccountEnumerateSkusResultInner { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(CognitiveServicesAccountEnumerateSkusResultInner.class); + + /* + * Gets the list of Cognitive Services accounts and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: Gets the list of Cognitive Services accounts and their properties. + * + * @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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountInner.java new file mode 100644 index 0000000000000..3bca3092f18b4 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountInner.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesAccountProperties; +import com.azure.resourcemanager.cognitiveservices.models.Identity; +import com.azure.resourcemanager.cognitiveservices.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Cognitive Services Account is an Azure resource representing the provisioned account, its type, location and SKU. */ +@Fluent +public final class CognitiveServicesAccountInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CognitiveServicesAccountInner.class); + + /* + * Entity Tag + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * The Kind of the resource. + */ + @JsonProperty(value = "kind") + private String kind; + + /* + * Properties of Cognitive Services account. + */ + @JsonProperty(value = "properties") + private CognitiveServicesAccountProperties properties; + + /* + * The SKU of Cognitive Services account. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * The identity of Cognitive Services account. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the etag property: Entity Tag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the kind property: The Kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: The Kind of the resource. + * + * @param kind the kind value to set. + * @return the CognitiveServicesAccountInner object itself. + */ + public CognitiveServicesAccountInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the properties property: Properties of Cognitive Services account. + * + * @return the properties value. + */ + public CognitiveServicesAccountProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of Cognitive Services account. + * + * @param properties the properties value to set. + * @return the CognitiveServicesAccountInner object itself. + */ + public CognitiveServicesAccountInner withProperties(CognitiveServicesAccountProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku property: The SKU of Cognitive Services account. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of Cognitive Services account. + * + * @param sku the sku value to set. + * @return the CognitiveServicesAccountInner object itself. + */ + public CognitiveServicesAccountInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the identity property: The identity of Cognitive Services account. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of Cognitive Services account. + * + * @param identity the identity value to set. + * @return the CognitiveServicesAccountInner object itself. + */ + public CognitiveServicesAccountInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public CognitiveServicesAccountInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CognitiveServicesAccountInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountKeysInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountKeysInner.java new file mode 100644 index 0000000000000..a29bacead009a --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/CognitiveServicesAccountKeysInner.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.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The access keys for the cognitive services account. */ +@Fluent +public final class CognitiveServicesAccountKeysInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CognitiveServicesAccountKeysInner.class); + + /* + * Gets the value of key 1. + */ + @JsonProperty(value = "key1") + private String key1; + + /* + * Gets the value of key 2. + */ + @JsonProperty(value = "key2") + private String key2; + + /** + * Get the key1 property: Gets the value of key 1. + * + * @return the key1 value. + */ + public String key1() { + return this.key1; + } + + /** + * Set the key1 property: Gets the value of key 1. + * + * @param key1 the key1 value to set. + * @return the CognitiveServicesAccountKeysInner object itself. + */ + public CognitiveServicesAccountKeysInner withKey1(String key1) { + this.key1 = key1; + return this; + } + + /** + * Get the key2 property: Gets the value of key 2. + * + * @return the key2 value. + */ + public String key2() { + return this.key2; + } + + /** + * Set the key2 property: Gets the value of key 2. + * + * @param key2 the key2 value to set. + * @return the CognitiveServicesAccountKeysInner object itself. + */ + public CognitiveServicesAccountKeysInner withKey2(String key2) { + this.key2 = key2; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/OperationEntityInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/OperationEntityInner.java new file mode 100644 index 0000000000000..fcbf05fdc5fe3 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/OperationEntityInner.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.models.OperationDisplayInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The operation supported by Cognitive Services. */ +@Fluent +public final class OperationEntityInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationEntityInner.class); + + /* + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The operation supported by Cognitive Services. + */ + @JsonProperty(value = "display") + private OperationDisplayInfo display; + + /* + * The origin of the operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * Additional properties. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * 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 OperationEntityInner object itself. + */ + public OperationEntityInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The operation supported by Cognitive Services. + * + * @return the display value. + */ + public OperationDisplayInfo display() { + return this.display; + } + + /** + * Set the display property: The operation supported by Cognitive Services. + * + * @param display the display value to set. + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withDisplay(OperationDisplayInfo display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: The origin of the operation. + * + * @param origin the origin value to set. + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties property: Additional properties. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Additional properties. + * + * @param properties the properties value to set. + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withProperties(Object properties) { + this.properties = properties; + 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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateEndpointConnectionInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..b549d118af2c2 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateEndpointConnectionInner.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.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.models.PrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Private Endpoint Connection resource. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties properties; + + /** + * Get the properties property: Resource properties. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Resource properties. + * + * @param properties the properties value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateEndpointConnectionListResultInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateEndpointConnectionListResultInner.java new file mode 100644 index 0000000000000..cc520ba18b450 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateEndpointConnectionListResultInner.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.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Fluent +public final class PrivateEndpointConnectionListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionListResultInner.class); + + /* + * Array of private endpoint connections + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Array of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private endpoint connections. + * + * @param value the value value to set. + * @return the PrivateEndpointConnectionListResultInner object itself. + */ + public PrivateEndpointConnectionListResultInner 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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateLinkResourceListResultInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateLinkResourceListResultInner.java new file mode 100644 index 0000000000000..b37eb70f003fa --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/PrivateLinkResourceListResultInner.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.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.models.PrivateLinkResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Fluent +public final class PrivateLinkResourceListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceListResultInner.class); + + /* + * Array of private link resources + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Array of private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private link resources. + * + * @param value the value value to set. + * @return the PrivateLinkResourceListResultInner object itself. + */ + public PrivateLinkResourceListResultInner 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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/ResourceSkuInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/ResourceSkuInner.java new file mode 100644 index 0000000000000..76188648701a3 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/ResourceSkuInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.models.ResourceSkuRestrictions; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes an available Cognitive Services SKU. */ +@Immutable +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; + + /* + * The name of SKU. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Specifies the tier of Cognitive Services account. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private String tier; + + /* + * The Kind of resources that are supported in this SKU. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * The set of locations that the SKU is available. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /* + * The restrictions because of which SKU cannot be used. This is empty if + * there are no restrictions. + */ + @JsonProperty(value = "restrictions", access = JsonProperty.Access.WRITE_ONLY) + 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 name property: The name of SKU. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the tier property: Specifies the tier of Cognitive Services account. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Get the kind property: The Kind of resources that are supported in this SKU. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the locations property: The set of locations that the SKU is available. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Get the restrictions property: The restrictions because of which SKU cannot be used. This is empty if there are + * no restrictions. + * + * @return the restrictions value. + */ + public List restrictions() { + return this.restrictions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restrictions() != null) { + restrictions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/UsagesResultInner.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/UsagesResultInner.java new file mode 100644 index 0000000000000..497c37be43364 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/UsagesResultInner.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.models.Usage; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list usage request. */ +@Immutable +public final class UsagesResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsagesResultInner.class); + + /* + * The list of usages for Cognitive Service account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of usages for Cognitive Service account. + * + * @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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/package-info.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/package-info.java new file mode 100644 index 0000000000000..35be0f5737e03 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/models/package-info.java @@ -0,0 +1,8 @@ +// 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 CognitiveServicesManagementClient. Cognitive Services Management Client. + */ +package com.azure.resourcemanager.cognitiveservices.fluent.models; diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/package-info.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/package-info.java new file mode 100644 index 0000000000000..d059ae857ba55 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/package-info.java @@ -0,0 +1,8 @@ +// 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 CognitiveServicesManagementClient. Cognitive Services Management Client. + */ +package com.azure.resourcemanager.cognitiveservices.fluent; diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java new file mode 100644 index 0000000000000..d48a4828dcc36 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java @@ -0,0 +1,1993 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.fluent.AccountsClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountEnumerateSkusResultInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountKeysInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.UsagesResultInner; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesAccountListResult; +import com.azure.resourcemanager.cognitiveservices.models.RegenerateKeyParameters; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public final class AccountsClientImpl implements AccountsClient { + private final ClientLogger logger = new ClientLogger(AccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AccountsService service; + + /** The service client containing this operation class. */ + private final CognitiveServicesManagementClientImpl client; + + /** + * Initializes an instance of AccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccountsClientImpl(CognitiveServicesManagementClientImpl client) { + this.service = RestProxy.create(AccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CognitiveServicesManagementClientAccounts to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CognitiveServicesMan") + private interface AccountsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices" + + "/accounts/{accountName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CognitiveServicesAccountInner account, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices" + + "/accounts/{accountName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CognitiveServicesAccountInner account, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices" + + "/accounts/{accountName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @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.CognitiveServices" + + "/accounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @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.CognitiveServices" + + "/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts") + @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"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices" + + "/accounts/{accountName}/listKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listKeys( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices" + + "/accounts/{accountName}/regenerateKey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> regenerateKey( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") RegenerateKeyParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices" + + "/accounts/{accountName}/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSkus( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @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.CognitiveServices" + + "/accounts/{accountName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getUsages( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for + * developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (account == null) { + return Mono.error(new IllegalArgumentException("Parameter account is required and cannot be null.")); + } else { + account.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + account, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for + * developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (account == null) { + return Mono.error(new IllegalArgumentException("Parameter account is required and cannot be null.")); + } else { + account.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + account, + accept, + context); + } + + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for + * developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { + return createWithResponseAsync(resourceGroupName, accountName, account) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for + * developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CognitiveServicesAccountInner create( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { + return createAsync(resourceGroupName, accountName, account).block(); + } + + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for + * developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account, Context context) { + return createWithResponseAsync(resourceGroupName, accountName, account, context).block(); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (account == null) { + return Mono.error(new IllegalArgumentException("Parameter account is required and cannot be null.")); + } else { + account.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + account, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (account == null) { + return Mono.error(new IllegalArgumentException("Parameter account is required and cannot be null.")); + } else { + account.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + account, + accept, + context); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { + return updateWithResponseAsync(resourceGroupName, accountName, account) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CognitiveServicesAccountInner update( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account) { + return updateAsync(resourceGroupName, accountName, account).block(); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param account Cognitive Services Account is an Azure resource representing the provisioned account, its type, + * location and SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String accountName, CognitiveServicesAccountInner account, Context context) { + return updateWithResponseAsync(resourceGroupName, accountName, account, context).block(); + } + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName) { + return deleteWithResponseAsync(resourceGroupName, accountName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName) { + deleteAsync(resourceGroupName, accountName).block(); + } + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String accountName, Context context) { + return deleteWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CognitiveServicesAccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupAsync(resourceGroupName, accountName).block(); + } + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @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.getSubscriptionId(), + 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()))); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @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.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @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 the resources of a particular type belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @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 the resources of a particular type belonging to a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync( + String resourceGroupName, String accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 + .listKeys( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync( + String resourceGroupName, String accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 + .listKeys( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listKeysAsync(String resourceGroupName, String accountName) { + return listKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CognitiveServicesAccountKeysInner listKeys(String resourceGroupName, String accountName) { + return listKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return listKeysWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param parameters Regenerate key parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeyWithResponseAsync( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .regenerateKey( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param parameters Regenerate key parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeyWithResponseAsync( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .regenerateKey( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param parameters Regenerate key parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyAsync( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters) { + return regenerateKeyWithResponseAsync(resourceGroupName, accountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param parameters Regenerate key parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CognitiveServicesAccountKeysInner regenerateKey( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters) { + return regenerateKeyAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param parameters Regenerate key parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response regenerateKeyWithResponse( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters, Context context) { + return regenerateKeyWithResponseAsync(resourceGroupName, accountName, parameters, context).block(); + } + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusWithResponseAsync( + String resourceGroupName, String accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 + .listSkus( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusWithResponseAsync( + String resourceGroupName, String accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 + .listSkus( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listSkusAsync( + String resourceGroupName, String accountName) { + return listSkusWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CognitiveServicesAccountEnumerateSkusResultInner listSkus(String resourceGroupName, String accountName) { + return listSkusAsync(resourceGroupName, accountName).block(); + } + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listSkusWithResponse( + String resourceGroupName, String accountName, Context context) { + return listSkusWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return usages for the requested Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUsagesWithResponseAsync( + String resourceGroupName, String accountName, String filter) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 + .getUsages( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + filter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return usages for the requested Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getUsagesWithResponseAsync( + String resourceGroupName, String accountName, String filter, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 + .getUsages( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + filter, + accept, + context); + } + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return usages for the requested Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getUsagesAsync(String resourceGroupName, String accountName, String filter) { + return getUsagesWithResponseAsync(resourceGroupName, accountName, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return usages for the requested Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getUsagesAsync(String resourceGroupName, String accountName) { + final String filter = null; + return getUsagesWithResponseAsync(resourceGroupName, accountName, filter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return usages for the requested Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UsagesResultInner getUsages(String resourceGroupName, String accountName) { + final String filter = null; + return getUsagesAsync(resourceGroupName, accountName, filter).block(); + } + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return usages for the requested Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUsagesWithResponse( + String resourceGroupName, String accountName, String filter, Context context) { + return getUsagesWithResponseAsync(resourceGroupName, accountName, filter, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsImpl.java new file mode 100644 index 0000000000000..8e84ab6828915 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsImpl.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.AccountsClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountEnumerateSkusResultInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountKeysInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.UsagesResultInner; +import com.azure.resourcemanager.cognitiveservices.models.Accounts; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesAccount; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesAccountEnumerateSkusResult; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesAccountKeys; +import com.azure.resourcemanager.cognitiveservices.models.RegenerateKeyParameters; +import com.azure.resourcemanager.cognitiveservices.models.UsagesResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AccountsImpl implements Accounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountsImpl.class); + + private final AccountsClient innerClient; + + private final CognitiveServicesManager serviceManager; + + public AccountsImpl(AccountsClient innerClient, CognitiveServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String accountName) { + this.serviceClient().delete(resourceGroupName, accountName); + } + + public Response deleteWithResponse(String resourceGroupName, String accountName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, accountName, context); + } + + public CognitiveServicesAccount getByResourceGroup(String resourceGroupName, String accountName) { + CognitiveServicesAccountInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, accountName); + if (inner != null) { + return new CognitiveServicesAccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CognitiveServicesAccountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new CognitiveServicesAccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new CognitiveServicesAccountImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new CognitiveServicesAccountImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new CognitiveServicesAccountImpl(inner1, this.manager())); + } + + public CognitiveServicesAccountKeys listKeys(String resourceGroupName, String accountName) { + CognitiveServicesAccountKeysInner inner = this.serviceClient().listKeys(resourceGroupName, accountName); + if (inner != null) { + return new CognitiveServicesAccountKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listKeysWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CognitiveServicesAccountKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CognitiveServicesAccountKeys regenerateKey( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters) { + CognitiveServicesAccountKeysInner inner = + this.serviceClient().regenerateKey(resourceGroupName, accountName, parameters); + if (inner != null) { + return new CognitiveServicesAccountKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response regenerateKeyWithResponse( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters, Context context) { + Response inner = + this.serviceClient().regenerateKeyWithResponse(resourceGroupName, accountName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CognitiveServicesAccountKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CognitiveServicesAccountEnumerateSkusResult listSkus(String resourceGroupName, String accountName) { + CognitiveServicesAccountEnumerateSkusResultInner inner = + this.serviceClient().listSkus(resourceGroupName, accountName); + if (inner != null) { + return new CognitiveServicesAccountEnumerateSkusResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listSkusWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listSkusWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CognitiveServicesAccountEnumerateSkusResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public UsagesResult getUsages(String resourceGroupName, String accountName) { + UsagesResultInner inner = this.serviceClient().getUsages(resourceGroupName, accountName); + if (inner != null) { + return new UsagesResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getUsagesWithResponse( + String resourceGroupName, String accountName, String filter, Context context) { + Response inner = + this.serviceClient().getUsagesWithResponse(resourceGroupName, accountName, filter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new UsagesResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CognitiveServicesAccount 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 accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, 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 accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.deleteWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.deleteWithResponse(resourceGroupName, accountName, context); + } + + private AccountsClient serviceClient() { + return this.innerClient; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } + + public CognitiveServicesAccountImpl define(String name) { + return new CognitiveServicesAccountImpl(name, this.manager()); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CheckDomainAvailabilityResultImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CheckDomainAvailabilityResultImpl.java new file mode 100644 index 0000000000000..3ee721c49c6da --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CheckDomainAvailabilityResultImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.implementation; + +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CheckDomainAvailabilityResultInner; +import com.azure.resourcemanager.cognitiveservices.models.CheckDomainAvailabilityResult; + +public final class CheckDomainAvailabilityResultImpl implements CheckDomainAvailabilityResult { + private CheckDomainAvailabilityResultInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public CheckDomainAvailabilityResultImpl( + CheckDomainAvailabilityResultInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean isSubdomainAvailable() { + return this.innerModel().isSubdomainAvailable(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public String subdomainName() { + return this.innerModel().subdomainName(); + } + + public String type() { + return this.innerModel().type(); + } + + public CheckDomainAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CheckSkuAvailabilityResultListImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CheckSkuAvailabilityResultListImpl.java new file mode 100644 index 0000000000000..6ed0a2a063664 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CheckSkuAvailabilityResultListImpl.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.cognitiveservices.implementation; + +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CheckSkuAvailabilityResultListInner; +import com.azure.resourcemanager.cognitiveservices.models.CheckSkuAvailabilityResult; +import com.azure.resourcemanager.cognitiveservices.models.CheckSkuAvailabilityResultList; +import java.util.Collections; +import java.util.List; + +public final class CheckSkuAvailabilityResultListImpl implements CheckSkuAvailabilityResultList { + private CheckSkuAvailabilityResultListInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public CheckSkuAvailabilityResultListImpl( + CheckSkuAvailabilityResultListInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CheckSkuAvailabilityResultListInner innerModel() { + return this.innerObject; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountEnumerateSkusResultImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountEnumerateSkusResultImpl.java new file mode 100644 index 0000000000000..15b10bbe83475 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountEnumerateSkusResultImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.implementation; + +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountEnumerateSkusResultInner; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesAccountEnumerateSkusResult; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesResourceAndSku; +import java.util.Collections; +import java.util.List; + +public final class CognitiveServicesAccountEnumerateSkusResultImpl + implements CognitiveServicesAccountEnumerateSkusResult { + private CognitiveServicesAccountEnumerateSkusResultInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public CognitiveServicesAccountEnumerateSkusResultImpl( + CognitiveServicesAccountEnumerateSkusResultInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CognitiveServicesAccountEnumerateSkusResultInner innerModel() { + return this.innerObject; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountImpl.java new file mode 100644 index 0000000000000..b36905c7bd93d --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountInner; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesAccount; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesAccountProperties; +import com.azure.resourcemanager.cognitiveservices.models.Identity; +import com.azure.resourcemanager.cognitiveservices.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class CognitiveServicesAccountImpl + implements CognitiveServicesAccount, CognitiveServicesAccount.Definition, CognitiveServicesAccount.Update { + private CognitiveServicesAccountInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public CognitiveServicesAccountProperties properties() { + return this.innerModel().properties(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CognitiveServicesAccountInner innerModel() { + return this.innerObject; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + public CognitiveServicesAccountImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CognitiveServicesAccount create() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .createWithResponse(resourceGroupName, accountName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public CognitiveServicesAccount create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .createWithResponse(resourceGroupName, accountName, this.innerModel(), context) + .getValue(); + return this; + } + + public CognitiveServicesAccountImpl(String name, CognitiveServicesManager serviceManager) { + this.innerObject = new CognitiveServicesAccountInner(); + this.serviceManager = serviceManager; + this.accountName = name; + } + + public CognitiveServicesAccountImpl update() { + return this; + } + + public CognitiveServicesAccount apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .updateWithResponse(resourceGroupName, accountName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public CognitiveServicesAccount apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .updateWithResponse(resourceGroupName, accountName, this.innerModel(), context) + .getValue(); + return this; + } + + public CognitiveServicesAccountImpl( + CognitiveServicesAccountInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "accounts"); + } + + public CognitiveServicesAccount refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public CognitiveServicesAccount refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public CognitiveServicesAccountImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CognitiveServicesAccountImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CognitiveServicesAccountImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public CognitiveServicesAccountImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public CognitiveServicesAccountImpl withProperties(CognitiveServicesAccountProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public CognitiveServicesAccountImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public CognitiveServicesAccountImpl withIdentity(Identity identity) { + this.innerModel().withIdentity(identity); + return this; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountKeysImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountKeysImpl.java new file mode 100644 index 0000000000000..f43469b82ce11 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesAccountKeysImpl.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.cognitiveservices.implementation; + +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountKeysInner; +import com.azure.resourcemanager.cognitiveservices.models.CognitiveServicesAccountKeys; + +public final class CognitiveServicesAccountKeysImpl implements CognitiveServicesAccountKeys { + private CognitiveServicesAccountKeysInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public CognitiveServicesAccountKeysImpl( + CognitiveServicesAccountKeysInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String key1() { + return this.innerModel().key1(); + } + + public String key2() { + return this.innerModel().key2(); + } + + public CognitiveServicesAccountKeysInner innerModel() { + return this.innerObject; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientBuilder.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientBuilder.java new file mode 100644 index 0000000000000..997e15cc65a1a --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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 CognitiveServicesManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {CognitiveServicesManagementClientImpl.class}) +public final class CognitiveServicesManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the CognitiveServicesManagementClientBuilder. + */ + public CognitiveServicesManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the CognitiveServicesManagementClientBuilder. + */ + public CognitiveServicesManagementClientBuilder 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 CognitiveServicesManagementClientBuilder. + */ + public CognitiveServicesManagementClientBuilder 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 CognitiveServicesManagementClientBuilder. + */ + public CognitiveServicesManagementClientBuilder 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 CognitiveServicesManagementClientBuilder. + */ + public CognitiveServicesManagementClientBuilder 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 CognitiveServicesManagementClientBuilder. + */ + public CognitiveServicesManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CognitiveServicesManagementClientImpl with the provided parameters. + * + * @return an instance of CognitiveServicesManagementClientImpl. + */ + public CognitiveServicesManagementClientImpl 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(); + } + CognitiveServicesManagementClientImpl client = + new CognitiveServicesManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java new file mode 100644 index 0000000000000..57189eb258246 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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.cognitiveservices.fluent.AccountsClient; +import com.azure.resourcemanager.cognitiveservices.fluent.CognitiveServicesManagementClient; +import com.azure.resourcemanager.cognitiveservices.fluent.OperationsClient; +import com.azure.resourcemanager.cognitiveservices.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.cognitiveservices.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.cognitiveservices.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.cognitiveservices.fluent.ResourceSkusClient; +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 CognitiveServicesManagementClientImpl type. */ +@ServiceClient(builder = CognitiveServicesManagementClientBuilder.class) +public final class CognitiveServicesManagementClientImpl implements CognitiveServicesManagementClient { + private final ClientLogger logger = new ClientLogger(CognitiveServicesManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The AccountsClient object to access its operations. */ + private final AccountsClient accounts; + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + public AccountsClient getAccounts() { + return this.accounts; + } + + /** The ResourceSkusClient object to access its operations. */ + private final ResourceSkusClient resourceSkus; + + /** + * Gets the ResourceSkusClient object to access its operations. + * + * @return the ResourceSkusClient object. + */ + public ResourceSkusClient getResourceSkus() { + return this.resourceSkus; + } + + /** 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 ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The PrivateEndpointConnectionsClient object to access its operations. */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** The PrivateLinkResourcesClient object to access its operations. */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** + * Initializes an instance of CognitiveServicesManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + CognitiveServicesManagementClientImpl( + 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 = "2017-04-18"; + this.accounts = new AccountsClientImpl(this); + this.resourceSkus = new ResourceSkusClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/OperationEntityImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/OperationEntityImpl.java new file mode 100644 index 0000000000000..008610acac67d --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/OperationEntityImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.implementation; + +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.OperationEntityInner; +import com.azure.resourcemanager.cognitiveservices.models.OperationDisplayInfo; +import com.azure.resourcemanager.cognitiveservices.models.OperationEntity; + +public final class OperationEntityImpl implements OperationEntity { + private OperationEntityInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public OperationEntityImpl(OperationEntityInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplayInfo display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public OperationEntityInner innerModel() { + return this.innerObject; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/OperationsClientImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..caaa155bb2b71 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/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.cognitiveservices.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.cognitiveservices.fluent.OperationsClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.OperationEntityInner; +import com.azure.resourcemanager.cognitiveservices.models.OperationEntityListResult; +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 CognitiveServicesManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(CognitiveServicesManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CognitiveServicesManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CognitiveServicesMan") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.CognitiveServices/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 the available Cognitive Services account 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 the list of cognitive services accounts operation response. + */ + @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 the available Cognitive Services account 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 the list of cognitive services accounts operation response. + */ + @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 the available Cognitive Services account 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 the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the available Cognitive Services account 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 the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the available Cognitive Services account 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 the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the available Cognitive Services account 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 the list of cognitive services accounts operation response. + */ + @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 list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/OperationsImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..d121feb4e9373 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/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.cognitiveservices.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.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.OperationsClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.OperationEntityInner; +import com.azure.resourcemanager.cognitiveservices.models.OperationEntity; +import com.azure.resourcemanager.cognitiveservices.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 CognitiveServicesManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, CognitiveServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new OperationEntityImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new OperationEntityImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..e7b54f193a9e5 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cognitiveservices.models.PrivateEndpointConnection; +import com.azure.resourcemanager.cognitiveservices.models.PrivateEndpointConnectionProperties; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointConnectionProperties properties() { + return this.innerModel().properties(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl(String name, CognitiveServicesManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse( + resourceGroupName, accountName, privateEndpointConnectionName, this.innerModel(), context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "accounts"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withProperties(PrivateEndpointConnectionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionListResultImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionListResultImpl.java new file mode 100644 index 0000000000000..b201e80fc215f --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionListResultImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.implementation; + +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionListResultInner; +import com.azure.resourcemanager.cognitiveservices.models.PrivateEndpointConnection; +import com.azure.resourcemanager.cognitiveservices.models.PrivateEndpointConnectionListResult; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class PrivateEndpointConnectionListResultImpl implements PrivateEndpointConnectionListResult { + private PrivateEndpointConnectionListResultInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public PrivateEndpointConnectionListResultImpl( + PrivateEndpointConnectionListResultInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public PrivateEndpointConnectionListResultInner innerModel() { + return this.innerObject; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..4fc30b0aad71a --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,828 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionListResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final CognitiveServicesManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(CognitiveServicesManagementClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CognitiveServicesManagementClientPrivateEndpointConnections to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CognitiveServicesMan") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices" + + "/accounts/{accountName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @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.CognitiveServices" + + "/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices" + + "/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices" + + "/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private endpoint connections associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connections associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the private endpoint connections associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connections associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the private endpoint connections associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connections associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String accountName) { + return listWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the private endpoint connections associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connections associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionListResultInner list(String resourceGroupName, String accountName) { + return listAsync(resourceGroupName, accountName).block(); + } + + /** + * Gets the private endpoint connections associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connections associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String accountName, Context context) { + return listWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + accept, + context); + } + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, accountName, privateEndpointConnectionName).block(); + } + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, context).block(); + } + + /** + * Update the state of specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param properties The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + properties, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update the state of specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param properties The Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties, + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + properties, + accept, + context); + } + + /** + * Update the state of specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param properties The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties) { + return createOrUpdateWithResponseAsync( + resourceGroupName, accountName, privateEndpointConnectionName, properties) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update the state of specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param properties The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties) { + return createOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, properties).block(); + } + + /** + * Update the state of specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param properties The Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, accountName, privateEndpointConnectionName, properties, context) + .block(); + } + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String accountName, String privateEndpointConnectionName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + accept, + context); + } + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return deleteWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, accountName, privateEndpointConnectionName).block(); + } + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, context).block(); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionsImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..14b06e1a85754 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionListResultInner; +import com.azure.resourcemanager.cognitiveservices.models.PrivateEndpointConnection; +import com.azure.resourcemanager.cognitiveservices.models.PrivateEndpointConnectionListResult; +import com.azure.resourcemanager.cognitiveservices.models.PrivateEndpointConnections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final CognitiveServicesManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, CognitiveServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PrivateEndpointConnectionListResult list(String resourceGroupName, String accountName) { + PrivateEndpointConnectionListResultInner inner = this.serviceClient().list(resourceGroupName, accountName); + if (inner != null) { + return new PrivateEndpointConnectionListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection get( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, accountName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, accountName, privateEndpointConnectionName); + } + + public Response deleteWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + public PrivateEndpointConnection 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 accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, 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 accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.deleteWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, accountName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourceListResultImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourceListResultImpl.java new file mode 100644 index 0000000000000..1e53c801bd3b1 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourceListResultImpl.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.cognitiveservices.implementation; + +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateLinkResourceListResultInner; +import com.azure.resourcemanager.cognitiveservices.models.PrivateLinkResource; +import com.azure.resourcemanager.cognitiveservices.models.PrivateLinkResourceListResult; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceListResultImpl implements PrivateLinkResourceListResult { + private PrivateLinkResourceListResultInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public PrivateLinkResourceListResultImpl( + PrivateLinkResourceListResultInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourceListResultInner innerModel() { + return this.innerObject; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourcesClientImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..c39d1492aa919 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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.cognitiveservices.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateLinkResourceListResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final CognitiveServicesManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(CognitiveServicesManagementClientImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CognitiveServicesManagementClientPrivateLinkResources to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CognitiveServicesMan") + private interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices" + + "/accounts/{accountName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources that need to be created for a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String accountName) { + 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the private link resources that need to be created for a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String accountName, 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 (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the private link resources that need to be created for a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String accountName) { + return listWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the private link resources that need to be created for a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceListResultInner list(String resourceGroupName, String accountName) { + return listAsync(resourceGroupName, accountName).block(); + } + + /** + * Gets the private link resources that need to be created for a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cognitive Services account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String accountName, Context context) { + return listWithResponseAsync(resourceGroupName, accountName, context).block(); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourcesImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..5b0dfc96613c6 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateLinkResourceListResultInner; +import com.azure.resourcemanager.cognitiveservices.models.PrivateLinkResourceListResult; +import com.azure.resourcemanager.cognitiveservices.models.PrivateLinkResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final CognitiveServicesManager serviceManager; + + public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, CognitiveServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PrivateLinkResourceListResult list(String resourceGroupName, String accountName) { + PrivateLinkResourceListResultInner inner = this.serviceClient().list(resourceGroupName, accountName); + if (inner != null) { + return new PrivateLinkResourceListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceProvidersClientImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..2a703ddea2db1 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CheckDomainAvailabilityResultInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CheckSkuAvailabilityResultListInner; +import com.azure.resourcemanager.cognitiveservices.models.CheckDomainAvailabilityParameter; +import com.azure.resourcemanager.cognitiveservices.models.CheckSkuAvailabilityParameter; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final CognitiveServicesManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(CognitiveServicesManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CognitiveServicesManagementClientResourceProviders to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CognitiveServicesMan") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}" + + "/checkSkuAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkSkuAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("location") String location, + @BodyParam("application/json") CheckSkuAvailabilityParameter parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkDomainAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckDomainAvailabilityParameter parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Check available SKUs. + * + * @param location Resource location. + * @param parameters Check SKU availability 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 check SKU availability result list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkSkuAvailabilityWithResponseAsync( + String location, CheckSkuAvailabilityParameter parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkSkuAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + location, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Check available SKUs. + * + * @param location Resource location. + * @param parameters Check SKU availability 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 check SKU availability result list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkSkuAvailabilityWithResponseAsync( + String location, CheckSkuAvailabilityParameter parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkSkuAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + location, + parameters, + accept, + context); + } + + /** + * Check available SKUs. + * + * @param location Resource location. + * @param parameters Check SKU availability 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 check SKU availability result list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkSkuAvailabilityAsync( + String location, CheckSkuAvailabilityParameter parameters) { + return checkSkuAvailabilityWithResponseAsync(location, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check available SKUs. + * + * @param location Resource location. + * @param parameters Check SKU availability 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 check SKU availability result list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckSkuAvailabilityResultListInner checkSkuAvailability( + String location, CheckSkuAvailabilityParameter parameters) { + return checkSkuAvailabilityAsync(location, parameters).block(); + } + + /** + * Check available SKUs. + * + * @param location Resource location. + * @param parameters Check SKU availability 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 check SKU availability result list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkSkuAvailabilityWithResponse( + String location, CheckSkuAvailabilityParameter parameters, Context context) { + return checkSkuAvailabilityWithResponseAsync(location, parameters, context).block(); + } + + /** + * Check whether a domain is available. + * + * @param parameters Check Domain availability 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 check Domain availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkDomainAvailabilityWithResponseAsync( + CheckDomainAvailabilityParameter parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkDomainAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Check whether a domain is available. + * + * @param parameters Check Domain availability 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 check Domain availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkDomainAvailabilityWithResponseAsync( + CheckDomainAvailabilityParameter parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkDomainAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Check whether a domain is available. + * + * @param parameters Check Domain availability 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 check Domain availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkDomainAvailabilityAsync( + CheckDomainAvailabilityParameter parameters) { + return checkDomainAvailabilityWithResponseAsync(parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check whether a domain is available. + * + * @param parameters Check Domain availability 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 check Domain availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckDomainAvailabilityResultInner checkDomainAvailability(CheckDomainAvailabilityParameter parameters) { + return checkDomainAvailabilityAsync(parameters).block(); + } + + /** + * Check whether a domain is available. + * + * @param parameters Check Domain availability 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 check Domain availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkDomainAvailabilityWithResponse( + CheckDomainAvailabilityParameter parameters, Context context) { + return checkDomainAvailabilityWithResponseAsync(parameters, context).block(); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceProvidersImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..c8800cb49e225 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceProvidersImpl.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.cognitiveservices.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.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CheckDomainAvailabilityResultInner; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CheckSkuAvailabilityResultListInner; +import com.azure.resourcemanager.cognitiveservices.models.CheckDomainAvailabilityParameter; +import com.azure.resourcemanager.cognitiveservices.models.CheckDomainAvailabilityResult; +import com.azure.resourcemanager.cognitiveservices.models.CheckSkuAvailabilityParameter; +import com.azure.resourcemanager.cognitiveservices.models.CheckSkuAvailabilityResultList; +import com.azure.resourcemanager.cognitiveservices.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final CognitiveServicesManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, CognitiveServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CheckSkuAvailabilityResultList checkSkuAvailability( + String location, CheckSkuAvailabilityParameter parameters) { + CheckSkuAvailabilityResultListInner inner = this.serviceClient().checkSkuAvailability(location, parameters); + if (inner != null) { + return new CheckSkuAvailabilityResultListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkSkuAvailabilityWithResponse( + String location, CheckSkuAvailabilityParameter parameters, Context context) { + Response inner = + this.serviceClient().checkSkuAvailabilityWithResponse(location, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckSkuAvailabilityResultListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckDomainAvailabilityResult checkDomainAvailability(CheckDomainAvailabilityParameter parameters) { + CheckDomainAvailabilityResultInner inner = this.serviceClient().checkDomainAvailability(parameters); + if (inner != null) { + return new CheckDomainAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkDomainAvailabilityWithResponse( + CheckDomainAvailabilityParameter parameters, Context context) { + Response inner = + this.serviceClient().checkDomainAvailabilityWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckDomainAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkuImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkuImpl.java new file mode 100644 index 0000000000000..0cad9b9c55826 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkuImpl.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.cognitiveservices.implementation; + +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.ResourceSkuInner; +import com.azure.resourcemanager.cognitiveservices.models.ResourceSku; +import com.azure.resourcemanager.cognitiveservices.models.ResourceSkuRestrictions; +import java.util.Collections; +import java.util.List; + +public final class ResourceSkuImpl implements ResourceSku { + private ResourceSkuInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public ResourceSkuImpl(ResourceSkuInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public String name() { + return this.innerModel().name(); + } + + public String tier() { + return this.innerModel().tier(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + 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 CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkusClientImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkusClientImpl.java new file mode 100644 index 0000000000000..d893df9307702 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkusClientImpl.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.cognitiveservices.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.cognitiveservices.fluent.ResourceSkusClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.ResourceSkuInner; +import com.azure.resourcemanager.cognitiveservices.models.ResourceSkusResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceSkusClient. */ +public final class ResourceSkusClientImpl implements ResourceSkusClient { + private final ClientLogger logger = new ClientLogger(ResourceSkusClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceSkusService service; + + /** The service client containing this operation class. */ + private final CognitiveServicesManagementClientImpl client; + + /** + * Initializes an instance of ResourceSkusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceSkusClientImpl(CognitiveServicesManagementClientImpl client) { + this.service = + RestProxy.create(ResourceSkusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CognitiveServicesManagementClientResourceSkus to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CognitiveServicesMan") + private interface ResourceSkusService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/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); + } + + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your 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 Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your 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 Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your 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 Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your 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 Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your 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 Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your 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 Microsoft. + */ + @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 Get Skus operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Get Skus operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkusImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkusImpl.java new file mode 100644 index 0000000000000..92ab3a751b340 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/ResourceSkusImpl.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.cognitiveservices.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.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.ResourceSkusClient; +import com.azure.resourcemanager.cognitiveservices.fluent.models.ResourceSkuInner; +import com.azure.resourcemanager.cognitiveservices.models.ResourceSku; +import com.azure.resourcemanager.cognitiveservices.models.ResourceSkus; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceSkusImpl implements ResourceSkus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkusImpl.class); + + private final ResourceSkusClient innerClient; + + private final CognitiveServicesManager serviceManager; + + public ResourceSkusImpl(ResourceSkusClient innerClient, CognitiveServicesManager 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 ResourceSkusClient serviceClient() { + return this.innerClient; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/UsagesResultImpl.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/UsagesResultImpl.java new file mode 100644 index 0000000000000..fb0dcf2685eb0 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/UsagesResultImpl.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.cognitiveservices.implementation; + +import com.azure.resourcemanager.cognitiveservices.CognitiveServicesManager; +import com.azure.resourcemanager.cognitiveservices.fluent.models.UsagesResultInner; +import com.azure.resourcemanager.cognitiveservices.models.Usage; +import com.azure.resourcemanager.cognitiveservices.models.UsagesResult; +import java.util.Collections; +import java.util.List; + +public final class UsagesResultImpl implements UsagesResult { + private UsagesResultInner innerObject; + + private final CognitiveServicesManager serviceManager; + + public UsagesResultImpl(UsagesResultInner innerObject, CognitiveServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public UsagesResultInner innerModel() { + return this.innerObject; + } + + private CognitiveServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/Utils.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/Utils.java new file mode 100644 index 0000000000000..b9a6b12e34223 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/Utils.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.implementation; + +import java.util.Arrays; +import java.util.Iterator; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/package-info.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/package-info.java new file mode 100644 index 0000000000000..06d47f2d24643 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/package-info.java @@ -0,0 +1,8 @@ +// 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 CognitiveServicesManagementClient. Cognitive Services Management Client. + */ +package com.azure.resourcemanager.cognitiveservices.implementation; diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Accounts.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Accounts.java new file mode 100644 index 0000000000000..b96eb9522c625 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Accounts.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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 Accounts. */ +public interface Accounts { + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName); + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + CognitiveServicesAccount getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @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 cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns all the resources of a particular type belonging to a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + PagedIterable list(); + + /** + * Returns all the resources of a particular type belonging to a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cognitive services accounts operation response. + */ + PagedIterable list(Context context); + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + CognitiveServicesAccountKeys listKeys(String resourceGroupName, String accountName); + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @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 access keys for the cognitive services account. + */ + Response listKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param parameters Regenerate key parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + CognitiveServicesAccountKeys regenerateKey( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters); + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param parameters Regenerate key parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys for the cognitive services account. + */ + Response regenerateKeyWithResponse( + String resourceGroupName, String accountName, RegenerateKeyParameters parameters, Context context); + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 cognitive services accounts operation response. + */ + CognitiveServicesAccountEnumerateSkusResult listSkus(String resourceGroupName, String accountName); + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @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 cognitive services accounts operation response. + */ + Response listSkusWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return usages for the requested Cognitive Services account. + */ + UsagesResult getUsages(String resourceGroupName, String accountName); + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is + * name.value (name of the metric, can have an or of multiple names). + * @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 usages for the requested Cognitive Services account. + */ + Response getUsagesWithResponse( + String resourceGroupName, String accountName, String filter, Context context); + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @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 cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + CognitiveServicesAccount getById(String id); + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @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 cognitive Services Account is an Azure resource representing the provisioned account, its type, location + * and SKU. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CognitiveServicesAccount resource. + * + * @param name resource name. + * @return the first stage of the new CognitiveServicesAccount definition. + */ + CognitiveServicesAccount.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckDomainAvailabilityParameter.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckDomainAvailabilityParameter.java new file mode 100644 index 0000000000000..25c651eb1c5d9 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckDomainAvailabilityParameter.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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; + +/** Check Domain availability parameter. */ +@Fluent +public final class CheckDomainAvailabilityParameter { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckDomainAvailabilityParameter.class); + + /* + * The subdomain name to use. + */ + @JsonProperty(value = "subdomainName", required = true) + private String subdomainName; + + /* + * The Type of the resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Get the subdomainName property: The subdomain name to use. + * + * @return the subdomainName value. + */ + public String subdomainName() { + return this.subdomainName; + } + + /** + * Set the subdomainName property: The subdomain name to use. + * + * @param subdomainName the subdomainName value to set. + * @return the CheckDomainAvailabilityParameter object itself. + */ + public CheckDomainAvailabilityParameter withSubdomainName(String subdomainName) { + this.subdomainName = subdomainName; + return this; + } + + /** + * Get the type property: The Type of the resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The Type of the resource. + * + * @param type the type value to set. + * @return the CheckDomainAvailabilityParameter object itself. + */ + public CheckDomainAvailabilityParameter withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subdomainName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property subdomainName in model CheckDomainAvailabilityParameter")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model CheckDomainAvailabilityParameter")); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckDomainAvailabilityResult.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckDomainAvailabilityResult.java new file mode 100644 index 0000000000000..13f59f0f8b21c --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckDomainAvailabilityResult.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.cognitiveservices.models; + +import com.azure.resourcemanager.cognitiveservices.fluent.models.CheckDomainAvailabilityResultInner; + +/** An immutable client-side representation of CheckDomainAvailabilityResult. */ +public interface CheckDomainAvailabilityResult { + /** + * Gets the isSubdomainAvailable property: Indicates the given SKU is available or not. + * + * @return the isSubdomainAvailable value. + */ + Boolean isSubdomainAvailable(); + + /** + * Gets the reason property: Reason why the SKU is not available. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the subdomainName property: The subdomain name to use. + * + * @return the subdomainName value. + */ + String subdomainName(); + + /** + * Gets the type property: The Type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the inner com.azure.resourcemanager.cognitiveservices.fluent.models.CheckDomainAvailabilityResultInner + * object. + * + * @return the inner object. + */ + CheckDomainAvailabilityResultInner innerModel(); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityParameter.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityParameter.java new file mode 100644 index 0000000000000..34fab64e1c69f --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityParameter.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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; + +/** Check SKU availability parameter. */ +@Fluent +public final class CheckSkuAvailabilityParameter { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckSkuAvailabilityParameter.class); + + /* + * The SKU of the resource. + */ + @JsonProperty(value = "skus", required = true) + private List skus; + + /* + * The Kind of the resource. + */ + @JsonProperty(value = "kind", required = true) + private String kind; + + /* + * The Type of the resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Get the skus property: The SKU of the resource. + * + * @return the skus value. + */ + public List skus() { + return this.skus; + } + + /** + * Set the skus property: The SKU of the resource. + * + * @param skus the skus value to set. + * @return the CheckSkuAvailabilityParameter object itself. + */ + public CheckSkuAvailabilityParameter withSkus(List skus) { + this.skus = skus; + return this; + } + + /** + * Get the kind property: The Kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: The Kind of the resource. + * + * @param kind the kind value to set. + * @return the CheckSkuAvailabilityParameter object itself. + */ + public CheckSkuAvailabilityParameter withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the type property: The Type of the resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The Type of the resource. + * + * @param type the type value to set. + * @return the CheckSkuAvailabilityParameter object itself. + */ + public CheckSkuAvailabilityParameter withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (skus() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property skus in model CheckSkuAvailabilityParameter")); + } + if (kind() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property kind in model CheckSkuAvailabilityParameter")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model CheckSkuAvailabilityParameter")); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityResult.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityResult.java new file mode 100644 index 0000000000000..070a7bf822c9d --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityResult.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.cognitiveservices.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; + +/** Check SKU availability result. */ +@Fluent +public final class CheckSkuAvailabilityResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckSkuAvailabilityResult.class); + + /* + * The Kind of the resource. + */ + @JsonProperty(value = "kind") + private String kind; + + /* + * The Type of the resource. + */ + @JsonProperty(value = "type") + private String type; + + /* + * The SKU of Cognitive Services account. + */ + @JsonProperty(value = "skuName") + private String skuName; + + /* + * Indicates the given SKU is available or not. + */ + @JsonProperty(value = "skuAvailable") + private Boolean skuAvailable; + + /* + * Reason why the SKU is not available. + */ + @JsonProperty(value = "reason") + private String reason; + + /* + * Additional error message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the kind property: The Kind of the resource. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: The Kind of the resource. + * + * @param kind the kind value to set. + * @return the CheckSkuAvailabilityResult object itself. + */ + public CheckSkuAvailabilityResult withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the type property: The Type of the resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The Type of the resource. + * + * @param type the type value to set. + * @return the CheckSkuAvailabilityResult object itself. + */ + public CheckSkuAvailabilityResult withType(String type) { + this.type = type; + return this; + } + + /** + * Get the skuName property: The SKU of Cognitive Services account. + * + * @return the skuName value. + */ + public String skuName() { + return this.skuName; + } + + /** + * Set the skuName property: The SKU of Cognitive Services account. + * + * @param skuName the skuName value to set. + * @return the CheckSkuAvailabilityResult object itself. + */ + public CheckSkuAvailabilityResult withSkuName(String skuName) { + this.skuName = skuName; + return this; + } + + /** + * Get the skuAvailable property: Indicates the given SKU is available or not. + * + * @return the skuAvailable value. + */ + public Boolean skuAvailable() { + return this.skuAvailable; + } + + /** + * Set the skuAvailable property: Indicates the given SKU is available or not. + * + * @param skuAvailable the skuAvailable value to set. + * @return the CheckSkuAvailabilityResult object itself. + */ + public CheckSkuAvailabilityResult withSkuAvailable(Boolean skuAvailable) { + this.skuAvailable = skuAvailable; + return this; + } + + /** + * Get the reason property: Reason why the SKU is not available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Reason why the SKU is not available. + * + * @param reason the reason value to set. + * @return the CheckSkuAvailabilityResult object itself. + */ + public CheckSkuAvailabilityResult withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: Additional error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Additional error message. + * + * @param message the message value to set. + * @return the CheckSkuAvailabilityResult object itself. + */ + public CheckSkuAvailabilityResult 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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityResultList.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityResultList.java new file mode 100644 index 0000000000000..fbd151fdbaeb0 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CheckSkuAvailabilityResultList.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.resourcemanager.cognitiveservices.fluent.models.CheckSkuAvailabilityResultListInner; +import java.util.List; + +/** An immutable client-side representation of CheckSkuAvailabilityResultList. */ +public interface CheckSkuAvailabilityResultList { + /** + * Gets the value property: Check SKU availability result list. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.cognitiveservices.fluent.models.CheckSkuAvailabilityResultListInner + * object. + * + * @return the inner object. + */ + CheckSkuAvailabilityResultListInner innerModel(); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccount.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccount.java new file mode 100644 index 0000000000000..b1d605e4eade7 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccount.java @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountInner; +import java.util.Map; + +/** An immutable client-side representation of CognitiveServicesAccount. */ +public interface CognitiveServicesAccount { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the etag property: Entity Tag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the kind property: The Kind of the resource. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the properties property: Properties of Cognitive Services account. + * + * @return the properties value. + */ + CognitiveServicesAccountProperties properties(); + + /** + * Gets the sku property: The SKU of Cognitive Services account. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the identity property: The identity of Cognitive Services account. + * + * @return the identity value. + */ + Identity identity(); + + /** + * 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.cognitiveservices.fluent.models.CognitiveServicesAccountInner object. + * + * @return the inner object. + */ + CognitiveServicesAccountInner innerModel(); + + /** The entirety of the CognitiveServicesAccount definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The CognitiveServicesAccount definition stages. */ + interface DefinitionStages { + /** The first stage of the CognitiveServicesAccount definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CognitiveServicesAccount 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 CognitiveServicesAccount definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the CognitiveServicesAccount 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.WithKind, + DefinitionStages.WithProperties, + DefinitionStages.WithSku, + DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + CognitiveServicesAccount create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CognitiveServicesAccount create(Context context); + } + /** The stage of the CognitiveServicesAccount 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 CognitiveServicesAccount definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The Kind of the resource.. + * + * @param kind The Kind of the resource. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + /** The stage of the CognitiveServicesAccount definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Cognitive Services account.. + * + * @param properties Properties of Cognitive Services account. + * @return the next definition stage. + */ + WithCreate withProperties(CognitiveServicesAccountProperties properties); + } + /** The stage of the CognitiveServicesAccount definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU of Cognitive Services account.. + * + * @param sku The SKU of Cognitive Services account. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the CognitiveServicesAccount definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of Cognitive Services account.. + * + * @param identity The identity of Cognitive Services account. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + } + /** + * Begins update for the CognitiveServicesAccount resource. + * + * @return the stage of resource update. + */ + CognitiveServicesAccount.Update update(); + + /** The template for CognitiveServicesAccount update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithKind, + UpdateStages.WithProperties, + UpdateStages.WithSku, + UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CognitiveServicesAccount apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CognitiveServicesAccount apply(Context context); + } + /** The CognitiveServicesAccount update stages. */ + interface UpdateStages { + /** The stage of the CognitiveServicesAccount 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 CognitiveServicesAccount update allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The Kind of the resource.. + * + * @param kind The Kind of the resource. + * @return the next definition stage. + */ + Update withKind(String kind); + } + /** The stage of the CognitiveServicesAccount update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Cognitive Services account.. + * + * @param properties Properties of Cognitive Services account. + * @return the next definition stage. + */ + Update withProperties(CognitiveServicesAccountProperties properties); + } + /** The stage of the CognitiveServicesAccount update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU of Cognitive Services account.. + * + * @param sku The SKU of Cognitive Services account. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the CognitiveServicesAccount update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of Cognitive Services account.. + * + * @param identity The identity of Cognitive Services account. + * @return the next definition stage. + */ + Update withIdentity(Identity identity); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CognitiveServicesAccount refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CognitiveServicesAccount refresh(Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountApiProperties.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountApiProperties.java new file mode 100644 index 0000000000000..a7af16c412e18 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountApiProperties.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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 api properties for special APIs. */ +@Fluent +public final class CognitiveServicesAccountApiProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CognitiveServicesAccountApiProperties.class); + + /* + * (QnAMaker Only) The runtime endpoint of QnAMaker. + */ + @JsonProperty(value = "qnaRuntimeEndpoint") + private String qnaRuntimeEndpoint; + + /* + * (Bing Search Only) The flag to enable statistics of Bing Search. + */ + @JsonProperty(value = "statisticsEnabled") + private Boolean statisticsEnabled; + + /* + * (Personalization Only) The flag to enable statistics of Bing Search. + */ + @JsonProperty(value = "eventHubConnectionString") + private String eventHubConnectionString; + + /* + * (Personalization Only) The storage account connection string. + */ + @JsonProperty(value = "storageAccountConnectionString") + private String storageAccountConnectionString; + + /* + * (Metrics Advisor Only) The Azure AD Client Id (Application Id). + */ + @JsonProperty(value = "aadClientId") + private String aadClientId; + + /* + * (Metrics Advisor Only) The Azure AD Tenant Id. + */ + @JsonProperty(value = "aadTenantId") + private String aadTenantId; + + /* + * (Metrics Advisor Only) The super user of Metrics Advisor. + */ + @JsonProperty(value = "superUser") + private String superUser; + + /* + * (Metrics Advisor Only) The website name of Metrics Advisor. + */ + @JsonProperty(value = "websiteName") + private String websiteName; + + /** + * Get the qnaRuntimeEndpoint property: (QnAMaker Only) The runtime endpoint of QnAMaker. + * + * @return the qnaRuntimeEndpoint value. + */ + public String qnaRuntimeEndpoint() { + return this.qnaRuntimeEndpoint; + } + + /** + * Set the qnaRuntimeEndpoint property: (QnAMaker Only) The runtime endpoint of QnAMaker. + * + * @param qnaRuntimeEndpoint the qnaRuntimeEndpoint value to set. + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withQnaRuntimeEndpoint(String qnaRuntimeEndpoint) { + this.qnaRuntimeEndpoint = qnaRuntimeEndpoint; + return this; + } + + /** + * Get the statisticsEnabled property: (Bing Search Only) The flag to enable statistics of Bing Search. + * + * @return the statisticsEnabled value. + */ + public Boolean statisticsEnabled() { + return this.statisticsEnabled; + } + + /** + * Set the statisticsEnabled property: (Bing Search Only) The flag to enable statistics of Bing Search. + * + * @param statisticsEnabled the statisticsEnabled value to set. + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withStatisticsEnabled(Boolean statisticsEnabled) { + this.statisticsEnabled = statisticsEnabled; + return this; + } + + /** + * Get the eventHubConnectionString property: (Personalization Only) The flag to enable statistics of Bing Search. + * + * @return the eventHubConnectionString value. + */ + public String eventHubConnectionString() { + return this.eventHubConnectionString; + } + + /** + * Set the eventHubConnectionString property: (Personalization Only) The flag to enable statistics of Bing Search. + * + * @param eventHubConnectionString the eventHubConnectionString value to set. + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withEventHubConnectionString(String eventHubConnectionString) { + this.eventHubConnectionString = eventHubConnectionString; + return this; + } + + /** + * Get the storageAccountConnectionString property: (Personalization Only) The storage account connection string. + * + * @return the storageAccountConnectionString value. + */ + public String storageAccountConnectionString() { + return this.storageAccountConnectionString; + } + + /** + * Set the storageAccountConnectionString property: (Personalization Only) The storage account connection string. + * + * @param storageAccountConnectionString the storageAccountConnectionString value to set. + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withStorageAccountConnectionString( + String storageAccountConnectionString) { + this.storageAccountConnectionString = storageAccountConnectionString; + return this; + } + + /** + * Get the aadClientId property: (Metrics Advisor Only) The Azure AD Client Id (Application Id). + * + * @return the aadClientId value. + */ + public String aadClientId() { + return this.aadClientId; + } + + /** + * Set the aadClientId property: (Metrics Advisor Only) The Azure AD Client Id (Application Id). + * + * @param aadClientId the aadClientId value to set. + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withAadClientId(String aadClientId) { + this.aadClientId = aadClientId; + return this; + } + + /** + * Get the aadTenantId property: (Metrics Advisor Only) The Azure AD Tenant Id. + * + * @return the aadTenantId value. + */ + public String aadTenantId() { + return this.aadTenantId; + } + + /** + * Set the aadTenantId property: (Metrics Advisor Only) The Azure AD Tenant Id. + * + * @param aadTenantId the aadTenantId value to set. + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withAadTenantId(String aadTenantId) { + this.aadTenantId = aadTenantId; + return this; + } + + /** + * Get the superUser property: (Metrics Advisor Only) The super user of Metrics Advisor. + * + * @return the superUser value. + */ + public String superUser() { + return this.superUser; + } + + /** + * Set the superUser property: (Metrics Advisor Only) The super user of Metrics Advisor. + * + * @param superUser the superUser value to set. + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withSuperUser(String superUser) { + this.superUser = superUser; + return this; + } + + /** + * Get the websiteName property: (Metrics Advisor Only) The website name of Metrics Advisor. + * + * @return the websiteName value. + */ + public String websiteName() { + return this.websiteName; + } + + /** + * Set the websiteName property: (Metrics Advisor Only) The website name of Metrics Advisor. + * + * @param websiteName the websiteName value to set. + * @return the CognitiveServicesAccountApiProperties object itself. + */ + public CognitiveServicesAccountApiProperties withWebsiteName(String websiteName) { + this.websiteName = websiteName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountEnumerateSkusResult.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountEnumerateSkusResult.java new file mode 100644 index 0000000000000..8a4455e023e8c --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountEnumerateSkusResult.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountEnumerateSkusResultInner; +import java.util.List; + +/** An immutable client-side representation of CognitiveServicesAccountEnumerateSkusResult. */ +public interface CognitiveServicesAccountEnumerateSkusResult { + /** + * Gets the value property: Gets the list of Cognitive Services accounts and their properties. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner + * com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountEnumerateSkusResultInner + * object. + * + * @return the inner object. + */ + CognitiveServicesAccountEnumerateSkusResultInner innerModel(); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountKeys.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountKeys.java new file mode 100644 index 0000000000000..b47535a685eda --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountKeys.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountKeysInner; + +/** An immutable client-side representation of CognitiveServicesAccountKeys. */ +public interface CognitiveServicesAccountKeys { + /** + * Gets the key1 property: Gets the value of key 1. + * + * @return the key1 value. + */ + String key1(); + + /** + * Gets the key2 property: Gets the value of key 2. + * + * @return the key2 value. + */ + String key2(); + + /** + * Gets the inner com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountKeysInner + * object. + * + * @return the inner object. + */ + CognitiveServicesAccountKeysInner innerModel(); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountListResult.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountListResult.java new file mode 100644 index 0000000000000..3b7867e2ce9c9 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountListResult.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.cognitiveservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.fluent.models.CognitiveServicesAccountInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of cognitive services accounts operation response. */ +@Fluent +public final class CognitiveServicesAccountListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CognitiveServicesAccountListResult.class); + + /* + * The link used to get the next page of accounts. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Gets the list of Cognitive Services accounts and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the nextLink property: The link used to get the next page of accounts. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of accounts. + * + * @param nextLink the nextLink value to set. + * @return the CognitiveServicesAccountListResult object itself. + */ + public CognitiveServicesAccountListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Gets the list of Cognitive Services accounts and their properties. + * + * @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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountProperties.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountProperties.java new file mode 100644 index 0000000000000..8f58199d4af3c --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesAccountProperties.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of Cognitive Services account. */ +@Fluent +public final class CognitiveServicesAccountProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CognitiveServicesAccountProperties.class); + + /* + * Gets the status of the cognitive services account at the time the + * operation was called. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Endpoint of the created account. + */ + @JsonProperty(value = "endpoint", access = JsonProperty.Access.WRITE_ONLY) + private String endpoint; + + /* + * The internal identifier. + */ + @JsonProperty(value = "internalId", access = JsonProperty.Access.WRITE_ONLY) + private String internalId; + + /* + * Gets the capabilities of the cognitive services account. Each item + * indicates the capability of a specific feature. The values are read-only + * and for reference only. + */ + @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY) + private List capabilities; + + /* + * Optional subdomain name used for token-based authentication. + */ + @JsonProperty(value = "customSubDomainName") + private String customSubDomainName; + + /* + * A collection of rules governing the accessibility from specific network + * locations. + */ + @JsonProperty(value = "networkAcls") + private NetworkRuleSet networkAcls; + + /* + * The encryption properties for this resource. + */ + @JsonProperty(value = "encryption") + private Encryption encryption; + + /* + * The storage accounts for this resource. + */ + @JsonProperty(value = "userOwnedStorage") + private List userOwnedStorage; + + /* + * The private endpoint connection associated with the Cognitive Services + * account. + */ + @JsonProperty(value = "privateEndpointConnections") + private List privateEndpointConnections; + + /* + * Whether or not public endpoint access is allowed for this account. Value + * is optional but if passed in, must be 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * The api properties for special APIs. + */ + @JsonProperty(value = "apiProperties") + private CognitiveServicesAccountApiProperties apiProperties; + + /* + * Gets the date of cognitive services account creation. + */ + @JsonProperty(value = "dateCreated", access = JsonProperty.Access.WRITE_ONLY) + private String dateCreated; + + /** + * Get the provisioningState property: Gets the status of the cognitive services account at the time the operation + * was called. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the endpoint property: Endpoint of the created account. + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Get the internalId property: The internal identifier. + * + * @return the internalId value. + */ + public String internalId() { + return this.internalId; + } + + /** + * Get the capabilities property: Gets the capabilities of the cognitive services account. Each item indicates the + * capability of a specific feature. The values are read-only and for reference only. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Get the customSubDomainName property: Optional subdomain name used for token-based authentication. + * + * @return the customSubDomainName value. + */ + public String customSubDomainName() { + return this.customSubDomainName; + } + + /** + * Set the customSubDomainName property: Optional subdomain name used for token-based authentication. + * + * @param customSubDomainName the customSubDomainName value to set. + * @return the CognitiveServicesAccountProperties object itself. + */ + public CognitiveServicesAccountProperties withCustomSubDomainName(String customSubDomainName) { + this.customSubDomainName = customSubDomainName; + return this; + } + + /** + * Get the networkAcls property: A collection of rules governing the accessibility from specific network locations. + * + * @return the networkAcls value. + */ + public NetworkRuleSet networkAcls() { + return this.networkAcls; + } + + /** + * Set the networkAcls property: A collection of rules governing the accessibility from specific network locations. + * + * @param networkAcls the networkAcls value to set. + * @return the CognitiveServicesAccountProperties object itself. + */ + public CognitiveServicesAccountProperties withNetworkAcls(NetworkRuleSet networkAcls) { + this.networkAcls = networkAcls; + return this; + } + + /** + * Get the encryption property: The encryption properties for this resource. + * + * @return the encryption value. + */ + public Encryption encryption() { + return this.encryption; + } + + /** + * Set the encryption property: The encryption properties for this resource. + * + * @param encryption the encryption value to set. + * @return the CognitiveServicesAccountProperties object itself. + */ + public CognitiveServicesAccountProperties withEncryption(Encryption encryption) { + this.encryption = encryption; + return this; + } + + /** + * Get the userOwnedStorage property: The storage accounts for this resource. + * + * @return the userOwnedStorage value. + */ + public List userOwnedStorage() { + return this.userOwnedStorage; + } + + /** + * Set the userOwnedStorage property: The storage accounts for this resource. + * + * @param userOwnedStorage the userOwnedStorage value to set. + * @return the CognitiveServicesAccountProperties object itself. + */ + public CognitiveServicesAccountProperties withUserOwnedStorage(List userOwnedStorage) { + this.userOwnedStorage = userOwnedStorage; + return this; + } + + /** + * Get the privateEndpointConnections property: The private endpoint connection associated with the Cognitive + * Services account. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Set the privateEndpointConnections property: The private endpoint connection associated with the Cognitive + * Services account. + * + * @param privateEndpointConnections the privateEndpointConnections value to set. + * @return the CognitiveServicesAccountProperties object itself. + */ + public CognitiveServicesAccountProperties withPrivateEndpointConnections( + List privateEndpointConnections) { + this.privateEndpointConnections = privateEndpointConnections; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public endpoint access is allowed for this account. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public endpoint access is allowed for this account. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the CognitiveServicesAccountProperties object itself. + */ + public CognitiveServicesAccountProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the apiProperties property: The api properties for special APIs. + * + * @return the apiProperties value. + */ + public CognitiveServicesAccountApiProperties apiProperties() { + return this.apiProperties; + } + + /** + * Set the apiProperties property: The api properties for special APIs. + * + * @param apiProperties the apiProperties value to set. + * @return the CognitiveServicesAccountProperties object itself. + */ + public CognitiveServicesAccountProperties withApiProperties(CognitiveServicesAccountApiProperties apiProperties) { + this.apiProperties = apiProperties; + return this; + } + + /** + * Get the dateCreated property: Gets the date of cognitive services account creation. + * + * @return the dateCreated value. + */ + public String dateCreated() { + return this.dateCreated; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + if (networkAcls() != null) { + networkAcls().validate(); + } + if (encryption() != null) { + encryption().validate(); + } + if (userOwnedStorage() != null) { + userOwnedStorage().forEach(e -> e.validate()); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (apiProperties() != null) { + apiProperties().validate(); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesResourceAndSku.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesResourceAndSku.java new file mode 100644 index 0000000000000..bd11e2da99e5a --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/CognitiveServicesResourceAndSku.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.cognitiveservices.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; + +/** Cognitive Services resource type and SKU. */ +@Fluent +public final class CognitiveServicesResourceAndSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CognitiveServicesResourceAndSku.class); + + /* + * Resource Namespace and Type + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * The SKU of Cognitive Services account. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Get the resourceType property: Resource Namespace and Type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Resource Namespace and Type. + * + * @param resourceType the resourceType value to set. + * @return the CognitiveServicesResourceAndSku object itself. + */ + public CognitiveServicesResourceAndSku withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the sku property: The SKU of Cognitive Services account. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of Cognitive Services account. + * + * @param sku the sku value to set. + * @return the CognitiveServicesResourceAndSku object itself. + */ + public CognitiveServicesResourceAndSku withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Encryption.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Encryption.java new file mode 100644 index 0000000000000..b3bd8fa4a5b04 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Encryption.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.cognitiveservices.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 to configure Encryption. */ +@Fluent +public final class Encryption { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Encryption.class); + + /* + * Properties of KeyVault + */ + @JsonProperty(value = "keyVaultProperties") + private KeyVaultProperties keyVaultProperties; + + /* + * Enumerates the possible value of keySource for Encryption + */ + @JsonProperty(value = "keySource") + private KeySource keySource; + + /** + * Get the keyVaultProperties property: Properties of KeyVault. + * + * @return the keyVaultProperties value. + */ + public KeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the keyVaultProperties property: Properties of KeyVault. + * + * @param keyVaultProperties the keyVaultProperties value to set. + * @return the Encryption object itself. + */ + public Encryption withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** + * Get the keySource property: Enumerates the possible value of keySource for Encryption. + * + * @return the keySource value. + */ + public KeySource keySource() { + return this.keySource; + } + + /** + * Set the keySource property: Enumerates the possible value of keySource for Encryption. + * + * @param keySource the keySource value to set. + * @return the Encryption object itself. + */ + public Encryption withKeySource(KeySource keySource) { + this.keySource = keySource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyVaultProperties() != null) { + keyVaultProperties().validate(); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Identity.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Identity.java new file mode 100644 index 0000000000000..f2eec73650e9d --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Identity.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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; + +/** Managed service identity. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * Type of managed service identity. + */ + @JsonProperty(value = "type") + private IdentityType type; + + /* + * Tenant of managed service identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * Principal Id of managed service identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The list of user assigned identities associated with the resource. The + * user identity dictionary key references will be ARM resource ids in the + * form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} + */ + @JsonProperty(value = "userAssignedIdentities") + private Map userAssignedIdentities; + + /** + * Get the type property: Type of managed service identity. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Get the tenantId property: Tenant of managed service identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the principalId property: Principal Id of managed service identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the userAssignedIdentities property: The list of user assigned identities associated with the resource. The + * user identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user assigned identities associated with the resource. The + * user identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the Identity object itself. + */ + public Identity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/IdentityType.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/IdentityType.java new file mode 100644 index 0000000000000..861695ec15427 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/IdentityType.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.cognitiveservices.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IdentityType. */ +public enum IdentityType { + /** Enum value None. */ + NONE("None"), + + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"); + + /** The actual serialized value for a IdentityType instance. */ + private final String value; + + IdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed IdentityType object, or null if unable to parse. + */ + @JsonCreator + public static IdentityType fromString(String value) { + IdentityType[] items = IdentityType.values(); + for (IdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/IpRule.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/IpRule.java new file mode 100644 index 0000000000000..77e5f2205088d --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/IpRule.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.cognitiveservices.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 rule governing the accessibility from a specific ip address or ip range. */ +@Fluent +public final class IpRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IpRule.class); + + /* + * An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + * IP address) or '124.56.78.0/24' (all addresses that start with + * 124.56.78). + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the value property: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or + * '124.56.78.0/24' (all addresses that start with 124.56.78). + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or + * '124.56.78.0/24' (all addresses that start with 124.56.78). + * + * @param value the value value to set. + * @return the IpRule object itself. + */ + public IpRule withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property value in model IpRule")); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeyName.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeyName.java new file mode 100644 index 0000000000000..f5560d778be92 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeyName.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.cognitiveservices.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for KeyName. */ +public enum KeyName { + /** Enum value Key1. */ + KEY1("Key1"), + + /** Enum value Key2. */ + KEY2("Key2"); + + /** The actual serialized value for a KeyName instance. */ + private final String value; + + KeyName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeyName instance. + * + * @param value the serialized value to parse. + * @return the parsed KeyName object, or null if unable to parse. + */ + @JsonCreator + public static KeyName fromString(String value) { + KeyName[] items = KeyName.values(); + for (KeyName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeySource.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeySource.java new file mode 100644 index 0000000000000..71afb370def26 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeySource.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.cognitiveservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KeySource. */ +public final class KeySource extends ExpandableStringEnum { + /** Static value Microsoft.CognitiveServices for KeySource. */ + public static final KeySource MICROSOFT_COGNITIVE_SERVICES = fromString("Microsoft.CognitiveServices"); + + /** Static value Microsoft.KeyVault for KeySource. */ + public static final KeySource MICROSOFT_KEY_VAULT = fromString("Microsoft.KeyVault"); + + /** + * Creates or finds a KeySource from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeySource. + */ + @JsonCreator + public static KeySource fromString(String name) { + return fromString(name, KeySource.class); + } + + /** @return known KeySource values. */ + public static Collection values() { + return values(KeySource.class); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeyVaultProperties.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeyVaultProperties.java new file mode 100644 index 0000000000000..cdc08cd804c26 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/KeyVaultProperties.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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 to configure keyVault Properties. */ +@Fluent +public final class KeyVaultProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultProperties.class); + + /* + * Name of the Key from KeyVault + */ + @JsonProperty(value = "keyName") + private String keyName; + + /* + * Version of the Key from KeyVault + */ + @JsonProperty(value = "keyVersion") + private String keyVersion; + + /* + * Uri of KeyVault + */ + @JsonProperty(value = "keyVaultUri") + private String keyVaultUri; + + /** + * Get the keyName property: Name of the Key from KeyVault. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: Name of the Key from KeyVault. + * + * @param keyName the keyName value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the keyVersion property: Version of the Key from KeyVault. + * + * @return the keyVersion value. + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set the keyVersion property: Version of the Key from KeyVault. + * + * @param keyVersion the keyVersion value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * Get the keyVaultUri property: Uri of KeyVault. + * + * @return the keyVaultUri value. + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the keyVaultUri property: Uri of KeyVault. + * + * @param keyVaultUri the keyVaultUri value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/MetricName.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/MetricName.java new file mode 100644 index 0000000000000..2ccdd116b9f69 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/MetricName.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.cognitiveservices.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; + +/** A metric name. */ +@Immutable +public final class MetricName { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricName.class); + + /* + * The name of the metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /* + * The friendly name of the metric. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** + * Get the value property: The name of the metric. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Get the localizedValue property: The friendly name of the metric. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/NetworkRuleAction.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/NetworkRuleAction.java new file mode 100644 index 0000000000000..e8440f7e8af09 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/NetworkRuleAction.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.cognitiveservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NetworkRuleAction. */ +public final class NetworkRuleAction extends ExpandableStringEnum { + /** Static value Allow for NetworkRuleAction. */ + public static final NetworkRuleAction ALLOW = fromString("Allow"); + + /** Static value Deny for NetworkRuleAction. */ + public static final NetworkRuleAction DENY = fromString("Deny"); + + /** + * Creates or finds a NetworkRuleAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkRuleAction. + */ + @JsonCreator + public static NetworkRuleAction fromString(String name) { + return fromString(name, NetworkRuleAction.class); + } + + /** @return known NetworkRuleAction values. */ + public static Collection values() { + return values(NetworkRuleAction.class); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/NetworkRuleSet.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/NetworkRuleSet.java new file mode 100644 index 0000000000000..0ddd1fe01e970 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/NetworkRuleSet.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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 governing the network accessibility. */ +@Fluent +public final class NetworkRuleSet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkRuleSet.class); + + /* + * The default action when no rule from ipRules and from + * virtualNetworkRules match. This is only used after the bypass property + * has been evaluated. + */ + @JsonProperty(value = "defaultAction") + private NetworkRuleAction defaultAction; + + /* + * The list of IP address rules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /* + * The list of virtual network rules. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /** + * Get the defaultAction property: The default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. + * + * @return the defaultAction value. + */ + public NetworkRuleAction defaultAction() { + return this.defaultAction; + } + + /** + * Set the defaultAction property: The default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. + * + * @param defaultAction the defaultAction value to set. + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withDefaultAction(NetworkRuleAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get the ipRules property: The list of IP address rules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: The list of IP address rules. + * + * @param ipRules the ipRules value to set. + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the virtualNetworkRules property: The list of virtual network rules. + * + * @return the virtualNetworkRules value. + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules property: The list of virtual network rules. + * + * @param virtualNetworkRules the virtualNetworkRules value to set. + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipRules() != null) { + ipRules().forEach(e -> e.validate()); + } + if (virtualNetworkRules() != null) { + virtualNetworkRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationDisplayInfo.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationDisplayInfo.java new file mode 100644 index 0000000000000..9ef8c75e5019a --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationDisplayInfo.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.cognitiveservices.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 operation supported by Cognitive Services. */ +@Fluent +public final class OperationDisplayInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplayInfo.class); + + /* + * The description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The action that users can perform, based on their permission level. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Service provider: Microsoft Cognitive Services. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * 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 OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the operation property: The action that users can perform, based on their permission level. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: The action that users can perform, based on their permission level. + * + * @param operation the operation value to set. + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the provider property: Service provider: Microsoft Cognitive Services. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft Cognitive Services. + * + * @param provider the provider value to set. + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed. + * + * @param resource the resource value to set. + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationEntity.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationEntity.java new file mode 100644 index 0000000000000..948a90875da8c --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationEntity.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.resourcemanager.cognitiveservices.fluent.models.OperationEntityInner; + +/** An immutable client-side representation of OperationEntity. */ +public interface OperationEntity { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The operation supported by Cognitive Services. + * + * @return the display value. + */ + OperationDisplayInfo display(); + + /** + * Gets the origin property: The origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the properties property: Additional properties. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.cognitiveservices.fluent.models.OperationEntityInner object. + * + * @return the inner object. + */ + OperationEntityInner innerModel(); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationEntityListResult.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationEntityListResult.java new file mode 100644 index 0000000000000..251b060008522 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/OperationEntityListResult.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.cognitiveservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.fluent.models.OperationEntityInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of cognitive services accounts operation response. */ +@Fluent +public final class OperationEntityListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationEntityListResult.class); + + /* + * The link used to get the next page of operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * The list of operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the nextLink property: The link used to get the next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the OperationEntityListResult object itself. + */ + public OperationEntityListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: The list of operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of operations. + * + * @param value the value value to set. + * @return the OperationEntityListResult object itself. + */ + public OperationEntityListResult 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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Operations.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Operations.java new file mode 100644 index 0000000000000..53008e80ca7d6 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/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.cognitiveservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all the available Cognitive Services account 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 the list of cognitive services accounts operation response. + */ + PagedIterable list(); + + /** + * Lists all the available Cognitive Services account 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 the list of cognitive services accounts operation response. + */ + PagedIterable list(Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpoint.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpoint.java new file mode 100644 index 0000000000000..697380716e254 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpoint.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.cognitiveservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Private Endpoint resource. */ +@Immutable +public final class PrivateEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpoint.class); + + /* + * The ARM identifier for Private Endpoint + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: The ARM identifier for Private Endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnection.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..21997fc0e3734 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnection.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.cognitiveservices.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionInner; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Resource properties. + * + * @return the properties value. + */ + PrivateEndpointConnectionProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @return the next definition stage. + */ + WithCreate withExistingAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the PrivateEndpointConnection definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Resource properties.. + * + * @param properties Resource properties. + * @return the next definition stage. + */ + WithCreate withProperties(PrivateEndpointConnectionProperties properties); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Resource properties.. + * + * @param properties Resource properties. + * @return the next definition stage. + */ + Update withProperties(PrivateEndpointConnectionProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnectionListResult.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..fdf84b1cd7506 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionListResultInner; +import java.util.List; + +/** An immutable client-side representation of PrivateEndpointConnectionListResult. */ +public interface PrivateEndpointConnectionListResult { + /** + * Gets the value property: Array of private endpoint connections. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateEndpointConnectionListResultInner + * object. + * + * @return the inner object. + */ + PrivateEndpointConnectionListResultInner innerModel(); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnectionProperties.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..d7e498e18a19e --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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; + +/** Properties of the PrivateEndpointConnectProperties. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionProperties.class); + + /* + * The resource of private end point. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between + * service consumer and provider. + */ + @JsonProperty(value = "privateLinkServiceConnectionState", required = true) + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The private link resource group ids. + */ + @JsonProperty(value = "groupIds") + private List groupIds; + + /** + * Get the privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The resource of private end point. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the groupIds property: The private link resource group ids. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.groupIds; + } + + /** + * Set the groupIds property: The private link resource group ids. + * + * @param groupIds the groupIds value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withGroupIds(List groupIds) { + this.groupIds = groupIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateLinkServiceConnectionState in model" + + " PrivateEndpointConnectionProperties")); + } else { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnections.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..9590e68a6c005 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointConnections.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.cognitiveservices.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * Gets the private endpoint connections associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connections associated with the Cognitive Services account. + */ + PrivateEndpointConnectionListResult list(String resourceGroupName, String accountName); + + /** + * Gets the private endpoint connections associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @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 private endpoint connections associated with the Cognitive Services account. + */ + Response listWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + PrivateEndpointConnection get(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Cognitive + * Services Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets the specified private endpoint connection associated with the Cognitive Services account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the Cognitive Services account. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the specified private endpoint connection associated with the Cognitive Services account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointServiceConnectionStatus.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 0000000000000..d6c1af5ef82d5 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateEndpointServiceConnectionStatus.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.cognitiveservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointServiceConnectionStatus. */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** Static value Pending for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** Static value Approved for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** Static value Rejected for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** Static value Disconnected for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + @JsonCreator + public static PrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateEndpointServiceConnectionStatus.class); + } + + /** @return known PrivateEndpointServiceConnectionStatus values. */ + public static Collection values() { + return values(PrivateEndpointServiceConnectionStatus.class); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResource.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..0ed4ed88aa528 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResource.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.cognitiveservices.models; + +import com.azure.core.annotation.Fluent; +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; + +/** A private link resource. */ +@Fluent +public final class PrivateLinkResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResource.class); + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateLinkResourceProperties properties; + + /** + * Get the properties property: Resource properties. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Resource properties. + * + * @param properties the properties value to set. + * @return the PrivateLinkResource object itself. + */ + public PrivateLinkResource withProperties(PrivateLinkResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResourceListResult.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..382acdbe36a9c --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResourceListResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateLinkResourceListResultInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResourceListResult. */ +public interface PrivateLinkResourceListResult { + /** + * Gets the value property: Array of private link resources. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.cognitiveservices.fluent.models.PrivateLinkResourceListResultInner + * object. + * + * @return the inner object. + */ + PrivateLinkResourceListResultInner innerModel(); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResourceProperties.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..02b1e2ec18be1 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResourceProperties.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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; + +/** Properties of a private link resource. */ +@Fluent +public final class PrivateLinkResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceProperties.class); + + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The private link resource Private link DNS zone name. + */ + @JsonProperty(value = "requiredZoneNames") + private List requiredZoneNames; + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the displayName property: The private link resource display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResourceProperties object itself. + */ + public PrivateLinkResourceProperties withRequiredZoneNames(List requiredZoneNames) { + this.requiredZoneNames = requiredZoneNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResources.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..111aa1ba2cf1d --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkResources.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.cognitiveservices.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the private link resources that need to be created for a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Cognitive Services account. + */ + PrivateLinkResourceListResult list(String resourceGroupName, String accountName); + + /** + * Gets the private link resources that need to be created for a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of Cognitive Services account. + * @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 private link resources that need to be created for a Cognitive Services account. + */ + Response listWithResponse( + String resourceGroupName, String accountName, Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkServiceConnectionState.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 0000000000000..260fbba4eac89 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PrivateLinkServiceConnectionState.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.cognitiveservices.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 collection of information about the state of the connection between service consumer and provider. */ +@Fluent +public final class PrivateLinkServiceConnectionState { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionState.class); + + /* + * Indicates whether the connection has been Approved/Rejected/Removed by + * the owner of the service. + */ + @JsonProperty(value = "status") + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + @JsonProperty(value = "description") + private String description; + + /* + * A message indicating if changes on the service provider require any + * updates on the consumer. + */ + @JsonProperty(value = "actionRequired") + private String actionRequired; + + /** + * Get the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateEndpointServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The reason for approval/rejection of the connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval/rejection of the connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @return the actionRequired value. + */ + public String actionRequired() { + return this.actionRequired; + } + + /** + * Set the actionRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @param actionRequired the actionRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withActionRequired(String actionRequired) { + this.actionRequired = actionRequired; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ProvisioningState.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ProvisioningState.java new file mode 100644 index 0000000000000..080ef8bb8d235 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ProvisioningState.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.cognitiveservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value ResolvingDNS for ProvisioningState. */ + public static final ProvisioningState RESOLVING_DNS = fromString("ResolvingDNS"); + + /** Static value Moving for ProvisioningState. */ + public static final ProvisioningState MOVING = fromString("Moving"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PublicNetworkAccess.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PublicNetworkAccess.java new file mode 100644 index 0000000000000..8dfecfd183559 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/PublicNetworkAccess.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.cognitiveservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicNetworkAccess. */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + @JsonCreator + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** @return known PublicNetworkAccess values. */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/QuotaUsageStatus.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/QuotaUsageStatus.java new file mode 100644 index 0000000000000..b7cf33fb8ecf1 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/QuotaUsageStatus.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.cognitiveservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for QuotaUsageStatus. */ +public final class QuotaUsageStatus extends ExpandableStringEnum { + /** Static value Included for QuotaUsageStatus. */ + public static final QuotaUsageStatus INCLUDED = fromString("Included"); + + /** Static value Blocked for QuotaUsageStatus. */ + public static final QuotaUsageStatus BLOCKED = fromString("Blocked"); + + /** Static value InOverage for QuotaUsageStatus. */ + public static final QuotaUsageStatus IN_OVERAGE = fromString("InOverage"); + + /** Static value Unknown for QuotaUsageStatus. */ + public static final QuotaUsageStatus UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a QuotaUsageStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding QuotaUsageStatus. + */ + @JsonCreator + public static QuotaUsageStatus fromString(String name) { + return fromString(name, QuotaUsageStatus.class); + } + + /** @return known QuotaUsageStatus values. */ + public static Collection values() { + return values(QuotaUsageStatus.class); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/RegenerateKeyParameters.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/RegenerateKeyParameters.java new file mode 100644 index 0000000000000..f3f6252413bb2 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/RegenerateKeyParameters.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.cognitiveservices.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; + +/** Regenerate key parameters. */ +@Fluent +public final class RegenerateKeyParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegenerateKeyParameters.class); + + /* + * key name to generate (Key1|Key2) + */ + @JsonProperty(value = "keyName", required = true) + private KeyName keyName; + + /** + * Get the keyName property: key name to generate (Key1|Key2). + * + * @return the keyName value. + */ + public KeyName keyName() { + return this.keyName; + } + + /** + * Set the keyName property: key name to generate (Key1|Key2). + * + * @param keyName the keyName value to set. + * @return the RegenerateKeyParameters object itself. + */ + public RegenerateKeyParameters withKeyName(KeyName keyName) { + this.keyName = keyName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyName in model RegenerateKeyParameters")); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceProviders.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceProviders.java new file mode 100644 index 0000000000000..03d68698b128b --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceProviders.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Check available SKUs. + * + * @param location Resource location. + * @param parameters Check SKU availability parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check SKU availability result list. + */ + CheckSkuAvailabilityResultList checkSkuAvailability(String location, CheckSkuAvailabilityParameter parameters); + + /** + * Check available SKUs. + * + * @param location Resource location. + * @param parameters Check SKU availability parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check SKU availability result list. + */ + Response checkSkuAvailabilityWithResponse( + String location, CheckSkuAvailabilityParameter parameters, Context context); + + /** + * Check whether a domain is available. + * + * @param parameters Check Domain availability parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check Domain availability result. + */ + CheckDomainAvailabilityResult checkDomainAvailability(CheckDomainAvailabilityParameter parameters); + + /** + * Check whether a domain is available. + * + * @param parameters Check Domain availability parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check Domain availability result. + */ + Response checkDomainAvailabilityWithResponse( + CheckDomainAvailabilityParameter parameters, Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSku.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSku.java new file mode 100644 index 0000000000000..196fe9c7565f0 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSku.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.resourcemanager.cognitiveservices.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 name property: The name of SKU. + * + * @return the name value. + */ + String name(); + + /** + * Gets the tier property: Specifies the tier of Cognitive Services account. + * + * @return the tier value. + */ + String tier(); + + /** + * Gets the kind property: The Kind of resources that are supported in this SKU. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the locations property: The set of locations that the SKU is available. + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the restrictions property: The restrictions because of which SKU cannot be used. This is empty if there are + * no restrictions. + * + * @return the restrictions value. + */ + List restrictions(); + + /** + * Gets the inner com.azure.resourcemanager.cognitiveservices.fluent.models.ResourceSkuInner object. + * + * @return the inner object. + */ + ResourceSkuInner innerModel(); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionInfo.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionInfo.java new file mode 100644 index 0000000000000..eae28432f9242 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionInfo.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.cognitiveservices.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.util.List; + +/** The ResourceSkuRestrictionInfo model. */ +@Immutable +public final class ResourceSkuRestrictionInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuRestrictionInfo.class); + + /* + * Locations where the SKU is restricted + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /* + * List of availability zones where the SKU is restricted. + */ + @JsonProperty(value = "zones", access = JsonProperty.Access.WRITE_ONLY) + private List zones; + + /** + * Get the locations property: Locations where the SKU is restricted. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Get the zones property: List of availability zones where the SKU is restricted. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictions.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictions.java new file mode 100644 index 0000000000000..7fcebc95f701b --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictions.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.cognitiveservices.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.util.List; + +/** Describes restrictions of a SKU. */ +@Immutable +public final class ResourceSkuRestrictions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkuRestrictions.class); + + /* + * The type of restrictions. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSkuRestrictionsType type; + + /* + * The value of restrictions. If the restriction type is set to location. + * This would be different locations where the SKU is restricted. + */ + @JsonProperty(value = "values", access = JsonProperty.Access.WRITE_ONLY) + private List values; + + /* + * The information about the restriction where the SKU cannot be used. + */ + @JsonProperty(value = "restrictionInfo", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSkuRestrictionInfo restrictionInfo; + + /* + * The reason for restriction. + */ + @JsonProperty(value = "reasonCode", access = JsonProperty.Access.WRITE_ONLY) + private ResourceSkuRestrictionsReasonCode reasonCode; + + /** + * Get the type property: The type of restrictions. + * + * @return the type value. + */ + public ResourceSkuRestrictionsType type() { + return this.type; + } + + /** + * Get the values property: The value of restrictions. If the restriction type is set to location. This would be + * different locations where the SKU is restricted. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Get the restrictionInfo property: The information about the restriction where the SKU cannot be used. + * + * @return the restrictionInfo value. + */ + public ResourceSkuRestrictionInfo restrictionInfo() { + return this.restrictionInfo; + } + + /** + * Get the reasonCode property: The reason for restriction. + * + * @return the reasonCode value. + */ + public ResourceSkuRestrictionsReasonCode reasonCode() { + return this.reasonCode; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restrictionInfo() != null) { + restrictionInfo().validate(); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionsReasonCode.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionsReasonCode.java new file mode 100644 index 0000000000000..b30243f07c420 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionsReasonCode.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceSkuRestrictionsReasonCode. */ +public final class ResourceSkuRestrictionsReasonCode extends ExpandableStringEnum { + /** Static value QuotaId for ResourceSkuRestrictionsReasonCode. */ + public static final ResourceSkuRestrictionsReasonCode QUOTA_ID = fromString("QuotaId"); + + /** Static value NotAvailableForSubscription for ResourceSkuRestrictionsReasonCode. */ + public static final ResourceSkuRestrictionsReasonCode NOT_AVAILABLE_FOR_SUBSCRIPTION = + fromString("NotAvailableForSubscription"); + + /** + * Creates or finds a ResourceSkuRestrictionsReasonCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceSkuRestrictionsReasonCode. + */ + @JsonCreator + public static ResourceSkuRestrictionsReasonCode fromString(String name) { + return fromString(name, ResourceSkuRestrictionsReasonCode.class); + } + + /** @return known ResourceSkuRestrictionsReasonCode values. */ + public static Collection values() { + return values(ResourceSkuRestrictionsReasonCode.class); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionsType.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionsType.java new file mode 100644 index 0000000000000..ca0fb28169973 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkuRestrictionsType.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.cognitiveservices.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceSkuRestrictionsType. */ +public enum ResourceSkuRestrictionsType { + /** Enum value Location. */ + LOCATION("Location"), + + /** Enum value Zone. */ + ZONE("Zone"); + + /** The actual serialized value for a ResourceSkuRestrictionsType instance. */ + private final String value; + + ResourceSkuRestrictionsType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceSkuRestrictionsType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceSkuRestrictionsType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceSkuRestrictionsType fromString(String value) { + ResourceSkuRestrictionsType[] items = ResourceSkuRestrictionsType.values(); + for (ResourceSkuRestrictionsType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkus.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkus.java new file mode 100644 index 0000000000000..930adaa5bc18f --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkus.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.cognitiveservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceSkus. */ +public interface ResourceSkus { + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your 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 Microsoft. + */ + PagedIterable list(); + + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your 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 Microsoft. + */ + PagedIterable list(Context context); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkusResult.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkusResult.java new file mode 100644 index 0000000000000..b250b5a1d6ff7 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/ResourceSkusResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.cognitiveservices.fluent.models.ResourceSkuInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The Get Skus operation response. */ +@Fluent +public final class ResourceSkusResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSkusResult.class); + + /* + * The list of skus available for the subscription. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The uri to fetch the next page of Skus. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of skus available for the subscription. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of skus available for the subscription. + * + * @param value the value value to set. + * @return the ResourceSkusResult object itself. + */ + public ResourceSkusResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of Skus. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of Skus. + * + * @param nextLink the nextLink value to set. + * @return the ResourceSkusResult object itself. + */ + public ResourceSkusResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ResourceSkusResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Sku.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Sku.java new file mode 100644 index 0000000000000..149d473700f1f --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Sku.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.cognitiveservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SKU of the cognitive services account. */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * Gets or sets the sku name. Required for account creation, optional for + * update. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Gets the sku tier. This is based on the SKU name. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private SkuTier tier; + + /** + * Get the name property: Gets or sets the sku name. Required for account creation, optional for update. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the sku name. Required for account creation, optional for update. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Gets the sku tier. This is based on the SKU name. + * + * @return the tier value. + */ + public SkuTier tier() { + return this.tier; + } + + /** + * 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 Sku")); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/SkuCapability.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/SkuCapability.java new file mode 100644 index 0000000000000..0a438cff32ba5 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/SkuCapability.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.cognitiveservices.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; + +/** SkuCapability indicates the capability of a certain feature. */ +@Fluent +public final class SkuCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SkuCapability.class); + + /* + * The name of the SkuCapability. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the SkuCapability. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The name of the SkuCapability. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SkuCapability. + * + * @param name the name value to set. + * @return the SkuCapability object itself. + */ + public SkuCapability withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the SkuCapability. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the SkuCapability. + * + * @param value the value value to set. + * @return the SkuCapability object itself. + */ + public SkuCapability 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/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/SkuTier.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/SkuTier.java new file mode 100644 index 0000000000000..47571a0bd37e0 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/SkuTier.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.cognitiveservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SkuTier. */ +public final class SkuTier extends ExpandableStringEnum { + /** Static value Free for SkuTier. */ + public static final SkuTier FREE = fromString("Free"); + + /** Static value Standard for SkuTier. */ + public static final SkuTier STANDARD = fromString("Standard"); + + /** Static value Premium for SkuTier. */ + public static final SkuTier PREMIUM = fromString("Premium"); + + /** Static value Enterprise for SkuTier. */ + public static final SkuTier ENTERPRISE = fromString("Enterprise"); + + /** + * Creates or finds a SkuTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuTier. + */ + @JsonCreator + public static SkuTier fromString(String name) { + return fromString(name, SkuTier.class); + } + + /** @return known SkuTier values. */ + public static Collection values() { + return values(SkuTier.class); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UnitType.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UnitType.java new file mode 100644 index 0000000000000..2600db0a4c01a --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UnitType.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.cognitiveservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UnitType. */ +public final class UnitType extends ExpandableStringEnum { + /** Static value Count for UnitType. */ + public static final UnitType COUNT = fromString("Count"); + + /** Static value Bytes for UnitType. */ + public static final UnitType BYTES = fromString("Bytes"); + + /** Static value Seconds for UnitType. */ + public static final UnitType SECONDS = fromString("Seconds"); + + /** Static value Percent for UnitType. */ + public static final UnitType PERCENT = fromString("Percent"); + + /** Static value CountPerSecond for UnitType. */ + public static final UnitType COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** Static value BytesPerSecond for UnitType. */ + public static final UnitType BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** Static value Milliseconds for UnitType. */ + public static final UnitType MILLISECONDS = fromString("Milliseconds"); + + /** + * Creates or finds a UnitType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UnitType. + */ + @JsonCreator + public static UnitType fromString(String name) { + return fromString(name, UnitType.class); + } + + /** @return known UnitType values. */ + public static Collection values() { + return values(UnitType.class); + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Usage.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Usage.java new file mode 100644 index 0000000000000..4c005b3f5392d --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/Usage.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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 usage data for a usage request. */ +@Fluent +public final class Usage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Usage.class); + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitType unit; + + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /* + * The quota period used to summarize the usage values. + */ + @JsonProperty(value = "quotaPeriod", access = JsonProperty.Access.WRITE_ONLY) + private String quotaPeriod; + + /* + * Maximum value for this metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /* + * Current value for this metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /* + * Next reset time for current quota. + */ + @JsonProperty(value = "nextResetTime", access = JsonProperty.Access.WRITE_ONLY) + private String nextResetTime; + + /* + * Cognitive Services account quota usage status. + */ + @JsonProperty(value = "status") + private QuotaUsageStatus status; + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the quotaPeriod property: The quota period used to summarize the usage values. + * + * @return the quotaPeriod value. + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Get the limit property: Maximum value for this metric. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the currentValue property: Current value for this metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the nextResetTime property: Next reset time for current quota. + * + * @return the nextResetTime value. + */ + public String nextResetTime() { + return this.nextResetTime; + } + + /** + * Get the status property: Cognitive Services account quota usage status. + * + * @return the status value. + */ + public QuotaUsageStatus status() { + return this.status; + } + + /** + * Set the status property: Cognitive Services account quota usage status. + * + * @param status the status value to set. + * @return the Usage object itself. + */ + public Usage withStatus(QuotaUsageStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UsagesResult.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UsagesResult.java new file mode 100644 index 0000000000000..3f4ce5f76cbc5 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UsagesResult.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.models; + +import com.azure.resourcemanager.cognitiveservices.fluent.models.UsagesResultInner; +import java.util.List; + +/** An immutable client-side representation of UsagesResult. */ +public interface UsagesResult { + /** + * Gets the value property: The list of usages for Cognitive Service account. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.cognitiveservices.fluent.models.UsagesResultInner object. + * + * @return the inner object. + */ + UsagesResultInner innerModel(); +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UserAssignedIdentity.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UserAssignedIdentity.java new file mode 100644 index 0000000000000..bff782a5a2e27 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UserAssignedIdentity.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.cognitiveservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** User-assigned managed identity. */ +@Fluent +public class UserAssignedIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserAssignedIdentity.class); + + /* + * Azure Active Directory principal ID associated with this Identity. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /* + * Client App Id associated with this identity. + */ + @JsonProperty(value = "clientId") + private String clientId; + + /** + * Get the principalId property: Azure Active Directory principal ID associated with this Identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: Azure Active Directory principal ID associated with this Identity. + * + * @param principalId the principalId value to set. + * @return the UserAssignedIdentity object itself. + */ + public UserAssignedIdentity withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the clientId property: Client App Id associated with this identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: Client App Id associated with this identity. + * + * @param clientId the clientId value to set. + * @return the UserAssignedIdentity object itself. + */ + public UserAssignedIdentity withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UserOwnedStorage.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UserOwnedStorage.java new file mode 100644 index 0000000000000..02f3bd8523901 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/UserOwnedStorage.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.cognitiveservices.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 user owned storage for Cognitive Services account. */ +@Fluent +public final class UserOwnedStorage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserOwnedStorage.class); + + /* + * Full resource id of a Microsoft.Storage resource. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Get the resourceId property: Full resource id of a Microsoft.Storage resource. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Full resource id of a Microsoft.Storage resource. + * + * @param resourceId the resourceId value to set. + * @return the UserOwnedStorage object itself. + */ + public UserOwnedStorage withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/VirtualNetworkRule.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/VirtualNetworkRule.java new file mode 100644 index 0000000000000..01f003c0a8b9d --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/VirtualNetworkRule.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cognitiveservices.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 rule governing the accessibility from a specific virtual network. */ +@Fluent +public final class VirtualNetworkRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRule.class); + + /* + * Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Gets the state of virtual network rule. + */ + @JsonProperty(value = "state") + private String state; + + /* + * Ignore missing vnet service endpoint or not. + */ + @JsonProperty(value = "ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /** + * Get the id property: Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + * + * @param id the id value to set. + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withId(String id) { + this.id = id; + return this; + } + + /** + * Get the state property: Gets the state of virtual network rule. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: Gets the state of virtual network rule. + * + * @param state the state value to set. + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withState(String state) { + this.state = state; + return this; + } + + /** + * Get the ignoreMissingVnetServiceEndpoint property: Ignore missing vnet service endpoint or not. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set the ignoreMissingVnetServiceEndpoint property: Ignore missing vnet service endpoint or not. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set. + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model VirtualNetworkRule")); + } + } +} diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/package-info.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/package-info.java new file mode 100644 index 0000000000000..acc20665353a5 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for CognitiveServicesManagementClient. Cognitive Services Management Client. */ +package com.azure.resourcemanager.cognitiveservices.models; diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/package-info.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/package-info.java new file mode 100644 index 0000000000000..91c8da030ee4e --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for CognitiveServicesManagementClient. Cognitive Services Management Client. */ +package com.azure.resourcemanager.cognitiveservices; diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/module-info.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/module-info.java new file mode 100644 index 0000000000000..0012324b616a1 --- /dev/null +++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/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.cognitiveservices { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.cognitiveservices; + exports com.azure.resourcemanager.cognitiveservices.fluent; + exports com.azure.resourcemanager.cognitiveservices.fluent.models; + exports com.azure.resourcemanager.cognitiveservices.models; + + opens com.azure.resourcemanager.cognitiveservices.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.cognitiveservices.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/cognitiveservices/ci.yml b/sdk/cognitiveservices/ci.yml index 0b7e6a73747a4..be71beafab5fb 100644 --- a/sdk/cognitiveservices/ci.yml +++ b/sdk/cognitiveservices/ci.yml @@ -3,29 +3,29 @@ trigger: branches: include: - - master - - hotfix/* - - release/* + - master + - hotfix/* + - release/* paths: include: - - sdk/cognitiveservices/ + - sdk/cognitiveservices/ exclude: - - sdk/cognitiveservices/mgmt-v2016_02_01_preview - - sdk/cognitiveservices/mgmt-v2017_04_18 + - sdk/cognitiveservices/mgmt-v2016_02_01_preview + - sdk/cognitiveservices/mgmt-v2017_04_18 pr: branches: include: - - master - - feature/* - - hotfix/* - - release/* + - master + - feature/* + - hotfix/* + - release/* paths: include: - - sdk/cognitiveservices/ + - sdk/cognitiveservices/ exclude: - - sdk/cognitiveservices/mgmt-v2016_02_01_preview - - sdk/cognitiveservices/mgmt-v2017_04_18 + - sdk/cognitiveservices/mgmt-v2016_02_01_preview + - sdk/cognitiveservices/mgmt-v2017_04_18 extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -33,61 +33,63 @@ extends: SDKType: data ServiceDirectory: cognitiveservices Artifacts: - - name: azure-cognitiveservices-autosuggest - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesautosuggest - - name: azure-cognitiveservices-computervision - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicescomputervision - - name: azure-cognitiveservices-contentmoderator - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicescontentmoderator - - name: azure-cognitiveservices-customimagesearch - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicescustomimagesearch - - name: azure-cognitiveservices-customsearch - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicescustomsearch - - name: azure-cognitiveservices-customvision-prediction - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicescustomvisionprediction - - name: azure-cognitiveservices-customvision-training - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicescustomvisiontraining - - name: azure-cognitiveservices-entitysearch - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesentitysearch - - name: azure-cognitiveservices-faceapi - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesfaceapi - - name: azure-cognitiveservices-imagesearch - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesimagesearch - - name: azure-cognitiveservices-luis-authoring - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesluisauthoring - - name: azure-cognitiveservices-luis-runtime - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesluisruntime - - name: azure-cognitiveservices-newssearch - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesnewssearch - - name: azure-cognitiveservices-spellcheck - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesspellcheck - - name: azure-cognitiveservices-textanalytics - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicestextanalytics - - name: azure-cognitiveservices-videosearch - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesvideosearch - - name: azure-cognitiveservices-visualsearch - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesvisualsearch - - name: azure-cognitiveservices-websearch - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveserviceswebsearch - - name: azure-cognitiveservices-qnamaker - groupId: com.microsoft.azure.cognitiveservices - safeName: azurecognitiveservicesqnamaker - + - name: azure-cognitiveservices-autosuggest + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesautosuggest + - name: azure-cognitiveservices-computervision + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicescomputervision + - name: azure-cognitiveservices-contentmoderator + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicescontentmoderator + - name: azure-cognitiveservices-customimagesearch + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicescustomimagesearch + - name: azure-cognitiveservices-customsearch + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicescustomsearch + - name: azure-cognitiveservices-customvision-prediction + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicescustomvisionprediction + - name: azure-cognitiveservices-customvision-training + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicescustomvisiontraining + - name: azure-cognitiveservices-entitysearch + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesentitysearch + - name: azure-cognitiveservices-faceapi + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesfaceapi + - name: azure-cognitiveservices-imagesearch + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesimagesearch + - name: azure-cognitiveservices-luis-authoring + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesluisauthoring + - name: azure-cognitiveservices-luis-runtime + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesluisruntime + - name: azure-cognitiveservices-newssearch + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesnewssearch + - name: azure-cognitiveservices-spellcheck + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesspellcheck + - name: azure-cognitiveservices-textanalytics + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicestextanalytics + - name: azure-cognitiveservices-videosearch + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesvideosearch + - name: azure-cognitiveservices-visualsearch + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesvisualsearch + - name: azure-cognitiveservices-websearch + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveserviceswebsearch + - name: azure-cognitiveservices-qnamaker + groupId: com.microsoft.azure.cognitiveservices + safeName: azurecognitiveservicesqnamaker + - name: azure-resourcemanager-cognitiveservices + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercognitiveservices diff --git a/sdk/cognitiveservices/pom.xml b/sdk/cognitiveservices/pom.xml index 8cd75163923f6..f03fb6511c965 100644 --- a/sdk/cognitiveservices/pom.xml +++ b/sdk/cognitiveservices/pom.xml @@ -9,6 +9,7 @@ pom 1.0.0 + azure-resourcemanager-cognitiveservices ms-azure-cs-autosuggest ms-azure-cs-computervision ms-azure-cs-contentmoderator